BPF List
 help / color / mirror / Atom feed
From: Eduard Zingerman <eddyz87@gmail.com>
To: Alan Maguire <alan.maguire@oracle.com>,
	acme@kernel.org,  andrii.nakryiko@gmail.com
Cc: jolsa@kernel.org, ast@kernel.org, daniel@iogearbox.net,
	martin.lau@linux.dev,  song@kernel.org, yhs@fb.com,
	john.fastabend@gmail.com, kpsingh@kernel.org,  sdf@google.com,
	haoluo@google.com, mykolal@fb.com, bpf@vger.kernel.org,
	Andrii Nakryiko <andrii@kernel.org>
Subject: Re: [RFC dwarves 3/4] pahole: add --btf_features=feature1[,feature2...] support
Date: Wed, 11 Oct 2023 22:08:12 +0300	[thread overview]
Message-ID: <5b40ffbfa5949c24dad44ed6adf70d35cf72f757.camel@gmail.com> (raw)
In-Reply-To: <f822334f-335e-bd38-09c7-95c69086ba6f@oracle.com>

On Wed, 2023-10-11 at 17:41 +0100, Alan Maguire wrote:
[...]
> > > +		}
> > > +	}
> > > +
> > > +	for (i = 0; i < ARRAY_SIZE(btf_features); i++) {
> > > +		bool *bval = (bool *)(((void *)conf_load) + btf_features[i].conf_load_offset);
> > > +		bool match = encode_all;
> > > +
> > > +		if (!match) {
> > > +			for (j = 0; j < n; j++) {
> > > +				if (strcmp(feature_list[j], btf_features[i].name) == 0) {
> > > +					match = true;
> > > +					break;
> > > +				}
> > > +			}
> > > +		}
> > > +		if (match)
> > > +			*bval = btf_features[i].skip ? false : true;
> > 
> > I'm not sure I understand the logic behind "skip" features.
> > Take `decl_tag` for example:
> > - by default conf_load->skip_encoding_btf_decl_tag is 0;
> > - if `--btf_features=decl_tag` is passed it is still 0 because of the
> >   `skip ? false : true` logic.
> > 
> > If there is no way to change "skip" features why listing these at all?
> > 
> You're right; in the case of a skip feature, I think we need the
> following behaviour
> 
> 1. we skip the encoding by default (so the equivalent of
> --skip_encoding_btf_decl_tag, setting skip_encoding_btf_decl_tag
> to true
>
> 2. if the user however specifies the logical inversion of the skip
> feature in --btf_features (in this case "decl_tag" - or "all")
> skip_encoding_btf_decl_tag is set to false.
> 
> So in my code we had 2 above but not 1. If both were in place I think
> we'd have the right set of behaviours. Does that sound right?

You mean when --features=? is specified we default to
conf_load->skip_encoding_btf_decl_tag = true, and set it to false only
if "all" or "decl_tag" is listed in features, right?
 
> Maybe a better way to express all this would be to rename the "skip"
> field in "struct btf_feature" to "default" - so in the case of a "skip"
> feature, the default is true, but for opt-in features, the default is false.

Yes, I agree, "default" is better as "skip" is a bit confusing.

[...]

  reply	other threads:[~2023-10-11 19:08 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
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

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=5b40ffbfa5949c24dad44ed6adf70d35cf72f757.camel@gmail.com \
    --to=eddyz87@gmail.com \
    --cc=acme@kernel.org \
    --cc=alan.maguire@oracle.com \
    --cc=andrii.nakryiko@gmail.com \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=haoluo@google.com \
    --cc=john.fastabend@gmail.com \
    --cc=jolsa@kernel.org \
    --cc=kpsingh@kernel.org \
    --cc=martin.lau@linux.dev \
    --cc=mykolal@fb.com \
    --cc=sdf@google.com \
    --cc=song@kernel.org \
    --cc=yhs@fb.com \
    /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