BPF List
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: dwarves@vger.kernel.org
Cc: Jiri Olsa <jolsa@kernel.org>,
	Clark Williams <williams@redhat.com>,
	Kate Carcia <kcarcia@redhat.com>,
	bpf@vger.kernel.org, Arnaldo Carvalho de Melo <acme@redhat.com>,
	Alan Maguire <alan.maguire@oracle.com>,
	Andrii Nakryiko <andrii.nakryiko@gmail.com>,
	Daniel Xu <dxu@dxuuu.xyz>, Eduard Zingerman <eddyz87@gmail.com>
Subject: [PATCH 2/2] pahole: Allow asking for extra features using the '+' prefix in --btf_features
Date: Fri, 19 Apr 2024 17:57:45 -0300	[thread overview]
Message-ID: <20240419205747.1102933-3-acme@kernel.org> (raw)
In-Reply-To: <20240419205747.1102933-1-acme@kernel.org>

From: Arnaldo Carvalho de Melo <acme@redhat.com>

Instead of the somewhat confusing:

  --btf_features=all,reproducible_build

That means "'all' the standard BTF features plus the 'reproducible_build'
extra BTF feature", use + directly, making it more compact:

  --btf_features=+reproducible_build

In the future we may want the '-' counterpart as a way to _remove_ some
of the standard set of BTF features.

Cc: Alan Maguire <alan.maguire@oracle.com>
Cc: Andrii Nakryiko <andrii.nakryiko@gmail.com>
Cc: Daniel Xu <dxu@dxuuu.xyz>
Cc: Eduard Zingerman <eddyz87@gmail.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 man-pages/pahole.1          | 6 ++++++
 pahole.c                    | 6 ++++++
 tests/reproducible_build.sh | 2 +-
 3 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/man-pages/pahole.1 b/man-pages/pahole.1
index 64de3438b5f9a77a..2f4f42f8323efd6e 100644
--- a/man-pages/pahole.1
+++ b/man-pages/pahole.1
@@ -320,6 +320,12 @@ Supported non-standard features (not enabled for 'all')
 
 So for example, specifying \-\-btf_encode=var,enum64 will result in a BTF encoding that (as well as encoding basic BTF information) will contain variables and enum64 values.
 
+.fi
+
+If one wants to add an extra feature to the set of standard ones, the '+' prefix can be used, i.e.:
+\-\-btf_features=+reproducible_build will add all standard features plus the 'reproducible_build' extra
+feature.
+
 .TP
 .B \-\-btf_features_strict
 Identical to \-\-btf_features above, but pahole will exit if it encounters an unrecognized feature.
diff --git a/pahole.c b/pahole.c
index af94d2a45ee96cbe..42c5b03ee1d1a8f8 100644
--- a/pahole.c
+++ b/pahole.c
@@ -1364,6 +1364,12 @@ static void parse_btf_features(const char *features, bool strict)
 		return;
 	}
 
+	// Adding extra features to the set of standard features.
+	if (strstarts(features, "+")) {
+		btf_features__enable_for_all();
+		++features;
+	}
+
 	strncpy(f, features, BTF_MAX_FEATURE_STR)[BTF_MAX_FEATURE_STR] = '\0';
 	s = f;
 	while ((feature_name = strtok_r(s, ",", &saveptr)) != NULL) {
diff --git a/tests/reproducible_build.sh b/tests/reproducible_build.sh
index e2f836081b125119..1222cb42c6639235 100755
--- a/tests/reproducible_build.sh
+++ b/tests/reproducible_build.sh
@@ -29,7 +29,7 @@ nr_proc=$(getconf _NPROCESSORS_ONLN)
 
 for threads in $(seq $nr_proc) ; do
 	test -n "$VERBOSE" && echo $threads threads encoding
-	pahole -j$threads --btf_features=all,reproducible_build --btf_encode_detached=$outdir/vmlinux.btf.parallel.reproducible $vmlinux &
+	pahole -j$threads --btf_features=+reproducible_build --btf_encode_detached=$outdir/vmlinux.btf.parallel.reproducible $vmlinux &
 	pahole=$!
 	# HACK: Wait a bit for pahole to start its threads
 	sleep 0.3s
-- 
2.44.0


  parent reply	other threads:[~2024-04-19 20:58 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-19 20:57 [PATCHES 0/2] Introduce --btf_features=+extra_features syntax Arnaldo Carvalho de Melo
2024-04-19 20:57 ` [PATCH 1/2] pahole: Factor out routine to process "--btf_features=all" Arnaldo Carvalho de Melo
2024-04-19 20:57 ` Arnaldo Carvalho de Melo [this message]
2024-04-26 20:26   ` [PATCH 2/2] pahole: Allow asking for extra features using the '+' prefix in --btf_features Andrii Nakryiko
2024-04-26 20:47     ` Arnaldo Carvalho de Melo
2024-04-29 11:16       ` Alan Maguire
2024-04-29 16:46         ` Andrii Nakryiko
2024-04-29 18:48         ` Arnaldo Carvalho de Melo
2024-04-23  2:29 ` [PATCHES 0/2] Introduce --btf_features=+extra_features syntax Daniel Xu
2024-04-23  9:02   ` Alan Maguire
2024-04-23 14:22     ` Arnaldo Carvalho de Melo

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=20240419205747.1102933-3-acme@kernel.org \
    --to=acme@kernel.org \
    --cc=acme@redhat.com \
    --cc=alan.maguire@oracle.com \
    --cc=andrii.nakryiko@gmail.com \
    --cc=bpf@vger.kernel.org \
    --cc=dwarves@vger.kernel.org \
    --cc=dxu@dxuuu.xyz \
    --cc=eddyz87@gmail.com \
    --cc=jolsa@kernel.org \
    --cc=kcarcia@redhat.com \
    --cc=williams@redhat.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