]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
perf lock: Add percpu-rwsem for type filter
authorChun-Tse Shao <ctshao@google.com>
Thu, 16 Jan 2025 23:58:15 +0000 (15:58 -0800)
committerNamhyung Kim <namhyung@kernel.org>
Fri, 17 Jan 2025 18:12:40 +0000 (10:12 -0800)
percpu-rwsem was missing in man page. And for backward compatibility,
replace `pcpu-sem` with `percpu-rwsem` before parsing lock name.
Tested `./perf lock con -ab -Y pcpu-sem` and `./perf lock con -ab -Y
percpu-rwsem`

Fixes: 4f701063bfa2 ("perf lock contention: Show lock type with address")
Reviewed-by: Namhyung Kim <namhyung@kernel.org>
Signed-off-by: Chun-Tse Shao <ctshao@google.com>
Cc: nick.forrington@arm.com
Link: https://lore.kernel.org/r/20250116235838.2769691-2-ctshao@google.com
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
tools/perf/Documentation/perf-lock.txt
tools/perf/builtin-lock.c

index 57a940399de05487635a204ff60a25bd4f8967bb..d3793054f7d3562667c5cb29a5645717fc55673f 100644 (file)
@@ -187,8 +187,8 @@ CONTENTION OPTIONS
        Show lock contention only for given lock types (comma separated list).
        Available values are:
          semaphore, spinlock, rwlock, rwlock:R, rwlock:W, rwsem, rwsem:R, rwsem:W,
-         rtmutex, rwlock-rt, rwlock-rt:R, rwlock-rt:W, pcpu-sem, pcpu-sem:R, pcpu-sem:W,
-         mutex
+         rtmutex, rwlock-rt, rwlock-rt:R, rwlock-rt:W, percpu-rwmem, pcpu-sem,
+         pcpu-sem:R, pcpu-sem:W, mutex
 
        Note that RW-variant of locks have :R and :W suffix.  Names without the
        suffix are shortcuts for the both variants.  Ex) rwsem = rwsem:R + rwsem:W.
index 70440966d8e3d3ae47d8c721c4851cbec612da47..351d32e498f76b430b30f57f9ad26db809630a06 100644 (file)
@@ -2271,7 +2271,10 @@ static int parse_lock_type(const struct option *opt __maybe_unused, const char *
                /*
                 * Otherwise `tok` is `name` in `lock_type_table`.
                 * Single lock name could contain multiple flags.
+                * Replace alias `pcpu-sem` with actual name `percpu-rwsem.
                 */
+               if (!strcmp(tok, "pcpu-sem"))
+                       tok = (char *)"percpu-rwsem";
                for (unsigned int i = 0; i < ARRAY_SIZE(lock_type_table); i++) {
                        if (!strcmp(lock_type_table[i].name, tok)) {
                                if (add_lock_type(lock_type_table[i].flags)) {