From: Alan Maguire <alan.maguire@oracle.com>
To: acme@kernel.org
Cc: andrii.nakryiko@gmail.com, ast@kernel.org, daniel@iogearbox.net,
jolsa@kernel.org, eddyz87@gmail.com, 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,
Alan Maguire <alan.maguire@oracle.com>,
Jiri Olsa <olsajiri@gmail.com>
Subject: [PATCH dwarves 2/3] pahole: add --skip_autodetect_btf_kind_max to disable kind autodetect
Date: Wed, 13 Sep 2023 15:26:45 +0100 [thread overview]
Message-ID: <20230913142646.190047-3-alan.maguire@oracle.com> (raw)
In-Reply-To: <20230913142646.190047-1-alan.maguire@oracle.com>
Autodetection of BTF kinds supported may not be wanted or may be
broken at some point; it is prudent to provide a way to switch it
off.
Suggested-by: Jiri Olsa <olsajiri@gmail.com>
Signed-off-by: Alan Maguire <alan.maguire@oracle.com>
---
btf_encoder.c | 3 ++-
dwarves.h | 1 +
man-pages/pahole.1 | 4 ++++
pahole.c | 8 ++++++++
4 files changed, 15 insertions(+), 1 deletion(-)
diff --git a/btf_encoder.c b/btf_encoder.c
index 98c7529..ad0158f 100644
--- a/btf_encoder.c
+++ b/btf_encoder.c
@@ -1892,7 +1892,8 @@ struct btf *btf_encoder__btf(struct btf_encoder *encoder)
void dwarves__set_btf_kind_max(struct conf_load *conf_load, int btf_kind_max)
{
- if (btf_kind_max < 0 || btf_kind_max >= BTF_KIND_MAX)
+ if (conf_load->skip_autodetect_btf_kind_max ||
+ btf_kind_max < 0 || btf_kind_max >= BTF_KIND_MAX)
return;
if (btf_kind_max < BTF_KIND_DECL_TAG)
conf_load->skip_encoding_btf_decl_tag = true;
diff --git a/dwarves.h b/dwarves.h
index f4d9347..04a4c29 100644
--- a/dwarves.h
+++ b/dwarves.h
@@ -68,6 +68,7 @@ struct conf_load {
bool skip_encoding_btf_enum64;
bool btf_gen_optimized;
bool skip_encoding_btf_inconsistent_proto;
+ bool skip_autodetect_btf_kind_max;
uint8_t hashtable_bits;
uint8_t max_hashtable_bits;
uint16_t kabi_prefix_len;
diff --git a/man-pages/pahole.1 b/man-pages/pahole.1
index c1b48de..523d4fd 100644
--- a/man-pages/pahole.1
+++ b/man-pages/pahole.1
@@ -233,6 +233,10 @@ Do not encode type tags in BTF.
.B \-\-skip_encoding_btf_inconsistent_proto
Do not encode functions with multiple inconsistent prototypes or unexpected register use for their parameters, where the registers used do not match calling conventions.
+.TP
+.B \-\-skip_autodetect_btf_kind_max
+Do not scan DWARF to find out which BTF kinds are supported by the underlying object.
+
.TP
.B \-j, \-\-jobs=N
Run N jobs in parallel. Defaults to number of online processors + 10% (like
diff --git a/pahole.c b/pahole.c
index e843999..aca2704 100644
--- a/pahole.c
+++ b/pahole.c
@@ -1232,6 +1232,7 @@ ARGP_PROGRAM_VERSION_HOOK_DEF = dwarves_print_version;
#define ARGP_skip_emitting_atomic_typedefs 338
#define ARGP_btf_gen_optimized 339
#define ARGP_skip_encoding_btf_inconsistent_proto 340
+#define ARGP_skip_autodetect_btf_kind_max 341
static const struct argp_option pahole__options[] = {
{
@@ -1654,6 +1655,11 @@ static const struct argp_option pahole__options[] = {
.key = ARGP_skip_encoding_btf_inconsistent_proto,
.doc = "Skip functions that have multiple inconsistent function prototypes sharing the same name, or that use unexpected registers for parameter values."
},
+ {
+ .name = "skip_autodetect_btf_kind_max",
+ .key = ARGP_skip_autodetect_btf_kind_max,
+ .doc = "Skip auto-detection of maximum BTF kind supported."
+ },
{
.name = NULL,
}
@@ -1829,6 +1835,8 @@ static error_t pahole__options_parser(int key, char *arg,
conf_load.btf_gen_optimized = true; break;
case ARGP_skip_encoding_btf_inconsistent_proto:
conf_load.skip_encoding_btf_inconsistent_proto = true; break;
+ case ARGP_skip_autodetect_btf_kind_max:
+ conf_load.skip_autodetect_btf_kind_max = true; break;
default:
return ARGP_ERR_UNKNOWN;
}
--
2.39.3
next prev parent reply other threads:[~2023-09-13 14:27 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-13 14:26 [PATCH dwarves 0/3] dwarves: detect BTF kinds supported by kernel Alan Maguire
2023-09-13 14:26 ` [PATCH dwarves 1/3] dwarves: auto-detect maximum kind supported by vmlinux Alan Maguire
2023-09-13 16:58 ` Eduard Zingerman
2023-09-13 17:44 ` Alan Maguire
2023-09-13 14:26 ` Alan Maguire [this message]
2023-09-13 14:26 ` [PATCH dwarves 3/3] btf_encoder: learn BTF_KIND_MAX value from base BTF when generating split BTF Alan Maguire
2023-09-13 16:58 ` Eduard Zingerman
2023-09-13 16:58 ` [PATCH dwarves 0/3] dwarves: detect BTF kinds supported by kernel Eduard Zingerman
2023-09-14 17:58 ` Andrii Nakryiko
2023-09-19 16:30 ` Alan Maguire
2023-09-19 18:58 ` Andrii Nakryiko
2023-10-11 9:27 ` Alan Maguire
2023-10-13 0:22 ` 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=20230913142646.190047-3-alan.maguire@oracle.com \
--to=alan.maguire@oracle.com \
--cc=acme@kernel.org \
--cc=andrii.nakryiko@gmail.com \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=eddyz87@gmail.com \
--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=olsajiri@gmail.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