Skip to content

RFC pahole: support BTF inline encoding

Alan Maguire bpf dwarves 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 RFC Latest5 patches 5 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/5dwarf_loader: Add parameters list to inlined expansiondwarf_loader.c dwarves.c dwarves.h+129 -670 replies
2/5dwarf_loader: Add name to inline expansiondwarf_loader.c dwarves.h+10 -00 replies
3/5dwarf_loader: Collect inline expansion location informationdwarf_loader.c dwarves.h+266 -594 replies
4/5btf_encoder: Support encoding of inline location informationbtf_encoder.c dwarves.h+371 -341 reply
5/5pahole: Support inline encoding with inline[.extra] BTF featurepahole.c+28 -50 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [RFC dwarves 0/5] pahole: support BTF inline encoding

This series is the RFC companion to [1]; while it has some issues (including segmentation faults which will be fixed in follups) hopefully it illustrates the approach.

These patches were developed with help from prior work by Eduard Zingerman on inline site decoding and Thierry Treyer on inline encoding, but the scheme used here is somewhat simpler. It relies on using standard BTF kinds (_LOC_PARAM for parameters at inline sites, _LOC_PROTO for collections of paraeters at inline sites, _LOCSEC for descriptions of inline sites; names, function prototypes, location prototypes and relative address offsets).

Patches 1-3 focus on preparing the DWARF loader to collect inline info.

Patch 4 does the BTF encoding, and patch 5 adds the inline option.

The target of encoding is either the .BTF section (if "inline" is specified as btf_feature) or .BTF.extra (for the inline.extra feature).

One challenge here is that we need to stash info about function prototypes while walking DWARF CUs for later use in inline encoding. However, if the inlines are encoded in a separate split BTF section (inline.extra) dedup that happens to the main BTF will not renumber these type references. As a result we need to ask dedup to hand us back the old->new BTF id mappings to fix things up.

Note that since RFC of the bpf-next series we will be changing a lot of this, but it still gives a rough sense of how things are done.

[1] https://lore.kernel.org/bpf/[email protected]/

Alan Maguire (3):
dwarf_loader: Collect inline expansion location information
btf_encoder: Support encoding of inline location information
pahole: Support inline encoding with inline[.extra] BTF feature

Thierry Treyer (2):
dwarf_loader: Add parameters list to inlined expansion
dwarf_loader: Add name to inline expansion

 btf_encoder.c  | 396 +++++++++++++++++++++++++++++++++++++++++----
 dwarf_loader.c | 428 ++++++++++++++++++++++++++++++++++++-------------
 dwarves.c      |  26 +++
 dwarves.h      |  60 +++++++
 pahole.c       |  33 +++-
 5 files changed, 791 insertions(+), 152 deletions(-)
Signature · 1 line
2.39.3