From: Namhyung Kim Date: Fri, 20 Dec 2024 06:00:06 +0000 (-0800) Subject: perf lock contention: Add and use LCB_F_TYPE_MASK X-Git-Tag: v6.14-rc1~120^2~89 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=d8cc6da4067b66f5fe54b865ae4ed987455d91fc;p=thirdparty%2Flinux.git perf lock contention: Add and use LCB_F_TYPE_MASK This is a preparation for the later change. It'll use more bits in the flags so let's rename the type part and use the mask to extract the type. Signed-off-by: Namhyung Kim Acked-by: Ian Rogers Tested-by: Arnaldo Carvalho de Melo Cc: Adrian Hunter Cc: Andrii Nakryiko Cc: Chun-Tse Shao Cc: Hyeonggon Yoo <42.hyeyoo@gmail.com> Cc: Ingo Molnar Cc: Jiri Olsa Cc: Kan Liang Cc: Kees Cook Cc: Peter Zijlstra Cc: Roman Gushchin Cc: Song Liu Cc: Stephane Eranian Cc: Vlastimil Babka Link: https://lore.kernel.org/r/20241220060009.507297-2-namhyung@kernel.org Signed-off-by: Arnaldo Carvalho de Melo --- diff --git a/tools/perf/builtin-lock.c b/tools/perf/builtin-lock.c index f66948b1fbed9..d9f3477d2b02b 100644 --- a/tools/perf/builtin-lock.c +++ b/tools/perf/builtin-lock.c @@ -1490,7 +1490,7 @@ static const struct { static const char *get_type_str(unsigned int flags) { - flags &= LCB_F_MAX_FLAGS - 1; + flags &= LCB_F_TYPE_MASK; for (unsigned int i = 0; i < ARRAY_SIZE(lock_type_table); i++) { if (lock_type_table[i].flags == flags) @@ -1501,7 +1501,7 @@ static const char *get_type_str(unsigned int flags) static const char *get_type_name(unsigned int flags) { - flags &= LCB_F_MAX_FLAGS - 1; + flags &= LCB_F_TYPE_MASK; for (unsigned int i = 0; i < ARRAY_SIZE(lock_type_table); i++) { if (lock_type_table[i].flags == flags) diff --git a/tools/perf/util/bpf_skel/lock_data.h b/tools/perf/util/bpf_skel/lock_data.h index de12892f992f8..4f0aae5483745 100644 --- a/tools/perf/util/bpf_skel/lock_data.h +++ b/tools/perf/util/bpf_skel/lock_data.h @@ -32,7 +32,8 @@ struct contention_task_data { #define LCD_F_MMAP_LOCK (1U << 31) #define LCD_F_SIGHAND_LOCK (1U << 30) -#define LCB_F_MAX_FLAGS (1U << 7) +#define LCB_F_TYPE_MAX (1U << 7) +#define LCB_F_TYPE_MASK 0x0000007FU struct contention_data { u64 total_time;