Re: [PATCH bpf-next v3 0/3] Annotate kfuncs in .BTF_ids section

From: Daniel Xu
Date: Mon Jan 08 2024 - 12:59:06 EST


Hi Lorenz,

On Mon, Jan 08, 2024 at 10:15:45AM +0100, Lorenz Bauer wrote:
> On Sat, Jan 6, 2024 at 7:25 PM Daniel Xu <dxu@xxxxxxxxx> wrote:
> >
> > === Description ===
> >
> > This is a bpf-treewide change that annotates all kfuncs as such inside
> > .BTF_ids. This annotation eventually allows us to automatically generate
> > kfunc prototypes from bpftool.
> >
> > We store this metadata inside a yet-unused flags field inside struct
> > btf_id_set8 (thanks Kumar!). pahole will be taught where to look.
>
> This is great, thanks for tackling this. With yout patches we can
> figure out the full set of kfuncs. Is there a way to extend it so that
> we can tell which program context a kfunc can be called from?

I think a potential approach would be to extend BTF_ID_FLAGS() with some
more flags if we want to continue with .BTF_ids parsing technique. But
it has some issues with program-type-less helpers that are associated with
attachpoints as well as struct_ops helpers.

Since it looks like we're in rather early stages of program-type-less
world, maybe it'd be good to defer solving this problem until more use
cases are established and we can find a good cut point to design around.
Even with uapi helpers there was no way before.

Thanks,
Daniel