perf libunwind multiple remote support
Get series with b4
b4 am [email protected]Versions newest first · linked by author and title
- v5 Latest7 patches 10 repliesIn review 4 of 7 applied
- v48 patches 3 repliesSuperseded 1 of 8 applied
- v38 patches 2 repliesSuperseded
Earlier versions · 2
| Version | Posted | Patches | Replies | Status |
|---|---|---|---|---|
| v2 | 8 patches | 9 replies | Superseded | |
| v1 RFC | 7 patches | 2 replies | Superseded |
Patches in v5 4 of 7 applied
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/7 | perf unwind: Refactor get_entries to allow dynamic libdw/libunwind selectiontools/ tools/ tools/ +8 more | +207 | 3 replies | |
| 2/7 | tools build: Deduplicate test-libunwind for different architecturestools/ tools/ tools/ +7 more | +32 | 0 replies | Applied |
| 3/7 | perf build: Be more programmatic when setting up libunwind variablestools/ | +100 | 0 replies | Applied |
| 4/7 | perf unwind-libunwind: Make libunwind register reading cross platformtools/ tools/ tools/ +27 more | +338 | 4 replies | |
| 5/7 | perf unwind-libunwind: Move flush/finish access out of localtools/ tools/ tools/ +14 more | +309 | 0 replies | Applied |
| 6/7 | perf unwind-libunwind: Remove libunwind-localtools/ tools/ tools/ +17 more | +3352 | 0 replies | |
| 7/7 | perf unwind-libunwind: Add RISC-V libunwind supporttools/ tools/ tools/ +1 more | +341 | 0 replies | Applied |
Reviews trailers per patch
1 of 7 patches has a Reviewed-by or Acked-by.
| Patch | Ian Rogers |
|---|---|
| 1/7 | A-b |
| 2/7 | |
| 3/7 | |
| 4/7 | |
| 5/7 | |
| 6/7 | |
| 7/7 |
Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.
Cover letter [PATCH v5 0/7] perf libunwind multiple remote support
Fix the libunwind build for when libdw and libunwind are feature detected, currently failing with a duplicate symbol.
Refactor the libunwind support so that whenever a remote target is available, perf functions using the ELF machine can use that remote target regardless of what the host/local machine is. Migrate existing libunwind supported architectures like powerpc, arm64 and loongarch so that they can work in a cross-architecture way. Add support for RISC-V. Make the code more regular in function names, etc. and avoid including a C-file. This increases the lines of code. It is similar in style to the unwind-libdw implementation. It is hoped that the more uniform nature of the code will help with refactoring the perf registers for SIMD/APX support.
Aside from local host testing these patches are under tested, in part as I'm failing to see how to build libunwind with support for multiple remote targets. Please could I get help in testing.
v5: Rebase dropping merged loong arch fix patch. Fixes to Sashiko
review feedback:
- Patch 1: Hooked unwind__configure() into perf_default_config(). Standardized unwinder return contracts (>0 success, 0 fallback, <0 fatal). Fixed UNWIND_STYLE_UNKNOWN fallback and added memset() to clear config array on override.
- Patch 2: Dynamically populated FILES list in tools/build/feature/Makefile using LIBUNWIND_ARCHS. Added libunwind cases to FEATURE_TESTS_EXTRA in tools/build/Makefile.feature for proper FEATURE-DUMP caching.
- Patch 3: Restored core -lunwind linkage to FEATURE_CHECK_LDFLAGS. Restored NO_LIBUNWIND fallback validation, corrected EXTLIBS evaluation ordering for BIONIC/Android compatibility, and restored static linking multiple definition flags.
- Patch 4: Fixed out-of-bounds array read bugs (>= ARRAY_SIZE) in libunwind-i386.c and libunwind-x86_64.c. Fixed constant typos across LoongArch, PowerPC, and s390x.
- Patch 5: Added early EM_NONE and ops validation checks to prevent warnings and NULL dereferences. Checked return value of unwind__prepare_access() in maps__copy_from(). Corrected architecture binding in thread__insert_map() by calculating e_machine after map insertion.
- Patch 6: Aligned all remote architecture accessors to match 5-argument generic declarations (removing trailing sizeof(unw_word_t)). Prevented frame discard on stack depth limit by returning 0 instead of -1 in unwind_step(). Fixed 32-bit big-endian register corruption by replacing memcpy() with conditional type-casted assignment. Fixed max_stack == 1 fallback trigger. Fixed .debug_frame layout union corruption by changing di.u.rti to di.u.ti across all DWARF find wrappers.
- Patch 7: Applied the same corrections (5-argument accessors, u.ti union accessors, 0 return on max_ips) to the newly introduced libunwind-riscv.c.
v4: Rebase, in particular the zalloc->calloc change conflicted.
https://lore.kernel.org/linux-perf-users/[email protected]/
v3: Minor whitespace clean up and warn when a dynamic choice of libdw
or libunwind is selected for unwinding and support is missing (Arnaldo).
https://lore.kernel.org/lkml/[email protected]/
v2: Move two fixes patches to position 1 and 2 in the series. Fix
struct naming inconsistency, Andrew Jones <[email protected]>. Fix other inconsistencies and potential non-x86 build issues.
https://lore.kernel.org/lkml/[email protected]/
v1: https://lore.kernel.org/lkml/[email protected]/
Ian Rogers (7):
perf unwind: Refactor get_entries to allow dynamic libdw/libunwind
selection
tools build: Deduplicate test-libunwind for different architectures perf build: Be more programmatic when setting up libunwind variables perf unwind-libunwind: Make libunwind register reading cross platform perf unwind-libunwind: Move flush/finish access out of local perf unwind-libunwind: Remove libunwind-local
perf unwind-libunwind: Add RISC-V libunwind support
tools/build/Makefile.feature | 12 +- tools/build/feature/Makefile | 46 +- tools/build/feature/test-libunwind-aarch64.c | 27 - tools/build/feature/test-libunwind-arm.c | 28 - .../test-libunwind-debug-frame-aarch64.c | 17 - .../feature/test-libunwind-debug-frame-arm.c | 17 - .../feature/test-libunwind-debug-frame.c | 1 - tools/build/feature/test-libunwind-x86.c | 28 - tools/build/feature/test-libunwind-x86_64.c | 28 - tools/build/feature/test-libunwind.c | 1 - tools/perf/Makefile.config | 226 +++-- tools/perf/arch/arm/util/Build | 2 - tools/perf/arch/arm/util/unwind-libunwind.c | 50 -- tools/perf/arch/arm64/util/Build | 1 - tools/perf/arch/arm64/util/unwind-libunwind.c | 17 - tools/perf/arch/loongarch/util/Build | 2 - .../arch/loongarch/util/unwind-libunwind.c | 82 -- tools/perf/arch/mips/Build | 1 - tools/perf/arch/mips/util/Build | 1 - tools/perf/arch/mips/util/unwind-libunwind.c | 22 - tools/perf/arch/powerpc/util/Build | 1 - .../perf/arch/powerpc/util/unwind-libunwind.c | 92 -- tools/perf/arch/x86/util/Build | 3 - tools/perf/arch/x86/util/unwind-libunwind.c | 115 --- tools/perf/builtin-inject.c | 4 + tools/perf/builtin-report.c | 4 + tools/perf/builtin-script.c | 4 + tools/perf/util/Build | 5 +- tools/perf/util/config.c | 4 + tools/perf/util/libunwind-arch/Build | 11 + .../perf/util/libunwind-arch/libunwind-arch.c | 319 +++++++ .../perf/util/libunwind-arch/libunwind-arch.h | 296 +++++++ .../perf/util/libunwind-arch/libunwind-arm.c | 290 ++++++ .../util/libunwind-arch/libunwind-arm64.c | 289 ++++++ .../perf/util/libunwind-arch/libunwind-i386.c | 312 +++++++ .../util/libunwind-arch/libunwind-loongarch.c | 297 +++++++ .../perf/util/libunwind-arch/libunwind-mips.c | 299 +++++++ .../util/libunwind-arch/libunwind-ppc32.c | 301 +++++++ .../util/libunwind-arch/libunwind-ppc64.c | 303 +++++++ .../util/libunwind-arch/libunwind-riscv.c | 297 +++++++ .../perf/util/libunwind-arch/libunwind-s390.c | 299 +++++++ .../util/libunwind-arch/libunwind-x86_64.c | 320 +++++++ tools/perf/util/libunwind/arm64.c | 40 - tools/perf/util/libunwind/x86_32.c | 41 - tools/perf/util/maps.c | 34 +- tools/perf/util/maps.h | 4 +- tools/perf/util/symbol_conf.h | 10 + tools/perf/util/thread.c | 32 +- tools/perf/util/unwind-libdw.c | 20 +- tools/perf/util/unwind-libunwind-local.c | 831 ------------------ tools/perf/util/unwind-libunwind.c | 699 +++++++++++++-- tools/perf/util/unwind.c | 104 +++ tools/perf/util/unwind.h | 73 +- 53 files changed, 4623 insertions(+), 1739 deletions(-) delete mode 100644 tools/build/feature/test-libunwind-aarch64.c delete mode 100644 tools/build/feature/test-libunwind-arm.c delete mode 100644 tools/build/feature/test-libunwind-debug-frame-aarch64.c delete mode 100644 tools/build/feature/test-libunwind-debug-frame-arm.c delete mode 100644 tools/build/feature/test-libunwind-x86.c delete mode 100644 tools/build/feature/test-libunwind-x86_64.c delete mode 100644 tools/perf/arch/arm/util/unwind-libunwind.c delete mode 100644 tools/perf/arch/arm64/util/unwind-libunwind.c delete mode 100644 tools/perf/arch/loongarch/util/unwind-libunwind.c delete mode 100644 tools/perf/arch/mips/Build delete mode 100644 tools/perf/arch/mips/util/Build delete mode 100644 tools/perf/arch/mips/util/unwind-libunwind.c delete mode 100644 tools/perf/arch/powerpc/util/unwind-libunwind.c delete mode 100644 tools/perf/arch/x86/util/unwind-libunwind.c create mode 100644 tools/perf/util/libunwind-arch/Build create mode 100644 tools/perf/util/libunwind-arch/libunwind-arch.c create mode 100644 tools/perf/util/libunwind-arch/libunwind-arch.h create mode 100644 tools/perf/util/libunwind-arch/libunwind-arm.c create mode 100644 tools/perf/util/libunwind-arch/libunwind-arm64.c create mode 100644 tools/perf/util/libunwind-arch/libunwind-i386.c create mode 100644 tools/perf/util/libunwind-arch/libunwind-loongarch.c create mode 100644 tools/perf/util/libunwind-arch/libunwind-mips.c create mode 100644 tools/perf/util/libunwind-arch/libunwind-ppc32.c create mode 100644 tools/perf/util/libunwind-arch/libunwind-ppc64.c create mode 100644 tools/perf/util/libunwind-arch/libunwind-riscv.c create mode 100644 tools/perf/util/libunwind-arch/libunwind-s390.c create mode 100644 tools/perf/util/libunwind-arch/libunwind-x86_64.c delete mode 100644 tools/perf/util/libunwind/arm64.c delete mode 100644 tools/perf/util/libunwind/x86_32.c delete mode 100644 tools/perf/util/unwind-libunwind-local.c create mode 100644 tools/perf/util/unwind.c
Signature · 1 line
2.54.0.563.g4f69b47b94-goog