Switch BTF loading and encoding to libbpf APIs
Get series with b4
b4 am [email protected]Versions newest first
- v2 Latest8 patches 6 repliesIn review
Changes in v2 from the cover letter
- rebase on latest dwarves master and fix var->spec's address problem.
Patches in v2 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/8 | btf_loader: use libbpf to load BTFbtf_loader.c libbtf.c libbtf.h | +113 | 2 replies | |
| 2/8 | btf_encoder: use libbpf APIs to encode BTF type infobtf_encoder.c libbtf.c libbtf.h | +295 | 0 replies | |
| 3/8 | btf_encoder: fix emitting __ARRAY_SIZE_TYPE__ as index range typebtf_encoder.c | +21 | 0 replies | |
| 4/8 | btf_encoder: discard CUs after BTF encodingpahole.c | +1 | 1 reply | |
| 5/8 | btf_encoder: revamp how per-CPU variables are encodedbtf_encoder.c libbtf.c libbtf.h | +148 | 1 reply | |
| 6/8 | dwarf_loader: increase the size of lookup hash mapdwarf_loader.c | +1 | 0 replies | |
| 7/8 | strings: use BTF's string APIs for strings managementctf_encoder.c libctf.c libctf.h +2 more | +49 | 0 replies | |
| 8/8 | btf_encoder: support cross-compiled ELF binaries with different endiannesslibbtf.c | +22 | 0 replies |
Reviews trailers per patch
No Reviewed-by, Acked-by or Tested-by trailers for v2 yet.
Cover letter [PATCH v2 dwarves 0/8] Switch BTF loading and encoding to libbpf APIs
This patch set switches pahole to use libbpf-provided BTF loading and encoding APIs. This reduces pahole's own BTF encoding code, speeds up the process, reduces amount of RAM needed for DWARF-to-BTF conversion. Also, pahole finally gets support to generating BTF for cross-compiled ELF binaries with different endianness (patch #8).
Additionally, patch #3 fixes previously missed problem with invalid array index type generation.
Patches #4-7 are speeding up DWARF-to-BTF convertion/dedup pretty significantly, saving overall about 9 seconds out of current 27 or so.
Patch #5 revamps how per-CPU BTF variables are emitted, eliminating repeated and expensive looping over ELF symbols table. The critical detail that took few hours of investigation is that when DW_AT_variable has DW_AT_specification, variable address (to correlate with symbol's address) has to be taken before specification is followed.
More details could be found in respective patches.
v1->v2:
- rebase on latest dwarves master and fix var->spec's address problem.
Andrii Nakryiko (8):
btf_loader: use libbpf to load BTF
btf_encoder: use libbpf APIs to encode BTF type info
btf_encoder: fix emitting __ARRAY_SIZE_TYPE__ as index range type
btf_encoder: discard CUs after BTF encoding
btf_encoder: revamp how per-CPU variables are encoded
dwarf_loader: increase the size of lookup hash map
strings: use BTF's string APIs for strings management
btf_encoder: support cross-compiled ELF binaries with different
endianness
btf_encoder.c | 370 +++++++++++++++------------ btf_loader.c | 244 +++++++----------- ctf_encoder.c | 2 +- dwarf_loader.c | 2 +- libbtf.c | 661 +++++++++++++++++++++---------------------------- libbtf.h | 41 ++- libctf.c | 14 +- libctf.h | 4 +- pahole.c | 2 +- strings.c | 91 +++---- strings.h | 32 +-- 11 files changed, 645 insertions(+), 818 deletions(-)
Signature · 1 line
2.24.1