Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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: 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>

authored by

Chun-Tse Shao and committed by
Namhyung Kim
e9188ae3 1be92641

+5 -2
+2 -2
tools/perf/Documentation/perf-lock.txt
··· 187 187 Show lock contention only for given lock types (comma separated list). 188 188 Available values are: 189 189 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 192 192 193 193 Note that RW-variant of locks have :R and :W suffix. Names without the 194 194 suffix are shortcuts for the both variants. Ex) rwsem = rwsem:R + rwsem:W.
+3
tools/perf/builtin-lock.c
··· 2271 2271 /* 2272 2272 * Otherwise `tok` is `name` in `lock_type_table`. 2273 2273 * Single lock name could contain multiple flags. 2274 + * Replace alias `pcpu-sem` with actual name `percpu-rwsem. 2274 2275 */ 2276 + if (!strcmp(tok, "pcpu-sem")) 2277 + tok = (char *)"percpu-rwsem"; 2275 2278 for (unsigned int i = 0; i < ARRAY_SIZE(lock_type_table); i++) { 2276 2279 if (!strcmp(lock_type_table[i].name, tok)) { 2277 2280 if (add_lock_type(lock_type_table[i].flags)) {