]> git.ipfire.org Git - thirdparty/linux.git/commit
perf unwind-libdw: Fix a cross-arch unwinding bug
authorShimin Guo <shimin.guo@skydio.com>
Sat, 17 Jan 2026 05:28:30 +0000 (21:28 -0800)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Tue, 20 Jan 2026 16:00:39 +0000 (13:00 -0300)
commite62fae9d9e85d38cdda1ee08a424e1b5b8246620
treeedf8e3685a7396a3d7b90b75781dc12f32a91044
parent86f3801208ed1632ddd75a8e95ade5e433567be1
perf unwind-libdw: Fix a cross-arch unwinding bug

The set_initial_registers field of Dwfl_Thread_Callbacks needs to be set
according to the arch of the stack samples being analyzed, not the arch
that perf itself is built for.

Currently perf fails to unwind stack samples collected from archs
different from that of the host perf is running on.

This patch moves the arch-specific implementations of set_initial_registers
from tools/perf/arch to tools/perf/utli/unwind-libdw-arch, similar to the
way the perf-regs-arch folder contains arch-specific functions related to
registers, and chooses the implementation based on the arch of the data
being processed.

Reviewed-by: Ian Rogers <irogers@google.com>
Signed-off-by: Shimin Guo <shimin.guo@skydio.com>
Acked-by: Namhyung Kim <namhyung@kernel.org>
Cc: Aditya Bodkhe <aditya.b1@linux.ibm.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Albert Ou <aou@eecs.berkeley.edu>
Cc: Alexandre Ghiti <alex@ghiti.fr>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Athira Rajeev <atrajeev@linux.ibm.com>
Cc: Chun-Tse Shao <ctshao@google.com>
Cc: Dmitriy Vyukov <dvyukov@google.com>
Cc: Dr. David Alan Gilbert <linux@treblig.org>
Cc: Guo Ren <guoren@kernel.org>
Cc: Haibo Xu <haibo1.xu@intel.com>
Cc: Howard Chu <howardchu95@gmail.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: James Clark <james.clark@linaro.org>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: John Garry <john.g.garry@oracle.com>
Cc: Krzysztof Ɓopatowski <krzysztof.m.lopatowski@gmail.com>
Cc: Leo Yan <leo.yan@linux.dev>
Cc: Mark Wielaard <mark@klomp.org>
Cc: Palmer Dabbelt <palmer@dabbelt.com>
Cc: Paul Walmsley <pjw@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Sergei Trofimovich <slyich@gmail.com>
Cc: Stephen Brennan <stephen.s.brennan@oracle.com>
Cc: Thomas Falcon <thomas.falcon@intel.com>
Cc: Will Deacon <will@kernel.org>
Signed-off-by: Ian Rogers <irogers@google.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
19 files changed:
tools/perf/arch/arm/util/Build
tools/perf/arch/arm64/util/Build
tools/perf/arch/csky/util/Build
tools/perf/arch/powerpc/util/Build
tools/perf/arch/riscv/util/Build
tools/perf/arch/s390/util/Build
tools/perf/arch/x86/util/Build
tools/perf/util/Build
tools/perf/util/unwind-libdw-arch/Build [new file with mode: 0644]
tools/perf/util/unwind-libdw-arch/unwind-libdw-arm.c [moved from tools/perf/arch/arm/util/unwind-libdw.c with 80% similarity]
tools/perf/util/unwind-libdw-arch/unwind-libdw-arm64.c [moved from tools/perf/arch/arm64/util/unwind-libdw.c with 87% similarity]
tools/perf/util/unwind-libdw-arch/unwind-libdw-csky.c [moved from tools/perf/arch/csky/util/unwind-libdw.c with 90% similarity]
tools/perf/util/unwind-libdw-arch/unwind-libdw-loongarch.c [moved from tools/perf/arch/loongarch/util/unwind-libdw.c with 86% similarity]
tools/perf/util/unwind-libdw-arch/unwind-libdw-powerpc.c [moved from tools/perf/arch/powerpc/util/unwind-libdw.c with 89% similarity]
tools/perf/util/unwind-libdw-arch/unwind-libdw-riscv.c [moved from tools/perf/arch/riscv/util/unwind-libdw.c with 87% similarity]
tools/perf/util/unwind-libdw-arch/unwind-libdw-s390.c [moved from tools/perf/arch/s390/util/unwind-libdw.c with 84% similarity]
tools/perf/util/unwind-libdw-arch/unwind-libdw-x86.c [moved from tools/perf/arch/x86/util/unwind-libdw.c with 87% similarity]
tools/perf/util/unwind-libdw.c
tools/perf/util/unwind-libdw.h