From: Eduard Zingerman <eddyz87@gmail.com>
To: Alan Maguire <alan.maguire@oracle.com>, dwarves@vger.kernel.org
Cc: andrii@kernel.org, ast@kernel.org, daniel@iogearbox.net,
martin.lau@linux.dev, acme@kernel.org, ttreyer@meta.com,
yonghong.song@linux.dev, song@kernel.org,
john.fastabend@gmail.com, kpsingh@kernel.org, sdf@fomichev.me,
haoluo@google.com, jolsa@kernel.org, qmo@kernel.org,
ihor.solodrai@linux.dev, david.faust@oracle.com,
jose.marchesi@oracle.com, bpf@vger.kernel.org
Subject: Re: [RFC dwarves 4/5] btf_encoder: Support encoding of inline location information
Date: Fri, 24 Oct 2025 11:04:17 -0700 [thread overview]
Message-ID: <18bee370c4804e666eb7d5360c47439c246e1cb7.camel@gmail.com> (raw)
In-Reply-To: <20251024073328.370457-5-alan.maguire@oracle.com>
On Fri, 2025-10-24 at 08:33 +0100, Alan Maguire wrote:
> This patch requires updated libbpf with APIs to add location
> information. Iterate over inline expansions saving prototype
> and associated location info for later addition. Location
> info can either be added to .BTF or a new .BTF.extra section
> which is split BTF relative to .BTF; this helps when size of
> location info makes adding it to .BTF prohibitive. To support
> this we need to dedup .BTF first, then access the mappings of
> types to ensure the types of the parameters and return values
> of the functions associated with the inline sites get post-dedup
> updates. Finally the .BTF.extra section itself is deduplicated
> allowing for FUNC_PROTO, LOC_PARAM and LOC_PROTO deduplication.
>
> Multiple BTF_KIND_LOCSECs are added if there are more then
> 65535 (max value vlen can support).
>
> Signed-off-by: Alan Maguire <alan.maguire@oracle.com>
> ---
At first it appears that encoding abstract origin of the inlined
functions and relying on dedup is a bit wasteful. But given that
abstract origin might not even exist in the main functions list,
it appears that attempts to track function states more precisely would
be more convoluted.
After sleeping on this patch, I think that having two separate
function state lists (as is done here) is indeed a simplest approach
to take.
[...]
> @@ -812,14 +864,16 @@ static int btf__add_bpf_arena_type_tags(struct btf *btf, struct btf_encoder_func
>
> static inline bool is_kfunc_state(struct btf_encoder_func_state *state)
> {
> - return state && state->elf && state->elf->kfunc;
> + if (!state || !state->elf)
> + return false;
> + return state->elf->kfunc;
> }
>
> static int32_t btf_encoder__add_func_proto(struct btf_encoder *encoder, struct ftype *ftype,
> struct btf_encoder_func_state *state)
> {
> + struct btf *btf = encoder->btf;
I was confused by this change, as previously btf was either a
state->encoder->btf of encoder->btf. But it turns out that
__add_func_proto() callsites guarantee that encoder == state->encoder
when state is present.
Wdyt about a change [1], that splits __add_func_proto() in two in
order to avoid confusion regarding encoders being in sync?
[1] https://github.com/acmel/dwarves/commit/080d1f27ae71e30c269a1e26e85bb86c3683f195
> const struct btf_type *t;
> - struct btf *btf;
> struct parameter *param;
> uint16_t nr_params, param_idx;
> int32_t id, type_id;
[...]
next prev parent reply other threads:[~2025-10-24 18:04 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-24 7:33 [RFC dwarves 0/5] pahole: support BTF inline encoding Alan Maguire
2025-10-24 7:33 ` [RFC dwarves 1/5] dwarf_loader: Add parameters list to inlined expansion Alan Maguire
2025-10-24 7:33 ` [RFC dwarves 2/5] dwarf_loader: Add name to inline expansion Alan Maguire
2025-10-24 7:33 ` [RFC dwarves 3/5] dwarf_loader: Collect inline expansion location information Alan Maguire
2025-10-24 17:55 ` Eduard Zingerman
2025-10-29 17:40 ` Alan Maguire
2025-10-29 18:32 ` Eduard Zingerman
2025-10-29 18:46 ` Alan Maguire
2025-10-24 7:33 ` [RFC dwarves 4/5] btf_encoder: Support encoding of inline " Alan Maguire
2025-10-24 18:04 ` Eduard Zingerman [this message]
2025-10-24 7:33 ` [RFC dwarves 5/5] pahole: Support inline encoding with inline[.extra] BTF feature Alan Maguire
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=18bee370c4804e666eb7d5360c47439c246e1cb7.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=daniel@iogearbox.net \
--cc=david.faust@oracle.com \
--cc=dwarves@vger.kernel.org \
--cc=haoluo@google.com \
--cc=ihor.solodrai@linux.dev \
--cc=john.fastabend@gmail.com \
--cc=jolsa@kernel.org \
--cc=jose.marchesi@oracle.com \
--cc=kpsingh@kernel.org \
--cc=martin.lau@linux.dev \
--cc=qmo@kernel.org \
--cc=sdf@fomichev.me \
--cc=song@kernel.org \
--cc=ttreyer@meta.com \
--cc=yonghong.song@linux.dev \
/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