From: Douglas RAILLARD <douglas.raillard@arm.com>
To: acme@redhat.com
Cc: dwarves@vger.kernel.org, douglas.raillard@arm.com
Subject: [PATCH v3 0/6] Infer BTF alignment
Date: Thu, 28 Oct 2021 13:27:04 +0100 [thread overview]
Message-ID: <20211028122710.881181-1-douglas.raillard@arm.com> (raw)
From: Douglas Raillard <douglas.raillard@arm.com>
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(-)
--
2.25.1
next reply other threads:[~2021-10-28 12:27 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-28 12:27 Douglas RAILLARD [this message]
2021-10-28 12:27 ` [PATCH v3 1/6] fprintf: Fix nested struct printing Douglas RAILLARD
2021-10-28 12:40 ` Arnaldo Carvalho de Melo
2021-10-28 12:27 ` [PATCH v3 2/6] btf_loader.c: Refactor class__fixup_btf_bitfields Douglas RAILLARD
2021-10-28 13:15 ` Arnaldo Carvalho de Melo
2021-10-28 12:27 ` [PATCH v3 3/6] btf_loader.c: Infer alignment info Douglas RAILLARD
2021-10-28 13:15 ` Arnaldo Carvalho de Melo
2021-10-28 12:27 ` [PATCH v3 4/6] dwarves_fprintf: Move cacheline_size into struct conf_fprintf Douglas RAILLARD
2021-10-28 13:18 ` Arnaldo Carvalho de Melo
2021-10-28 12:27 ` [PATCH v3 5/6] btf_loader.c: Propagate struct conf_load Douglas RAILLARD
2021-10-28 13:19 ` Arnaldo Carvalho de Melo
2021-10-28 12:27 ` [PATCH v3 6/6] btf_loader.c: Use cacheline size to infer alignment Douglas RAILLARD
2021-10-28 13:24 ` Arnaldo Carvalho de Melo
2021-10-28 14:12 ` Douglas Raillard
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20211028122710.881181-1-douglas.raillard@arm.com \
--to=douglas.raillard@arm.com \
--cc=acme@redhat.com \
--cc=dwarves@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).