All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v5 dwarves 00/10] Encoding of inline functions using BTF
@ 2026-10-02 17:40 Alan Maguire
  2026-10-02 17:40 ` [PATCH v5 dwarves 01/10] dwarf_loader: Add parameter list to inline expansions Alan Maguire
                   ` (10 more replies)
  0 siblings, 11 replies; 15+ messages in thread
From: Alan Maguire @ 2026-10-02 17:40 UTC (permalink / raw)
  To: acme, ast, andrii, eddyz87, jolsa, qmo
  Cc: dwarves, 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; either use a bpf-next libbpf containing
the series [1] or use the embedded libbpf (the default)
from latest pahole.

To verify all is working,

    pahole --supported_btf_features

should show "inline".

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

Changes since v4:

- Removed unneeded bool (Jiri, patch 1)
- Split adding parameters to inline expansion (patch 1) from
  recoding changes (Jiri, patch 2)
- Fixed issue with parameter indexing for inlne sites; use ordering
  from abstract origin (Jiri, patch 2)
- Fixed issues with PIE binaries; our section checking for instruction
  pointers did not work there.  Fix (patch 5) and update test to do
  PIE and non-PIE validation of inline encoding (patch 9)

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

Alan Maguire (10):
  dwarf_loader: Add parameter list to inline expansions
  dwarf_loader: Recode inline expansion parameter types
  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       | 427 ++++++++++++++++++++++----
 btf_loader.c        |  96 +++++-
 dwarf_loader.c      | 581 +++++++++++++++++++++++++----------
 dwarves.c           |  35 +++
 dwarves.h           |  69 +++++
 man-pages/pfunct.1  |  74 ++++-
 pahole.c            |  12 +
 pfunct.c            | 718 ++++++++++++++++++++++++++++++++++++++++++--
 tests/btf_inline.sh | 155 ++++++++++
 9 files changed, 1917 insertions(+), 250 deletions(-)
 create mode 100755 tests/btf_inline.sh

-- 
2.43.5


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

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

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-02 17:40 [PATCH v5 dwarves 00/10] Encoding of inline functions using BTF Alan Maguire
2026-10-02 17:40 ` [PATCH v5 dwarves 01/10] dwarf_loader: Add parameter list to inline expansions Alan Maguire
2026-10-02 17:40 ` [PATCH v5 dwarves 02/10] dwarf_loader: Recode inline expansion parameter types Alan Maguire
2026-10-02 17:40 ` [PATCH v5 dwarves 03/10] dwarf_loader: Resolve inline expansion names during recoding Alan Maguire
2026-10-02 17:40 ` [PATCH v5 dwarves 04/10] dwarf_loader: Collect inline expansion location data Alan Maguire
2026-10-02 17:40 ` [PATCH v5 dwarves 05/10] pahole: Support inline BTF location encoding Alan Maguire
2026-10-09 13:12   ` Jiri Olsa
2026-10-09 17:32     ` Alan Maguire
2026-10-11 10:57       ` Jiri Olsa
2026-10-02 17:40 ` [PATCH v5 dwarves 06/10] btf_loader: Add "inline" annotation for inlined functions Alan Maguire
2026-10-02 17:40 ` [PATCH v5 dwarves 07/10] btf_loader: Record inline sites in CU for BTF Alan Maguire
2026-10-02 17:40 ` [PATCH v5 dwarves 08/10] pfunct: Print inline site information Alan Maguire
2026-10-02 17:40 ` [PATCH v5 dwarves 09/10] tests: Validate inline BTF encoding Alan Maguire
2026-10-02 17:40 ` [PATCH v5 dwarves 10/10] man-pages: Document --inline_sites option Alan Maguire
2026-10-03 10:13 ` [PATCH v5 dwarves 00/10] Encoding of inline functions using BTF Alan Maguire

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.