From: Jiri Olsa <olsajiri@gmail.com>
To: Alan Maguire <alan.maguire@oracle.com>
Cc: ast@kernel.org, andrii@kernel.org, eddyz87@gmail.com,
qmo@kernel.org, daniel@iogearbox.net, ihor.solodrai@linux.dev,
yonghong.song@linux.dev, song@kernel.org, martin.lau@linux.dev,
memxor@gmail.com, emil@etsalapatis.com, bpf@vger.kernel.org,
nsc@kernel.org, puranjay@kernel.org, yatsenko@meta.com
Subject: Re: [PATCH v3 bpf-next 2/3] bpftool: Update func representation to include function signature
Date: Mon, 28 Sep 2026 11:39:09 +0200 [thread overview]
Message-ID: <aro1veHZThxBJbhF@krava> (raw)
In-Reply-To: <20260926175113.2368566-3-alan.maguire@oracle.com>
On Sat, Sep 26, 2026 at 06:51:12PM +0100, Alan Maguire wrote:
SNIP
> +static void btf_locsec_func_str(const struct btf *btf,
> + const struct btf_loc *loc, char *str, size_t sz)
> +{
> + const struct btf_type *func, *func_proto, *loc_proto;
> + const struct btf_param *params;
> + const __u32 *loc_params;
> + const char *name;
> + __u32 i, vlen;
> + size_t off = 0;
> +
> + if (!sz)
> + return;
> +
> + str[0] = '\0';
> + func = btf__type_by_id(btf, loc->func);
> + if (!func || !btf_is_func(func))
> + goto invalid;
> +
> + name = btf_str(btf, func->name_off);
> + func_proto = btf__type_by_id(btf, func->type);
> + loc_proto = btf__type_by_id(btf, loc->loc_proto);
> + if (!func_proto || !btf_is_func_proto(func_proto) ||
> + !loc_proto || !btf_is_loc_proto(loc_proto) ||
> + btf_vlen(func_proto) != btf_vlen(loc_proto))
> + goto invalid;
> +
> + params = (const void *)(func_proto + 1);
> + loc_params = btf_loc_proto_params(loc_proto);
> + vlen = btf_vlen(func_proto);
> + if (!btf_locsec_append(str, sz, &off, name) ||
> + !btf_locsec_append(str, sz, &off, "("))
> + return;
> + for (i = 0; i < vlen; i++) {
> + const struct btf_type *param_loc;
> + char param_str[256] = {};
> +
> + if (!params[i].type) {
> + /* Handle varargs func proto, must be last parameter */
> + if (i != vlen - 1)
> + goto invalid;
> + if (!btf_locsec_append(str, sz, &off, i ? ", " : "") ||
> + !btf_locsec_append(str, sz, &off, "..."))
> + return;
> + break;
> + } else if (loc_params[i]) {
> + param_loc = btf__type_by_id(btf, loc_params[i]);
> + btf_loc_param_str(param_loc, param_str, sizeof(param_str));
> + } else {
> + snprintf(param_str, sizeof(param_str), "<unavailable>");
hi,
I'm getting many unavailable arguments, like:
jolsa@krava4:~/kernel/linux-qemu-1$ ./tools/bpf/bpftool/bpftool btf dump file /tmp/vmlinux+inline | grep func | grep '<unavailable>' | head -10
func='cpumask_test_cpu(cpu [reg0], cpumask [<unavailable>])' func_type_id=171851 loc_proto_type_id=171852 offset=7674
func='instrument_atomic_check_alignment(v [<unavailable>], size [const 0x8])' func_type_id=171855 loc_proto_type_id=171857 offset=7681
func='instrument_atomic_read(v [<unavailable>], size [const 0x8])' func_type_id=171858 loc_proto_type_id=171857 offset=7681
func='variable_test_bit(nr [*(reg0)], addr [<unavailable>])' func_type_id=171860 loc_proto_type_id=171862 offset=7681
func='arch_test_bit(nr [*(reg0)], addr [<unavailable>])' func_type_id=171864 loc_proto_type_id=171862 offset=7681
func='_test_bit(nr [*(reg0)], addr [<unavailable>])' func_type_id=171865 loc_proto_type_id=171862 offset=7681
func='__srcu_read_lock_fast(ssp [<unavailable>])' func_type_id=171867 loc_proto_type_id=171868 offset=7691
func='srcu_read_lock_fast_notrace(ssp [<unavailable>])' func_type_id=171869 loc_proto_type_id=171868 offset=7691
func='class_srcu_fast_notrace_constructor(l [<unavailable>])' func_type_id=171871 loc_proto_type_id=171868 offset=7691
func='__srcu_read_unlock_fast(ssp [<unavailable>], scp [reg3])' func_type_id=171873 loc_proto_type_id=171875 offset=7727
jolsa@krava4:~/kernel/linux-qemu-1$ ./tools/bpf/bpftool/bpftool btf dump file /tmp/vmlinux+inline | grep func | grep '<unavailable>' | wc -l
157950
I found on the pahole site
/* A zero id in LOC_PROTO represents unavailable location data. */
so I guess it's just not present in dwarf for some reason
jirka
next prev parent reply other threads:[~2026-09-28 9:39 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-26 17:51 [PATCH v3 bpf-next 0/3] BTF inline functionality followups Alan Maguire
2026-09-26 17:51 ` [PATCH v3 bpf-next 1/3] bpf: Verify BTF_KIND_LOC_PARAM vlen, flags Alan Maguire
2026-09-29 10:43 ` Alexei Starovoitov
2026-09-29 10:50 ` Alan Maguire
2026-09-26 17:51 ` [PATCH v3 bpf-next 2/3] bpftool: Update func representation to include function signature Alan Maguire
2026-09-28 9:39 ` Jiri Olsa [this message]
2026-09-28 9:50 ` Alan Maguire
2026-09-28 11:46 ` Quentin Monnet
2026-09-26 17:51 ` [PATCH v3 bpf-next 3/3] selftests/bpf: Fix up bpftool btf dump test for signatures Alan Maguire
2026-09-28 9:39 ` [PATCH v3 bpf-next 0/3] BTF inline functionality followups Jiri Olsa
2026-09-28 11:46 ` Quentin Monnet
2026-09-29 10:50 ` patchwork-bot+netdevbpf
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=aro1veHZThxBJbhF@krava \
--to=olsajiri@gmail.com \
--cc=alan.maguire@oracle.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=eddyz87@gmail.com \
--cc=emil@etsalapatis.com \
--cc=ihor.solodrai@linux.dev \
--cc=martin.lau@linux.dev \
--cc=memxor@gmail.com \
--cc=nsc@kernel.org \
--cc=puranjay@kernel.org \
--cc=qmo@kernel.org \
--cc=song@kernel.org \
--cc=yatsenko@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