From: Jiri Olsa <olsajiri@gmail.com>
To: Daniel Xu <dxu@dxuuu.xyz>
Cc: Jiri Olsa <olsajiri@gmail.com>,
quentin@isovalent.com, daniel@iogearbox.net, ast@kernel.org,
andrii@kernel.org, alexei.starovoitov@gmail.com,
alan.maguire@oracle.com, memxor@gmail.com, martin.lau@linux.dev,
eddyz87@gmail.com, song@kernel.org, yonghong.song@linux.dev,
john.fastabend@gmail.com, kpsingh@kernel.org, sdf@google.com,
haoluo@google.com, bpf@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH bpf-next] bpftool: Support dumping kfunc prototypes from BTF
Date: Tue, 30 Jan 2024 09:15:33 +0100 [thread overview]
Message-ID: <ZbiwJcfN6snXZ0Vn@krava> (raw)
In-Reply-To: <spuzs32tv6v5czb76gstpvisv2xkfzz2scqw4hmqncflhxoj66@hie6m7pctfdo>
On Mon, Jan 29, 2024 at 09:13:13AM -0700, Daniel Xu wrote:
> Hi Jiri,
>
> On Mon, Jan 29, 2024 at 01:11:17PM +0100, Jiri Olsa wrote:
> > On Sun, Jan 28, 2024 at 06:35:33PM -0700, Daniel Xu wrote:
> > > This patch enables dumping kfunc prototypes from bpftool. This is useful
> > > b/c with this patch, end users will no longer have to manually define
> > > kfunc prototypes. For the kernel tree, this also means we can drop
> > > kfunc prototypes from:
> > >
> > > tools/testing/selftests/bpf/bpf_kfuncs.h
> > > tools/testing/selftests/bpf/bpf_experimental.h
> > >
> > > Example usage:
> > >
> > > $ make PAHOLE=/home/dxu/dev/pahole/build/pahole -j30 vmlinux
> > >
> > > $ ./tools/bpf/bpftool/bpftool btf dump file ./vmlinux format c | rg "__ksym;" | head -3
> > > extern void cgroup_rstat_updated(struct cgroup * cgrp, int cpu) __ksym;
> > > extern void cgroup_rstat_flush(struct cgroup * cgrp) __ksym;
> > > extern struct bpf_key * bpf_lookup_user_key(u32 serial, u64 flags) __ksym;
> >
> > hi,
> > I'm getting following declaration for bpf_rbtree_add_impl:
> >
> > extern int bpf_rbtree_add_impl(struct bpf_rb_root * root, struct bpf_rb_node * node, bool (struct bpf_rb_node *, const struct bpf_rb_node *)* less, void * meta__ign, u64 off) __ksym;
> >
> > and it fails to compile with:
> >
> > In file included from skeleton/pid_iter.bpf.c:3:
> > ./vmlinux.h:164511:141: error: expected ')'
> > 164511 | extern int bpf_rbtree_add_impl(struct bpf_rb_root * root, struct bpf_rb_node * node, bool (struct bpf_rb_node *, const struct bpf_rb_node *)* less, void * meta__ign, u64 off) __ksym;
> > | ^
> > ./vmlinux.h:164511:31: note: to match this '('
> > 164511 | extern int bpf_rbtree_add_impl(struct bpf_rb_root * root, struct bpf_rb_node * node, bool (struct bpf_rb_node *, const struct bpf_rb_node *)* less, void * meta__ign, u64 off) __ksym;
> >
> > looks like the btf_dumper_type_only won't dump function pointer argument
> > properly.. I guess we should fix that, but looking at the other stuff in
> > vmlinux.h like *_ops struct we can print function pointers properly, so
> > perhaps another way around is to use btf_dumper interface instead
>
> Ah, crap, looks like between all the branch switching I didn't build
> vmlinux with kfunc annotations. Having fixed that, I can repro this
> build failure.
>
> I'll take a look and see what the best way to fix this is.
>
> Given that end to end the whole flow basically works, should we start
> working on merging patches?
yes, the flow looks good to me.. will check the rest of the patches
jirka
next prev parent reply other threads:[~2024-01-30 8:15 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-29 1:35 [PATCH bpf-next] bpftool: Support dumping kfunc prototypes from BTF Daniel Xu
2024-01-29 12:11 ` Jiri Olsa
2024-01-29 16:13 ` Daniel Xu
2024-01-30 8:15 ` Jiri Olsa [this message]
2024-01-30 4:33 ` Andrii Nakryiko
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=ZbiwJcfN6snXZ0Vn@krava \
--to=olsajiri@gmail.com \
--cc=alan.maguire@oracle.com \
--cc=alexei.starovoitov@gmail.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=dxu@dxuuu.xyz \
--cc=eddyz87@gmail.com \
--cc=haoluo@google.com \
--cc=john.fastabend@gmail.com \
--cc=kpsingh@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=martin.lau@linux.dev \
--cc=memxor@gmail.com \
--cc=quentin@isovalent.com \
--cc=sdf@google.com \
--cc=song@kernel.org \
--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