BPF List
 help / color / mirror / Atom feed
* [RFC dwarves 0/4] pahole, btf_encoder: support --btf_features
@ 2023-10-11  9:17 Alan Maguire
  2023-10-11  9:17 ` [RFC dwarves 1/4] btf_encoder, pahole: move btf encoding options into conf_load Alan Maguire
                   ` (4 more replies)
  0 siblings, 5 replies; 21+ messages in thread
From: Alan Maguire @ 2023-10-11  9:17 UTC (permalink / raw)
  To: acme, andrii.nakryiko
  Cc: jolsa, ast, daniel, eddyz87, martin.lau, song, yhs,
	john.fastabend, kpsingh, sdf, haoluo, mykolal, bpf, Alan Maguire

Currently, the kernel uses pahole version checking as the way to
determine which BTF encoding features to request from pahole.  This
means that such features have to be tied to a specific version and
as new features are added, additional clauses in scripts/pahole-flags.sh
have to be added; for example

if [ "${pahole_ver}" -ge "125" ]; then
	extra_paholeopt="${extra_paholeopt} --skip_encoding_btf_inconsistent_proto --btf_gen_optimized"
fi

To better future-proof this process, we can have a catch-all
single "btf_features" parameter that uses a comma-separated list
of encoding options.  What makes this better is that any version
of pahole that supports btf_features can accept the option list;
unknown options are silently ignored. However there would be no need
to add additional version clauses beyond

if [ "${pahole_ver}" -ge "126" ]; then
	extra_pahole_opt="-j --lang_exclude=rust
--btf_features=encode_force,var,float,decl_tag,type_tag,enum64,optimized,consistent"
fi

Newly-supported features would simply be appended to the btf_features
list, and these would have impact on BTF encoding only if the features
were supported by pahole.  This means pahole will not require a version
bump when new BTF features are added, and should ease the burden of
coordinating such changes between bpf-next and dwarves.

Patches 1 and 2 are preparatory work, while patch 3 adds the
--btf_features support.  Patch 4 provides a means of querying
the supported feature set since --btf_features will not error
out when it encounters an unrecognized features (this ensures
an older pahole without a requested feature will not dump warnings
in the build log for kernel/module BTF generation).

See [1] for more background on this topic.

[1] https://lore.kernel.org/bpf/CAEf4Bzaz1UqqxuZ7Q+KQee-HLyY1nwhAurBE2n9YTWchqoYLbg@mail.gmail.com/

Alan Maguire (4):
  btf_encoder, pahole: move btf encoding options into conf_load
  dwarves: move ARRAY_SIZE() to dwarves.h
  pahole: add --btf_features=feature1[,feature2...] support
  pahole: add --supported_btf_features to display feature support

 btf_encoder.c      |   8 +--
 btf_encoder.h      |   2 +-
 dwarves.c          |  16 ------
 dwarves.h          |  19 +++++++
 man-pages/pahole.1 |  24 +++++++++
 pahole.c           | 127 ++++++++++++++++++++++++++++++++++++++++-----
 6 files changed, 162 insertions(+), 34 deletions(-)

-- 
2.31.1


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

end of thread, other threads:[~2023-10-13 18:40 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-10-11  9:17 [RFC dwarves 0/4] pahole, btf_encoder: support --btf_features Alan Maguire
2023-10-11  9:17 ` [RFC dwarves 1/4] btf_encoder, pahole: move btf encoding options into conf_load Alan Maguire
2023-10-12 12:54   ` Jiri Olsa
2023-10-11  9:17 ` [RFC dwarves 2/4] dwarves: move ARRAY_SIZE() to dwarves.h Alan Maguire
2023-10-11  9:17 ` [RFC dwarves 3/4] pahole: add --btf_features=feature1[,feature2...] support Alan Maguire
2023-10-11 16:28   ` Eduard Zingerman
2023-10-11 16:41     ` Alan Maguire
2023-10-11 19:08       ` Eduard Zingerman
2023-10-11 22:05         ` Alan Maguire
2023-10-11 22:14           ` Eduard Zingerman
2023-10-12 12:35             ` Alan Maguire
2023-10-13 14:17               ` Arnaldo Carvalho de Melo
2023-10-13 14:43                 ` Alan Maguire
2023-10-12 12:53   ` Jiri Olsa
2023-10-12 13:48     ` Alan Maguire
2023-10-12 21:19       ` Jiri Olsa
2023-10-13  0:21   ` Andrii Nakryiko
2023-10-13 11:54     ` Alan Maguire
2023-10-13 18:39       ` Andrii Nakryiko
2023-10-11  9:17 ` [RFC dwarves 4/4] pahole: add --supported_btf_features to display feature support Alan Maguire
2023-10-13  0:14 ` [RFC dwarves 0/4] pahole, btf_encoder: support --btf_features Andrii Nakryiko

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