Re: [PATCH bpf-next 00/13] bpf: Add tracing_multi link support for bpf progs
Andrii Nakryiko <[email protected]>
| Newsgroups | org.kernel.vger.linux-kselftest,org.kernel.vger.bpf,org.kernel.vger.linux-kernel,org.kernel.vger.linux-trace-kernel |
|---|---|
| Message-ID | <CAEf4BzaXaLLqs6XXCG_02c7UcvNWfbGUAJTYosr22oaD4iokuQ@mail.gmail.com> |
On Sun, Aug 16, 2026 at 11:20 PM Leon Hwang <[email protected]> wrote: > > On 15/8/26 04:14, Andrii Nakryiko wrote: > > On Sun, Aug 9, 2026 at 8:01 AM Leon Hwang <[email protected]> wrote: > >> > >> Similar to the tracing_multi link support for kernel functions [1], add > >> support for bpf progs. > >> > >> When attaching to bpf progs, it must attaches to the target by text poke > >> way. > >> > > > > Please spend a bit more human effort on justification for the change > > and explaining your use case. In what case you'll be attaching to a > > large amount of BPF programs such that attachment speed-up (if there > > is any) matters. > > Will update the cover letter with justification and my use case. > > Here's my use case: > > I'm planning to enhance the function-graph feature of bpfsnoop [1]. It > will trace all bpf progs, including their subprogs, to draw a full > function call graph including bpf prog call sites. > fair enough, interesting use case, definitely outline that in the next revision (and provide before/after attach time as well for such use case, please) > The attachment could speed-up when there are hundreds of targets. For > example, on high CPU core count servers, it probably runs 200 tc-bpf > progs as Kubernetes CNI, and each tc-bpf prog might have 4 subprogs. > Hence, there will be 1000 targets to trace for bpfsnoop's function-graph > feature. > > With tracing_multi link support for bpf progs, bpfsnoop will be able to > attach to all targets quickly. > > [1] https://github.com/bpfsnoop/bpfsnoop > > > > > Please do your homework. Generating code with AI is easy, reviewing > > Sure, will do my homework. > > > and making decisions about whether it's the right approach (and > > ultimately supporting it long term) is still a human process, so let's > > weigh that in. > > Will keep it in mind. > > Thanks, > Leon > > > > >> [1] https://lore.kernel.org/bpf/[email protected]/ > >> > >> Leon Hwang (13): > >> bpf: Initialize ftrace_managed in bpf_trampoline_get > >> bpf: Factor out update_fentry_multi helper > >> bpf: Drop unnecessary ftrace_location() in update_fentry_multi() > >> bpf: Add tracing_multi link support for bpf progs > >> libbpf: Add tracing_multi link support for bpf progs > >> bpf: Add tracing_multi link fdinfo support for bpf progs > >> bpf: Add tracing_multi link info support for bpf progs > >> selftests/bpf: Add tracing_multi bpf prog attach test > >> selftests/bpf: Add tracing_multi bpf prog attach failure tests > >> selftests/bpf: Add tracing_multi bpf prog cookie test > >> selftests/bpf: Add tracing_multi bpf prog rollback test > >> selftests/bpf: Add tracing_multi bpf prog link info test > >> selftests/bpf: Test tailcall with fentry.multi > >> > >> include/linux/bpf.h | 3 + > >> include/uapi/linux/bpf.h | 6 +- > >> kernel/bpf/trampoline.c | 87 +++--- > >> kernel/bpf/verifier.c | 22 +- > >> kernel/trace/bpf_trace.c | 212 ++++++++++++--- > >> tools/bpf/bpftool/link.c | 59 +++- > >> tools/include/uapi/linux/bpf.h | 6 +- > >> tools/lib/bpf/bpf.c | 1 + > >> tools/lib/bpf/bpf.h | 2 + > >> tools/lib/bpf/libbpf.c | 39 ++- > >> tools/lib/bpf/libbpf.h | 4 +- > >> tools/lib/bpf/libbpf_internal.h | 1 + > >> .../selftests/bpf/prog_tests/fill_link_info.c | 170 ++++++++++-- > >> .../selftests/bpf/prog_tests/tailcalls.c | 62 +++++ > >> .../selftests/bpf/prog_tests/tracing_multi.c | 254 ++++++++++++++++++ > >> .../selftests/bpf/progs/tracing_multi_bpf.c | 61 +++++ > >> 16 files changed, 869 insertions(+), 120 deletions(-) > >> create mode 100644 tools/testing/selftests/bpf/progs/tracing_multi_bpf.c > >> > >> -- > >> 2.55.0 >