Hi Jiri,
Nice version for tracing_multi link.
I hope I have time to add tracing_multi link support to bpfsnoop, and
test this new tracing feature.
I left comments on patches #13, #24, and #25.
Hope this series lands in bpf-next soon.
Thanks,
Leon
On 24/3/26 16:18, Jiri Olsa wrote:
> hi,
> adding tracing_multi link support that allows fast attachment
> of tracing program to many functions.
>
> RFC: https://lore.kernel.org/bpf/[email protected]/
> v1: https://lore.kernel.org/bpf/[email protected]/
> v2: https://lore.kernel.org/bpf/[email protected]/
> v3: https://lore.kernel.org/bpf/[email protected]/
>
> v4 changes:
> - unlink rollback fix (added ftrace_hash_count) [bot]
> - use const for some bpf_link_create_opts tracing_multi members [bot]
> - adding missing comment for lockdep keys [bot]
> - selftest error path fixes (leaks) and other assorted test fixes [Leon Hwang]
> - several compile fixes wrt CONFIG_BPF_SYSCALL and CONFIG_BPF_JIT [kernel
> test robot]
> - make ftrace_hash_clear global, because it's needed in rollback
>
> v3 changes:
> - fix module parsing [Leon Hwang]
> - use function traceable check from libbpf [Leon Hwang]
> - use ptr_to_u64 and fix/updated few comments [ci]
> - display cookies as decimal numbers [ci]
> - added link_create.flags check [ci]
> - fix error path in bpf_trampoline_multi_detach [ci]
> - make fentry/fexit.multi not extendable [ci]
> - add missing OPTS_VALID to bpf_program__attach_tracing_multi [ci]
>
> v2 changes:
> - allocate data.unreg in bpf_trampoline_multi_attach for rollback path [ci]
> and fixed link count setup in rollback path [ci]
> - several small assorted fixes [ci]
> - added loongarch and powerpc changes for struct bpf_tramp_node change
> - added support to attach functions from modules
> - added tests for sleepable programs
> - added rollback tests
>
> v1 changes:
> - added ftrace_hash_count as wrapper for hash_count [Steven]
> - added trampoline mutex pool [Andrii]
> - reworked 'struct bpf_tramp_node' separatoin [Andrii]
> - the 'struct bpf_tramp_node' now holds pointer to bpf_link,
> which is similar to what we do for uprobe_multi;
> I understand it's not a fundamental change compared to previous
> version which used bpf_prog pointer instead, but I don't see better
> way of doing this.. I'm happy to discuss this further if there's
> better idea
> - reworked 'struct bpf_fsession_link' based on bpf_tramp_node
> - made btf__find_by_glob_kind function internal helper [Andrii]
> - many small assorted fixes [Andrii,CI]
> - added session support [Leon Hwang]
> - added cookies support
> - added more tests
>
>
> Note I plan to send linkinfo support separately, the patchset is big enough.
>
> thanks,
> jirka
>
>
> Cc: Hengqi Chen
> ---
> Jiri Olsa (25):
> ftrace: Add ftrace_hash_count function
> ftrace: Make ftrace_hash_clear global
> bpf: Use mutex lock pool for bpf trampolines
> bpf: Add struct bpf_trampoline_ops object
> bpf: Add struct bpf_tramp_node object
> bpf: Factor fsession link to use struct bpf_tramp_node
> bpf: Add multi tracing attach types
> bpf: Move sleepable verification code to btf_id_allow_sleepable
> bpf: Add bpf_trampoline_multi_attach/detach functions
> bpf: Add support for tracing multi link
> bpf: Add support for tracing_multi link cookies
> bpf: Add support for tracing_multi link session
> bpf: Add support for tracing_multi link fdinfo
> libbpf: Add bpf_object_cleanup_btf function
> libbpf: Add bpf_link_create support for tracing_multi link
> libbpf: Add btf_type_is_traceable_func function
> libbpf: Add support to create tracing multi link
> selftests/bpf: Add tracing multi skel/pattern/ids attach tests
> selftests/bpf: Add tracing multi skel/pattern/ids module attach tests
> selftests/bpf: Add tracing multi intersect tests
> selftests/bpf: Add tracing multi cookies test
> selftests/bpf: Add tracing multi session test
> selftests/bpf: Add tracing multi attach fails test
> selftests/bpf: Add tracing multi attach benchmark test
> selftests/bpf: Add tracing multi attach rollback tests
>
> arch/arm64/net/bpf_jit_comp.c | 58
> +++---
> arch/loongarch/net/bpf_jit.c | 44
> ++---
> arch/powerpc/net/bpf_jit_comp.c| 46
> ++---
> arch/riscv/net/bpf_jit_comp64.c| 52
> ++---
> arch/s390/net/bpf_jit_comp.c | 44
> ++---
> arch/x86/net/bpf_jit_comp.c| 54
> ++---
> include/linux/bpf.h| 102
> +++---
> include/linux/bpf_types.h | 1 +
> include