From: Ihor Solodrai <ihor.solodrai@pm.me>
To: dwarves@vger.kernel.org
Cc: bpf@vger.kernel.org, acme@kernel.org, alan.maguire@oracle.com,
eddyz87@gmail.com, andrii@kernel.org, mykolal@fb.com,
olsajiri@gmail.com
Subject: [PATCH dwarves v4 06/10] btf_encoder: remove skip_encoding_inconsistent_proto
Date: Tue, 07 Jan 2025 19:09:32 +0000 [thread overview]
Message-ID: <20250107190855.2312210-7-ihor.solodrai@pm.me> (raw)
In-Reply-To: <20250107190855.2312210-1-ihor.solodrai@pm.me>
This flag is needed only for btf_encoder__add_saved_funcs(), so there
is no reason to keep it in each btf_encoder.
Link: https://lore.kernel.org/dwarves/e1df45360963d265ea5e0b3634f0a3dae0c9c343.camel@gmail.com/
Signed-off-by: Ihor Solodrai <ihor.solodrai@pm.me>
---
btf_encoder.c | 10 ++++------
btf_encoder.h | 4 ++--
pahole.c | 7 +++++--
3 files changed, 11 insertions(+), 10 deletions(-)
diff --git a/btf_encoder.c b/btf_encoder.c
index 7b4523b..875ec9d 100644
--- a/btf_encoder.c
+++ b/btf_encoder.c
@@ -128,7 +128,6 @@ struct btf_encoder {
force,
gen_floats,
skip_encoding_decl_tag,
- skip_encoding_inconsistent_proto,
tag_kfuncs,
gen_distilled_base;
uint32_t array_index_id;
@@ -1327,7 +1326,7 @@ static void btf_encoder__delete_saved_funcs(struct btf_encoder *encoder)
}
}
-int btf_encoder__add_saved_funcs(struct btf_encoder *encoder)
+int btf_encoder__add_saved_funcs(bool skip_encoding_inconsistent_proto)
{
struct btf_encoder_func_state **saved_fns = NULL, *s;
int err = 0, i = 0, j, nr_saved_fns = 0;
@@ -1358,7 +1357,7 @@ int btf_encoder__add_saved_funcs(struct btf_encoder *encoder)
for (i = 0; i < nr_saved_fns; i = j) {
struct btf_encoder_func_state *state = saved_fns[i];
- bool add_to_btf = !encoder->skip_encoding_inconsistent_proto;
+ bool add_to_btf = !skip_encoding_inconsistent_proto;
/* Compare across sorted functions that match by name/prefix;
* share inconsistent/unexpected reg state between them.
@@ -2142,13 +2141,13 @@ out:
return err;
}
-int btf_encoder__encode(struct btf_encoder *encoder)
+int btf_encoder__encode(struct btf_encoder *encoder, struct conf_load *conf)
{
bool should_tag_kfuncs;
int err;
size_t shndx;
- err = btf_encoder__add_saved_funcs(encoder);
+ err = btf_encoder__add_saved_funcs(conf->skip_encoding_btf_inconsistent_proto);
if (err < 0)
return err;
@@ -2475,7 +2474,6 @@ struct btf_encoder *btf_encoder__new(struct cu *cu, const char *detached_filenam
encoder->force = conf_load->btf_encode_force;
encoder->gen_floats = conf_load->btf_gen_floats;
encoder->skip_encoding_decl_tag = conf_load->skip_encoding_btf_decl_tag;
- encoder->skip_encoding_inconsistent_proto = conf_load->skip_encoding_btf_inconsistent_proto;
encoder->tag_kfuncs = conf_load->btf_decl_tag_kfuncs;
encoder->gen_distilled_base = conf_load->btf_gen_distilled_base;
encoder->verbose = verbose;
diff --git a/btf_encoder.h b/btf_encoder.h
index 9b26162..b95f2f3 100644
--- a/btf_encoder.h
+++ b/btf_encoder.h
@@ -26,13 +26,13 @@ enum btf_var_option {
struct btf_encoder *btf_encoder__new(struct cu *cu, const char *detached_filename, struct btf *base_btf, bool verbose, struct conf_load *conf_load);
void btf_encoder__delete(struct btf_encoder *encoder);
-int btf_encoder__encode(struct btf_encoder *encoder);
+int btf_encoder__encode(struct btf_encoder *encoder, struct conf_load *conf);
int btf_encoder__encode_cu(struct btf_encoder *encoder, struct cu *cu, struct conf_load *conf_load);
struct btf *btf_encoder__btf(struct btf_encoder *encoder);
int btf_encoder__add_encoder(struct btf_encoder *encoder, struct btf_encoder *other);
-int btf_encoder__add_saved_funcs(struct btf_encoder *encoder);
+int btf_encoder__add_saved_funcs(bool skip_encoding_inconsistent_proto);
#endif /* _BTF_ENCODER_H_ */
diff --git a/pahole.c b/pahole.c
index a36b732..37d76b1 100644
--- a/pahole.c
+++ b/pahole.c
@@ -3185,7 +3185,10 @@ static int pahole_threads_collect(struct conf_load *conf, int nr_threads, void *
if (error)
goto out;
- btf_encoder__add_saved_funcs(btf_encoder);
+ err = btf_encoder__add_saved_funcs(conf_load.skip_encoding_btf_inconsistent_proto);
+ if (err < 0)
+ goto out;
+
for (i = 0; i < nr_threads; i++) {
/*
* Merge content of the btf instances of worker threads to the btf
@@ -3843,7 +3846,7 @@ try_sole_arg_as_class_names:
exit(1);
}
- err = btf_encoder__encode(btf_encoder);
+ err = btf_encoder__encode(btf_encoder, &conf_load);
btf_encoder__delete(btf_encoder);
if (err) {
fputs("Failed to encode BTF\n", stderr);
--
2.47.1
next prev parent reply other threads:[~2025-01-07 19:09 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-07 19:08 [PATCH dwarves v4 00/10] pahole: faster reproducible BTF encoding Ihor Solodrai
2025-01-07 19:09 ` [PATCH dwarves v4 01/10] btf_encoder: simplify function encoding Ihor Solodrai
2025-01-07 19:09 ` [PATCH dwarves v4 02/10] btf_encoder: free encoder->secinfo in btf_encoder__delete Ihor Solodrai
2025-01-09 16:54 ` Alan Maguire
2025-01-09 21:36 ` Arnaldo Carvalho de Melo
2025-01-07 19:09 ` [PATCH dwarves v4 03/10] btf_encoder: separate elf function, saved function representations Ihor Solodrai
2025-01-07 19:09 ` [PATCH dwarves v4 04/10] btf_encoder: introduce elf_functions struct type Ihor Solodrai
2025-01-07 19:09 ` [PATCH dwarves v4 05/10] btf_encoder: introduce elf_functions_list Ihor Solodrai
2025-01-07 19:09 ` Ihor Solodrai [this message]
2025-01-07 19:09 ` [PATCH dwarves v4 07/10] dwarf_loader: introduce cu->id Ihor Solodrai
2025-01-07 19:09 ` [PATCH dwarves v4] dwarf_loader: multithreading with a job/worker model Ihor Solodrai
2025-01-07 19:09 ` [PATCH dwarves v4 09/10] btf_encoder: clean up global encoders list Ihor Solodrai
2025-01-07 19:09 ` [PATCH dwarves v4] btf_encoder: switch func_states from a list to an array Ihor Solodrai
2025-01-07 20:35 ` [PATCH dwarves v4 00/10] pahole: faster reproducible BTF encoding Ihor Solodrai
2025-01-09 18:32 ` Arnaldo Carvalho de Melo
2025-01-09 18:38 ` Ihor Solodrai
2025-01-09 21:21 ` 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=20250107190855.2312210-7-ihor.solodrai@pm.me \
--to=ihor.solodrai@pm.me \
--cc=acme@kernel.org \
--cc=alan.maguire@oracle.com \
--cc=andrii@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=dwarves@vger.kernel.org \
--cc=eddyz87@gmail.com \
--cc=mykolal@fb.com \
--cc=olsajiri@gmail.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