From: Eduard Zingerman <eddyz87@gmail.com>
To: Ihor Solodrai <ihor.solodrai@linux.dev>,
dwarves@vger.kernel.org, bpf@vger.kernel.org
Cc: acme@kernel.org, alan.maguire@oracle.com, ast@kernel.org,
andrii@kernel.org, mykolal@fb.com, kernel-team@meta.com
Subject: Re: [PATCH v2 dwarves 1/4] btf_encoder: refactor btf_encoder__tag_kfuncs()
Date: Tue, 18 Feb 2025 19:25:48 -0800 [thread overview]
Message-ID: <3717ee0f4ce384311ac551825a455ada6479f16e.camel@gmail.com> (raw)
In-Reply-To: <20250212201552.1431219-2-ihor.solodrai@linux.dev>
On Wed, 2025-02-12 at 12:15 -0800, Ihor Solodrai wrote:
> btf_encoder__tag_kfuncs() is a post-processing step of BTF encoding,
> executed right before BTF is deduped and dumped to the output.
>
> Rewrite btf_encoder__tag_kfuncs() into btf_encoder__collect_kfuncs().
> Now it only reads the .BTF_ids section of the ELF, collecting kfunc
> information and adding it to corresponding elf_function structs. It is
> executed in btf_encoder__new() if tag_kfuncs flag is set. This way
> kfunc information is available within entire lifetime of the
> btf_encoder.
>
> BTF decl tags for kfuncs are added immediately after the function is
> added to BTF in btf_encoder__add_func(). It's done by btf__tag_kfunc()
> factored out from the btf_encoder__tag_kfunc().
>
> As a result btf_encoder__tag_kfuncs(), its subroutines and struct
Nit: btf_encoder__collect_btf_funcs() is the one removed,
btf_encoder__tag_kfuncs is renamed.
> btf_func type are deleted, as they are no longer necessary.
>
> Link: https://lore.kernel.org/dwarves/3782640a577e6945c86d6330bc8a05018a1e5c52.camel@gmail.com/
>
> Suggested-by: Eduard Zingerman <eddyz87@gmail.com>
> Signed-off-by: Ihor Solodrai <ihor.solodrai@linux.dev>
> ---
Acked-by: Eduard Zingerman <eddyz87@gmail.com>
[...]
> btf_encoder.c | 192 +++++++++++++++-----------------------------------
> 1 file changed, 57 insertions(+), 135 deletions(-)
>
> diff --git a/btf_encoder.c b/btf_encoder.c
> index 511c1ea..965e8f0 100644
> --- a/btf_encoder.c
> +++ b/btf_encoder.c
[...]
> @@ -1199,6 +1230,16 @@ static int32_t btf_encoder__add_func(struct btf_encoder *encoder,
> name, btf_fnproto_id < 0 ? "proto" : "func");
> return -1;
> }
> +
> + if (func->kfunc && encoder->tag_kfuncs && !encoder->skip_encoding_decl_tag) {
> + err = btf__tag_kfunc(encoder->btf, func, btf_fn_id);
> + if (err < 0) {
> + fprintf(stderr, "%s: failed to tag kfunc '%s': %d\n",
> + __func__, func->name, err);
Nit: btf__tag_kfunc() already prints to stderr in case of an error,
this printf is unnecessary.
> + return err;
> + }
> + }
> +
> if (state->nr_annots == 0)
> return 0;
>
[...]
next prev parent reply other threads:[~2025-02-19 3:25 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-12 20:15 [PATCH v2 dwarves 0/4] btf_encoder: emit type tags for bpf_arena pointers Ihor Solodrai
2025-02-12 20:15 ` [PATCH v2 dwarves 1/4] btf_encoder: refactor btf_encoder__tag_kfuncs() Ihor Solodrai
2025-02-19 3:25 ` Eduard Zingerman [this message]
2025-02-12 20:15 ` [PATCH v2 dwarves 2/4] btf_encoder: emit type tags for bpf_arena pointers Ihor Solodrai
2025-02-19 4:36 ` Eduard Zingerman
2025-02-19 5:45 ` Eduard Zingerman
2025-02-19 18:03 ` Ihor Solodrai
2025-02-12 20:15 ` [PATCH v2 dwarves 3/4] pahole: introduce --btf_feature=attributes Ihor Solodrai
2025-02-19 5:30 ` Eduard Zingerman
2025-02-12 20:15 ` [PATCH v2 dwarves 4/4] man-pages: describe attributes and remove reproducible_build Ihor Solodrai
2025-02-13 13:16 ` [PATCH v2 dwarves 0/4] btf_encoder: emit type tags for bpf_arena pointers Jiri Olsa
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=3717ee0f4ce384311ac551825a455ada6479f16e.camel@gmail.com \
--to=eddyz87@gmail.com \
--cc=acme@kernel.org \
--cc=alan.maguire@oracle.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=dwarves@vger.kernel.org \
--cc=ihor.solodrai@linux.dev \
--cc=kernel-team@meta.com \
--cc=mykolal@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