BPF List
 help / color / mirror / Atom feed
* Dynamic kfunc discovery
@ 2023-12-19 17:29 Daniel Xu
  2023-12-20  3:15 ` Alexei Starovoitov
  0 siblings, 1 reply; 7+ messages in thread
From: Daniel Xu @ 2023-12-19 17:29 UTC (permalink / raw)
  To: bpf@vger.kernel.org; +Cc: quentin

Hi,

I was chatting w/ Quentin [0] about how bpftool could:

1. Support a "feature dump" of all supported kfuncs on running kernel
2. Generate vmlinux.h with kfunc prototypes

I had another idea this morning so I thought I'd bounce it around
on the list in case others had better ones. 3 vague ideas:

1. Add a BTF type tag annotation in __bpf_kfunc macro. This would
   let bpftool parse BTF to do discovery. It would be fairly clean and
   straightforward, except that I don't think GCC supports these type
   tags. So only clang-built-linux would work.

2. Do the same thing as above, except rather than tagging src code,
   teach pahole about the .BTF_ids section in vmlinux. pahole could then
   construct BTF with the appropriate type tags.

3. Have the kernel export function prototypes (with no forward decls)
   in a pseudo fs file. bpftool could then append the contents of this file
   to the end of the generated vmlinux.h. Unfortunately this would rule
   out minimized type dumps (IOW only dump dependent types for kfuncs
   or something). Unless bpftool wants to embed clang-front-end or
   something like that to parse C.

Would appreciate any thoughts.

Thanks,
Daniel


[0]: https://github.com/libbpf/bpftool/issues/98

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2023-12-20 20:12 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-12-19 17:29 Dynamic kfunc discovery Daniel Xu
2023-12-20  3:15 ` Alexei Starovoitov
2023-12-20  9:07   ` Jiri Olsa
2023-12-20 13:12     ` Jiri Olsa
2023-12-20 16:44     ` Daniel Xu
2023-12-20 19:44       ` Jiri Olsa
2023-12-20 20:12       ` Daniel Xu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox