The first 6 patches are minor tweaks addressing a memory leak, correctness and performance. Patch 5 incorportes the reviewed patch by Shimin Guo [1] that makes the libdw unwinding support cross architecture. The cross architecture files will be refactored in this series.
Patch 7 unifies the dwfl for dsos and addr2line with that for the powerpc skip-callchain-idx. An issue described in: https://lore.kernel.org/lkml/CAP-5=fX+zw-CUEYEtrPA6vYUKqpp4LZp-p==qsbzanwlcx0...@mail.gmail.com/ Patch 8 migrates the perf regs code away from using an architecture substring to using the ELF machine, which is both more efficient and more accurate. Patches 9 to 21 clean up the libdw and dwarf register code removing the need for different libdw dwarf register initialization routines by introducing a perf reg to dwarf register mapping function. This function is added for all perf register supporting architectures. Patch 22 avoids discarding the dwfl for every libdw unwind, it can speed up perf report by amounts like 18x. Patch 23 adds inline information for frame pointers, an issue described here: https://lore.kernel.org/lkml/CAP-5=fWh5=awq_mav7b9nsuz0ts2qpmmawyhqkpt_byfjrn...@mail.gmail.com/ [1] https://lore.kernel.org/lkml/[email protected]/ Ian Rogers (22): perf symbol-elf: Fix leak of ELF files with GNU debugdata perf dso: Extra validity checks that e_machine is valid perf record: Disable inline frames when marking build IDs perf libdw_addr2line: Fixes to srcline memory allocation perf unwind-libdw: Correct argument to dwfl_attach_state perf powerpc: Unify the skip-callchain-idx libdw with that for addr2line perf perf_regs: Switch from arch string to int e_machine perf dwarf-regs: Add util/dwarf-regs-arch for consistency with perf-regs perf dwarf-regs: Remove get_arch_regnum perf dwarf-regs: Clean up x86 dwarf_regnum code perf dwarf-regs: Add get_dwarf_regnum_for_perf_regnum and use for x86 unwinding perf dwarf-regs: Add basic get_dwarf_regnum for most architectures perf dwarf-regs: Add ARM perf to dwarf register number mapping functions perf dwarf-regs: Add csky perf to dwarf register number mapping functions perf dwarf-regs: Add loongarch perf to dwarf register number mapping functions perf dwarf-regs: Add powerpc perf to dwarf register number mapping functions perf dwarf-regs: Add RISC-V perf to dwarf register number mapping functions perf dwarf-regs: Add S390 perf to dwarf register number mapping functions perf dwarf-regs: Add MIPS perf to dwarf register number mapping functions perf build: Remove NO_LIBDW_DWARF_UNWIND option perf unwind-libdw: Don't discard loaded ELF/Dwarf after every unwind perf machine: Add inline information to frame pointer and LBR callchains Shimin Guo (1): perf unwind-libdw: fix a cross-arch unwinding bug tools/perf/Makefile.config | 19 +- tools/perf/arch/arm/util/Build | 1 - tools/perf/arch/arm/util/unwind-libdw.c | 39 --- tools/perf/arch/arm64/util/Build | 1 - tools/perf/arch/arm64/util/unwind-libdw.c | 61 ---- tools/perf/arch/csky/util/Build | 2 - tools/perf/arch/csky/util/unwind-libdw.c | 78 ------ tools/perf/arch/loongarch/util/unwind-libdw.c | 57 ---- tools/perf/arch/powerpc/util/Build | 1 - .../arch/powerpc/util/skip-callchain-idx.c | 52 +--- tools/perf/arch/powerpc/util/unwind-libdw.c | 76 ----- tools/perf/arch/riscv/util/Build | 1 - tools/perf/arch/riscv/util/unwind-libdw.c | 58 ---- tools/perf/arch/s390/util/Build | 2 - tools/perf/arch/s390/util/unwind-libdw.c | 65 ----- tools/perf/arch/x86/util/Build | 1 - tools/perf/arch/x86/util/unwind-libdw.c | 54 ---- tools/perf/builtin-record.c | 3 +- tools/perf/builtin-script.c | 17 +- tools/perf/tests/make | 3 +- tools/perf/tests/shell/addr2line_inlines.sh | 31 ++- tools/perf/util/Build | 6 +- tools/perf/util/dso.c | 33 ++- tools/perf/util/dso.h | 23 +- tools/perf/util/dwarf-regs-arch/Build | 9 + .../util/dwarf-regs-arch/dwarf-regs-arm.c | 12 + .../util/dwarf-regs-arch/dwarf-regs-arm64.c | 12 + .../util/dwarf-regs-arch/dwarf-regs-csky.c | 126 +++++++++ .../dwarf-regs-arch/dwarf-regs-loongarch.c | 12 + .../util/dwarf-regs-arch/dwarf-regs-mips.c | 14 + .../util/dwarf-regs-arch/dwarf-regs-powerpc.c | 136 +++++++++ .../util/dwarf-regs-arch/dwarf-regs-riscv.c | 12 + .../util/dwarf-regs-arch/dwarf-regs-s390.c | 53 ++++ .../util/dwarf-regs-arch/dwarf-regs-x86.c | 260 ++++++++++++++++++ tools/perf/util/dwarf-regs-csky.c | 50 ---- tools/perf/util/dwarf-regs-powerpc.c | 61 ---- tools/perf/util/dwarf-regs-x86.c | 50 ---- tools/perf/util/dwarf-regs.c | 151 +++++++++- tools/perf/util/evsel.c | 14 +- tools/perf/util/include/dwarf-regs.h | 28 +- tools/perf/util/libdw.c | 115 ++++---- tools/perf/util/libdw.h | 12 +- tools/perf/util/machine.c | 104 ++++--- tools/perf/util/maps.c | 36 ++- tools/perf/util/maps.h | 4 + tools/perf/util/perf_regs.c | 105 ++++--- tools/perf/util/perf_regs.h | 10 +- .../scripting-engines/trace-event-python.c | 21 +- tools/perf/util/session.c | 65 +++-- tools/perf/util/session.h | 1 + tools/perf/util/srcline.c | 2 +- tools/perf/util/symbol-elf.c | 2 +- tools/perf/util/unwind-libdw.c | 154 +++++++++-- tools/perf/util/unwind-libdw.h | 10 +- tools/perf/util/unwind-libunwind-local.c | 7 +- 55 files changed, 1347 insertions(+), 985 deletions(-) delete mode 100644 tools/perf/arch/arm/util/unwind-libdw.c delete mode 100644 tools/perf/arch/arm64/util/unwind-libdw.c delete mode 100644 tools/perf/arch/csky/util/unwind-libdw.c delete mode 100644 tools/perf/arch/loongarch/util/unwind-libdw.c delete mode 100644 tools/perf/arch/powerpc/util/unwind-libdw.c delete mode 100644 tools/perf/arch/riscv/util/unwind-libdw.c delete mode 100644 tools/perf/arch/s390/util/unwind-libdw.c delete mode 100644 tools/perf/arch/x86/util/unwind-libdw.c create mode 100644 tools/perf/util/dwarf-regs-arch/Build create mode 100644 tools/perf/util/dwarf-regs-arch/dwarf-regs-arm.c create mode 100644 tools/perf/util/dwarf-regs-arch/dwarf-regs-arm64.c create mode 100644 tools/perf/util/dwarf-regs-arch/dwarf-regs-csky.c create mode 100644 tools/perf/util/dwarf-regs-arch/dwarf-regs-loongarch.c create mode 100644 tools/perf/util/dwarf-regs-arch/dwarf-regs-mips.c create mode 100644 tools/perf/util/dwarf-regs-arch/dwarf-regs-powerpc.c create mode 100644 tools/perf/util/dwarf-regs-arch/dwarf-regs-riscv.c create mode 100644 tools/perf/util/dwarf-regs-arch/dwarf-regs-s390.c create mode 100644 tools/perf/util/dwarf-regs-arch/dwarf-regs-x86.c delete mode 100644 tools/perf/util/dwarf-regs-csky.c delete mode 100644 tools/perf/util/dwarf-regs-powerpc.c delete mode 100644 tools/perf/util/dwarf-regs-x86.c -- 2.52.0.457.g6b5491de43-goog
