[RFC dwarves 0/4] pahole, btf_encoder: support --btf_features

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxx/

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





[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux