BPF List
 help / color / mirror / Atom feed
* [PATCH v3 dwarves 0/9] Encoding of inline functions using BTF
@ 2026-09-25 18:51 Alan Maguire
  2026-09-25 18:51 ` [PATCH v3 dwarves 1/9] dwarf_loader: Add parameter list to inlined expansions Alan Maguire
                   ` (8 more replies)
  0 siblings, 9 replies; 12+ messages in thread
From: Alan Maguire @ 2026-09-25 18:51 UTC (permalink / raw)
  To: acme, ast, andrii, eddyz87, qmo
  Cc: dwarves, jolsa, daniel, ihor.solodrai, yonghong.song, song,
	martin.lau, memxor, emil, bpf, nsc, puranjay, yatsenko,
	Alan Maguire

Support encoding information about inline functions using BTF,
in particular the libbpf interfaces added in [1].

When the "inline" BTF feature keywords is added, we also process
and encode BTF_KIND_LOC_PROTO, PARAM and LOCSEC info for inline
functions as part of CU traversal. Patches 1-3 add dwarf_loader
support for this; patch 4 then uses libbpf interfaces to add
inline info to the generated BTF. Patch 5 adds support to
the btf_loader to support recognition of inline functions in
BTF, supporting pfunct rendering of a function as inline.
Patch 6 verifies that encoding and display of inline functions
succeeds.

Inline support is gated by presence of BTF location-related
functions in libbpf, so the easiest path for testing is
to install the libbpf built from the series at [1], and
when building pahole to run

    cmake -DLIBBPF_EMBEDDED=off ..

as this ensures you will run with the updated libbpf with
those interfaces (otherwise pahole auto-detects the lack
of the relevant interfaces). To verify all is working,

    pahole --supported_btf_features

should show "inline".

Patches 1-3 prep the dwarf_loader to collect inline info;
patch 4 converts it to BTF; patch 5 adds the inline annotation
to pfunct output via BTF inline info; patch 6 creates an
inline site representation in the btf loader for use in patch
7 for the --inline_sites display; patch 8 tests inline display
via pfunct and patch 9 updates docs.

$ pahole -J --btf_features=default,inline  \
--btf_encode_detached=/tmp/vmlinux+inline vmlinux
$ pfunct --inline_sites --elf=vmlinux /tmp/vmlinux+inline
0xffffffff8120004a [trace_initcall_start_cb+0xa, .text +0x20004a] task_pid_nr(struct task_struct * tsk [%rax])
0xffffffff8120005f [trace_initcall_start_cb+0x1f, .text +0x20005f] get_current(void)
0xffffffff81200090 [trace_initcall_level+0x0, .text +0x200090] arch_static_branch(const struct static_key *  key [addr 0xffffffff83e275e8], const bool  branch [const 0])
0xffffffff81200097 [trace_initcall_level+0x7, .text +0x200097] __do_trace_initcall_level(const char  * level [%rdi])
...

The --elf uses ELF sections/arch info from vmlinux to render
registers, absolute addresses from base/section relative.

The --running option can be used on inline BTF and the running
kernel (kallsyms) is used for address resolution; this ensures
that kASLR is taken into account. However if kptr_restrict is
active /proc/kallsyms will show address 0 for kernel functions,
so pfunct should be run with privileges in such cases if absolute
address representations are needed.

The kbuild infrastructure will split inline info out into a
separate split BTF object, but pahole encodes inline info
together in the same BTF object here; this avoids the need to
invoke it twice during kernel builds.

[1] https://lore.kernel.org/bpf/20260924111428.75957-1-alan.maguire@oracle.com/


Alan Maguire (9):
  dwarf_loader: Add parameter list to inlined expansions
  dwarf_loader: Resolve inline expansion names during recoding
  dwarf_loader: Collect inline expansion location data
  pahole: Support inline BTF location encoding
  btf_loader: Add "inline" annotation for inlined functions
  btf_loader: Record inline sites in CU for BTF
  pfunct: Print inline site information
  tests: Validate inline BTF encoding
  man-pages: Document --inline_sites option

 btf_encoder.c       | 391 ++++++++++++++++++++----
 btf_loader.c        |  96 +++++-
 dwarf_loader.c      | 580 +++++++++++++++++++++++++----------
 dwarves.c           |  35 +++
 dwarves.h           |  69 +++++
 man-pages/pfunct.1  |  74 ++++-
 pahole.c            |  12 +
 pfunct.c            | 718 ++++++++++++++++++++++++++++++++++++++++++--
 tests/btf_inline.sh | 147 +++++++++
 9 files changed, 1872 insertions(+), 250 deletions(-)
 create mode 100755 tests/btf_inline.sh

-- 
2.43.5


^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2026-10-02 11:03 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-25 18:51 [PATCH v3 dwarves 0/9] Encoding of inline functions using BTF Alan Maguire
2026-09-25 18:51 ` [PATCH v3 dwarves 1/9] dwarf_loader: Add parameter list to inlined expansions Alan Maguire
2026-09-30 15:45   ` Jiri Olsa
2026-10-02 11:02     ` Alan Maguire
2026-09-25 18:51 ` [PATCH v3 dwarves 2/9] dwarf_loader: Resolve inline expansion names during recoding Alan Maguire
2026-09-25 18:51 ` [PATCH v3 dwarves 3/9] dwarf_loader: Collect inline expansion location data Alan Maguire
2026-09-25 18:51 ` [PATCH v3 dwarves 4/9] pahole: Support inline BTF location encoding Alan Maguire
2026-09-25 18:51 ` [PATCH v3 dwarves 5/9] btf_loader: Add "inline" annotation for inlined functions Alan Maguire
2026-09-25 18:51 ` [PATCH v3 dwarves 6/9] btf_loader: Record inline sites in CU for BTF Alan Maguire
2026-09-25 18:51 ` [PATCH v3 dwarves 7/9] pfunct: Print inline site information Alan Maguire
2026-09-25 18:51 ` [PATCH v3 dwarves 8/9] tests: Validate inline BTF encoding Alan Maguire
2026-09-25 18:51 ` [PATCH v3 dwarves 9/9] man-pages: Document --inline_sites option Alan Maguire

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox