Skip to content

Commit e9188ae

Browse files
Chun-Tse Shaonamhyung
authored andcommitted
perf lock: Add percpu-rwsem for type filter
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: 4f70106 ("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>
1 parent 1be9264 commit e9188ae

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

tools/perf/Documentation/perf-lock.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -187,8 +187,8 @@ CONTENTION OPTIONS
187187
Show lock contention only for given lock types (comma separated list).
188188
Available values are:
189189
semaphore, spinlock, rwlock, rwlock:R, rwlock:W, rwsem, rwsem:R, rwsem:W,
190-
rtmutex, rwlock-rt, rwlock-rt:R, rwlock-rt:W, pcpu-sem, pcpu-sem:R, pcpu-sem:W,
191-
mutex
190+
rtmutex, rwlock-rt, rwlock-rt:R, rwlock-rt:W, percpu-rwmem, pcpu-sem,
191+
pcpu-sem:R, pcpu-sem:W, mutex
192192

193193
Note that RW-variant of locks have :R and :W suffix. Names without the
194194
suffix are shortcuts for the both variants. Ex) rwsem = rwsem:R + rwsem:W.

tools/perf/builtin-lock.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2271,7 +2271,10 @@ static int parse_lock_type(const struct option *opt __maybe_unused, const char *
22712271
/*
22722272
* Otherwise `tok` is `name` in `lock_type_table`.
22732273
* Single lock name could contain multiple flags.
2274+
* Replace alias `pcpu-sem` with actual name `percpu-rwsem.
22742275
*/
2276+
if (!strcmp(tok, "pcpu-sem"))
2277+
tok = (char *)"percpu-rwsem";
22752278
for (unsigned int i = 0; i < ARRAY_SIZE(lock_type_table); i++) {
22762279
if (!strcmp(lock_type_table[i].name, tok)) {
22772280
if (add_lock_type(lock_type_table[i].flags)) {

0 commit comments

Comments
 (0)