Skip to content

perf dwarf/libdw extra support, speed and clean ups

Ian Rogers linux-arm-kernel linux-csky linux-perf-users linux-riscv lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest23 patches 8 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/23perf symbol-elf: Fix leak of ELF files with GNU debugdatatools/perf/util/symbol-elf.c+1 -10 replies
2/23perf dso: Extra validity checks that e_machine is validtools/perf/util/dso.c+21 -100 replies
3/23perf record: Disable inline frames when marking build IDstools/perf/builtin-record.c+2 -10 replies
4/23perf unwind-libdw: fix a cross-arch unwinding bugtools/perf/arch/arm/util/Build tools/perf/arch/arm64/util/Build tools/perf/arch/csky/util/Build +16 more+104 -572 replies
5/23perf libdw_addr2line: Fixes to srcline memory allocationtools/perf/util/libdw.c+11 -30 replies
6/23perf unwind-libdw: Correct argument to dwfl_attach_statetools/perf/util/unwind-libdw.c+1 -10 replies
7/23perf powerpc: Unify the skip-callchain-idx libdw with that for addr2linetools/perf/arch/powerpc/util/skip-callchain-idx.c tools/perf/util/dso.c tools/perf/util/dso.h +3 more+89 -1030 replies
8/23perf perf_regs: Switch from arch string to int e_machinetools/perf/builtin-script.c tools/perf/util/evsel.c tools/perf/util/perf_regs.c +6 more+164 -883 replies
9/23perf dwarf-regs: Add util/dwarf-regs-arch for consistency with perf-regstools/perf/util/Build tools/perf/util/dwarf-regs-arch/Build tools/perf/util/dwarf-regs-arch/dwarf-regs-csky.c +2 more+4 -30 replies
10/23perf dwarf-regs: Remove get_arch_regnumtools/perf/util/dwarf-regs.c tools/perf/util/include/dwarf-regs.h+0 -160 replies
11/23perf dwarf-regs: Clean up x86 dwarf_regnum codetools/perf/util/dwarf-regs-arch/dwarf-regs-x86.c tools/perf/util/dwarf-regs.c tools/perf/util/include/dwarf-regs.h+129 -120 replies
12/23perf dwarf-regs: Add get_dwarf_regnum_for_perf_regnum and use for x86 unwindingtools/perf/util/dwarf-regs-arch/dwarf-regs-x86.c tools/perf/util/dwarf-regs.c tools/perf/util/include/dwarf-regs.h +4 more+222 -631 reply
13/23perf dwarf-regs: Add basic get_dwarf_regnum for most architecturestools/perf/util/dwarf-regs-arch/dwarf-regs-csky.c tools/perf/util/dwarf-regs.c tools/perf/util/include/dwarf-regs.h+78 -90 replies
14/23perf dwarf-regs: Add ARM perf to dwarf register number mapping functionstools/perf/util/dwarf-regs-arch/Build tools/perf/util/dwarf-regs-arch/dwarf-regs-arm.c tools/perf/util/dwarf-regs-arch/dwarf-regs-arm64.c +7 more+36 -1110 replies
15/23perf dwarf-regs: Add csky perf to dwarf register number mapping functionstools/perf/util/dwarf-regs-arch/dwarf-regs-csky.c tools/perf/util/dwarf-regs.c tools/perf/util/include/dwarf-regs.h +4 more+64 -840 replies
16/23perf dwarf-regs: Add loongarch perf to dwarf register number mapping functionstools/perf/util/dwarf-regs-arch/Build tools/perf/util/dwarf-regs-arch/dwarf-regs-loongarch.c tools/perf/util/dwarf-regs.c +5 more+18 -630 replies
17/23perf dwarf-regs: Add powerpc perf to dwarf register number mapping functionstools/perf/util/dwarf-regs-arch/dwarf-regs-powerpc.c tools/perf/util/dwarf-regs.c tools/perf/util/include/dwarf-regs.h +4 more+82 -830 replies
18/23perf dwarf-regs: Add RISC-V perf to dwarf register number mapping functionstools/perf/util/dwarf-regs-arch/Build tools/perf/util/dwarf-regs-arch/dwarf-regs-riscv.c tools/perf/util/dwarf-regs.c +5 more+18 -640 replies
19/23perf dwarf-regs: Add S390 perf to dwarf register number mapping functionstools/perf/util/dwarf-regs-arch/Build tools/perf/util/dwarf-regs-arch/dwarf-regs-s390.c tools/perf/util/dwarf-regs.c +5 more+62 -940 replies
20/23perf dwarf-regs: Add MIPS perf to dwarf register number mapping functionstools/perf/util/dwarf-regs-arch/Build tools/perf/util/dwarf-regs-arch/dwarf-regs-mips.c tools/perf/util/dwarf-regs.c +2 more+21 -20 replies
21/23perf build: Remove NO_LIBDW_DWARF_UNWIND optiontools/perf/Makefile.config tools/perf/tests/make tools/perf/util/Build+3 -220 replies
22/23perf unwind-libdw: Don't discard loaded ELF/Dwarf after every unwindtools/perf/util/maps.c tools/perf/util/maps.h tools/perf/util/unwind-libdw.c +1 more+112 -272 replies
23/23perf machine: Add inline information to frame pointer and LBR callchainstools/perf/tests/shell/addr2line_inlines.sh tools/perf/util/machine.c+86 -490 replies

Reviews trailers per patch

1 of 23 patches has a Reviewed-by or Acked-by.

PatchIan RogersNamhyung Kim
1/23
2/23
3/23
4/23R-b A-b
5/23
6/23
7/23
8/23
9/23
10/23
11/23
12/23
13/23
14/23
15/23
16/23
17/23
18/23
19/23
20/23
21/23
22/23
23/23

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [PATCH v1 00/23] perf dwarf/libdw extra support, speed and clean ups

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==QsbZaNwLcX0Whw@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_BYFJRnf2w@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
Signature · 1 line
2.52.0.457.g6b5491de43-goog