Skip to content

Infer BTF alignment

Douglas RAILLARD dwarves 3 versions – Applied

Status from this message: Thanks, applied.

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v3 Latest6 patches 7 repliesApplied
  2. v23 patches 7 repliesApplied
  3. v12 patches 4 repliesSuperseded

Changes in v3 from the cover letter

* Added 3 commits on top to use cacheline size when infering larger alignments

Patches in v3 Applied

#Subject and filesSizeRepliesApplied
1/6fprintf: Fix nested struct printingdwarves_fprintf.c+18 -41 reply
2/6btf_loader.c: Refactor class__fixup_btf_bitfieldsbtf_loader.c+14 -151 reply
3/6btf_loader.c: Infer alignment infobtf_loader.c dwarves.c dwarves.h+39 -11 reply
4/6dwarves_fprintf: Move cacheline_size into struct conf_fprintfcodiff.c ctracer.c dtagnames.c +8 more+47 -291 reply
5/6btf_loader.c: Propagate struct conf_loadbtf_loader.c+10 -71 reply
6/6btf_loader.c: Use cacheline size to infer alignmentbtf_loader.c+10 -02 replies

Reviews trailers per patch

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

Read the v3 thread

Cover letter [PATCH v3 0/6] Infer BTF alignment

From: Douglas Raillard <[email protected]>

Infer alignment of struct members when loading BTF, so that using the header dumped by pahole results in the same offsets. This is useful for debugging tools to be able to access pointers to structs of possibly private types. One such example are kernel modules bolting traceevents on existing upstream tracepoints, which typically expose "top-level" struct pointers (e.g. struct cfs_rq) to allow maximum flexibility.

Changes since v2:

* Added 3 commits on top to use cacheline size when infering larger alignments

Changes since v1:
* Split alignment patch into refactor and new code.
* Test with fullcircle on vmlinux and .o of kernel tree:

export PATH=pahole/build:$PATH
for f in {kernel,drivers,arch,block,crypto,certs,fs,init,ipc,lib,mm,net,sound,virt}/**.o; do
echo $f
pahole/fullcircle $f
done

This did not produce any error but neither did it on pahole master branch, since I assume it reads DWARF by default.

Trying with "pfunct -F btf" on object files seemed to yield empty sources:

pfunct: file 'kernel/sched/fair.o' has no btf type information.

Running pfunct on vmlinux worked, but fullcircle seems to have bailed out before getting to pfunct. When commenting out the bailouts, I managed to get pfunct to work, but the header generated with --compile contains one duplicate type, and lots of broken inlined functions (e.g. "return 0;" in a func returning a struct).

Douglas Raillard (6):
fprintf: Fix nested struct printing
btf_loader.c: Refactor class__fixup_btf_bitfields btf_loader.c: Infer alignment info
dwarves_fprintf: Move cacheline_size into struct conf_fprintf btf_loader.c: Propagate struct conf_load btf_loader.c: Use cacheline size to infer alignment

 btf_loader.c      | 86 ++++++++++++++++++++++++++++++++++++-----------
 codiff.c          |  4 ++-
 ctracer.c         |  3 +-
 dtagnames.c       |  3 +-
 dwarves.c         |  8 ++---
 dwarves.h         |  8 +++--
 dwarves_fprintf.c | 52 +++++++++++++++++++---------
 pahole.c          |  8 +++--
 pdwtags.c         |  4 ++-
 pfunct.c          |  4 ++-
 pglobal.c         |  4 ++-
 prefcnt.c         |  4 ++-
 12 files changed, 135 insertions(+), 53 deletions(-)
Signature · 1 line
2.25.1