]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
perf lock-contention: Use perf_env e_machine rather than arch
authorIan Rogers <irogers@google.com>
Tue, 2 Jun 2026 15:25:10 +0000 (08:25 -0700)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Wed, 3 Jun 2026 19:50:34 +0000 (16:50 -0300)
Use the e_machine rather than arch string matching for powerpc.

Signed-off-by: Ian Rogers <irogers@google.com>
Acked-by: Namhyung Kim <namhyung@kernel.org>
Cc: Alexander Gordeev <agordeev@linux.ibm.com>
Cc: Heiko Carstens <hca@linux.ibm.com>
Cc: Honglei Wang <jameshongleiwang@126.com>
Cc: Jan Polensky <japo@linux.ibm.com>
Cc: Sumanth Korikkar <sumanthk@linux.ibm.com>
Cc: Thomas Richter <tmricht@linux.ibm.com>
Cc: Vasily Gorbik <gor@linux.ibm.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/util/lock-contention.c

index 92e7b7b572a22daa7bde4695017bf5b9acf5084b..119a7206f3cd273f4593431fa89011635d069da0 100644 (file)
@@ -104,7 +104,8 @@ bool match_callstack_filter(struct machine *machine, u64 *callstack, int max_sta
        struct map *kmap;
        struct symbol *sym;
        u64 ip;
-       const char *arch = perf_env__arch(machine->env);
+       uint16_t e_machine = perf_env__e_machine(machine->env, /*e_flags=*/NULL);
+       bool is_powerpc = e_machine == EM_PPC64 || e_machine == EM_PPC;
 
        if (list_empty(&callstack_filters))
                return true;
@@ -125,8 +126,7 @@ bool match_callstack_filter(struct machine *machine, u64 *callstack, int max_sta
                 * incase first or second callstack index entry has 0
                 * address for powerpc.
                 */
-               if (!callstack || (!callstack[i] && (strcmp(arch, "powerpc") ||
-                                               (i != 1 && i != 2))))
+               if (!callstack || (!callstack[i] && (!is_powerpc || (i != 1 && i != 2))))
                        break;
 
                ip = callstack[i];