From: Yonghong Song <yonghong.song@linux.dev>
To: Alan Maguire <alan.maguire@oracle.com>,
Arnaldo Carvalho de Melo <arnaldo.melo@gmail.com>,
dwarves@vger.kernel.org
Cc: Alexei Starovoitov <ast@kernel.org>,
Andrii Nakryiko <andrii@kernel.org>,
bpf@vger.kernel.org, kernel-team@fb.com
Subject: Re: [PATCH dwarves v8 4/5] btf_encoder: Emit true function signatures
Date: Tue, 23 Jun 2026 18:45:17 -0700 [thread overview]
Message-ID: <5d332838-8f41-43f7-9509-ec97dcbb0578@linux.dev> (raw)
In-Reply-To: <20260623222911.3294083-1-yonghong.song@linux.dev>
On 6/23/26 3:29 PM, Yonghong Song wrote:
> When true_signature is enabled, consume the per-parameter analysis the
> DWARF loader recorded while saving a function's BTF:
> - Drop parameters that were optimized out of a signature-changed function
> (cu->producer_clang && param->optimized), adjusting the saved
> parameter count accordingly.
> - When a parameter was reduced to a single aggregate member
> (param->true_sig_member_name is set), emit it under the synthesized name
> "<parameter>__<member>" so the BTF reflects the value actually passed in
> the register.
>
> Signed-off-by: Yonghong Song <yonghong.song@linux.dev>
> ---
> btf_encoder.c | 26 +++++++++++++++++++++++++-
> 1 file changed, 25 insertions(+), 1 deletion(-)
>
> diff --git a/btf_encoder.c b/btf_encoder.c
> index d5af706..eb6ccaa 100644
> --- a/btf_encoder.c
> +++ b/btf_encoder.c
> @@ -1297,14 +1297,38 @@ static int32_t btf_encoder__save_func(struct btf_encoder *encoder, struct functi
> state->reordered_parm = ftype->reordered_parm;
> ftype__for_each_parameter(ftype, param) {
> const char *name;
> + char *final_name = NULL;
>
> /* No location info/optimized + reordered means optimized out. */
> if (ftype->reordered_parm && (!param->has_loc || param->optimized)) {
> state->nr_parms--;
> continue;
> }
> - name = parameter__name(param) ?: "";
> + if (encoder->true_signature && encoder->cu->producer_clang && param->optimized) {
> + state->nr_parms--;
> + continue;
> + }
> +
> + name = parameter__name(param);
> + if (!name) {
> + name = "";
> + } else if (encoder->true_signature &&
> + encoder->cu->producer_clang &&
> + param->true_sig_member_name) {
> + /* Non-null param->true_sig_member_name indicates that the parameter
> + * name is <parameter_name>__<field_name>.
> + */
> + if (asprintf(&final_name, "%s__%s", name, param->true_sig_member_name) == -1) {
> + err = -ENOMEM;
> + goto out;
> + }
> + name = final_name;
> + }
> +
> str_off = btf__add_str(btf, name);
> + if (final_name)
> + free(final_name);
> +
> if (str_off < 0) {
> err = str_off;
> goto out;
Find another issue in this file, not related to the above.
Just give a simple example for
static inline void io_file_bitmap_set(struct io_file_table *table, int bit)
{
WARN_ON_ONCE(test_bit(bit, table->bitmap));
__set_bit(bit, table->bitmap);
table->alloc_hint = bit + 1;
}
It is in a header file io_uring/filetable.h.
We have inlined subprogram:
0x04fb6857: DW_TAG_subprogram
DW_AT_name ("io_file_bitmap_set")
DW_AT_decl_file ("/home/yhs/work/bpf-next/io_uring/filetable.h")
DW_AT_decl_line (29)
DW_AT_prototyped (true)
DW_AT_inline (DW_INL_inlined)
0x04fb685c: DW_TAG_formal_parameter
DW_AT_name ("table")
DW_AT_decl_file ("/home/yhs/work/bpf-next/io_uring/filetable.h")
DW_AT_decl_line (29)
DW_AT_type (0x04fb6885 "io_file_table *")
0x04fb6865: DW_TAG_formal_parameter
DW_AT_name ("bit")
DW_AT_decl_file ("/home/yhs/work/bpf-next/io_uring/filetable.h")
DW_AT_decl_line (29)
DW_AT_type (0x04fa5103 "int")
and
0x04fb77d8: DW_TAG_subprogram
DW_AT_low_pc (0xffffffff8273d430)
DW_AT_high_pc (0xffffffff8273d50c)
DW_AT_frame_base (DW_OP_reg7 RSP)
DW_AT_call_all_calls (true)
DW_AT_abstract_origin (0x04fb6857 "io_file_bitmap_set")
0x04fb77e5: DW_TAG_formal_parameter
DW_AT_location (indexed (0x11f) loclist = 0x00d4bcf7:
[0xffffffff8273d430, 0xffffffff8273d45c): DW_OP_reg5 RDI
[0xffffffff8273d45c, 0xffffffff8273d4c3): DW_OP_reg3 RBX
[0xffffffff8273d4c3, 0xffffffff8273d4e6): DW_OP_entry_value(DW_OP_reg5 RDI), DW_OP_stack_value
[0xffffffff8273d4e6, 0xffffffff8273d4f6): DW_OP_reg3 RBX
[0xffffffff8273d4f6, 0xffffffff8273d50c): DW_OP_entry_value(DW_OP_reg5 RDI), DW_OP_stack_value)
DW_AT_abstract_origin (0x04fb685c "table")
0x04fb77ec: DW_TAG_formal_parameter
DW_AT_location (indexed (0x120) loclist = 0x00d4bd23:
[0xffffffff8273d430, 0xffffffff8273d464): DW_OP_reg4 RSI
[0xffffffff8273d464, 0xffffffff8273d50c): DW_OP_entry_value(DW_OP_reg4 RSI), DW_OP_stack_value)
DW_AT_abstract_origin (0x04fb6865 "bit")
0x04ff5f5e: DW_TAG_subprogram
DW_AT_name ("io_file_bitmap_set")
DW_AT_decl_file ("/home/yhs/work/bpf-next/io_uring/filetable.h")
DW_AT_decl_line (29)
DW_AT_prototyped (true)
DW_AT_inline (DW_INL_inlined)
0x04ff5f63: DW_TAG_formal_parameter
DW_AT_name ("table")
DW_AT_decl_file ("/home/yhs/work/bpf-next/io_uring/filetable.h")
DW_AT_decl_line (29)
DW_AT_type (0x04ff5f59 "io_file_table *")
0x04ff5f6c: DW_TAG_formal_parameter
DW_AT_name ("bit")
DW_AT_decl_file ("/home/yhs/work/bpf-next/io_uring/filetable.h")
DW_AT_decl_line (29)
DW_AT_type (0x04fe77c6 "int")
I get the following error:
+io_file_bitmap_set : skipping BTF encoding of function due to param count mismatch; 2 params != 0 params
+io_file_bitmap_set : skipping BTF encoding of function due to inconsistet prototype
How do we resolve the issue like this?
If this is hard, we can try to resolve as a follow-up.
next prev parent reply other threads:[~2026-06-24 1:45 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-23 22:28 [PATCH dwarves v8 0/5] pahole: Encode true signatures in kernel BTF Yonghong Song
2026-06-23 22:28 ` [PATCH dwarves v8 1/5] dwarf_loader: Detect aggregate ABI register usage and clang compiler Yonghong Song
2026-06-23 22:29 ` [PATCH dwarves v8 2/5] dwarf_loader: Collect per-parameter information Yonghong Song
2026-06-23 22:29 ` [PATCH dwarves v8 3/5] dwarf_loader: Analyze per-parameter information for true signatures Yonghong Song
2026-06-24 1:21 ` Yonghong Song
2026-06-23 22:29 ` [PATCH dwarves v8 4/5] btf_encoder: Emit true function signatures Yonghong Song
2026-06-24 1:45 ` Yonghong Song [this message]
2026-06-23 22:29 ` [PATCH dwarves v8 5/5] tests: Add BTF true_signature encoding tests Yonghong Song
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=5d332838-8f41-43f7-9509-ec97dcbb0578@linux.dev \
--to=yonghong.song@linux.dev \
--cc=alan.maguire@oracle.com \
--cc=andrii@kernel.org \
--cc=arnaldo.melo@gmail.com \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=dwarves@vger.kernel.org \
--cc=kernel-team@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