On 24/3/26 16:18, Jiri Olsa wrote: > Adding tracing_multi link fdinfo support with following output: > > pos: 0 > flags: 02000000 > mnt_id: 19 > ino: 3091 > link_type: tracing_multi > link_id: 382
Would better to add attach_type? attach_type: [fentry,fexit,fsession]_multi Thanks, Leon > prog_tag: 62073a1123f07ef7 > prog_id: 715 > cnt: 10 > cookie BTF-id func > 8 91203 bpf_fentry_test1+0x4/0x10 > 9 91205 bpf_fentry_test2+0x4/0x10 > 7 91206 bpf_fentry_test3+0x4/0x20 > 5 91207 bpf_fentry_test4+0x4/0x20 > 4 91208 bpf_fentry_test5+0x4/0x20 > 2 91209 bpf_fentry_test6+0x4/0x20 > 3 91210 bpf_fentry_test7+0x4/0x10 > 1 91211 bpf_fentry_test8+0x4/0x10 > 10 91212 bpf_fentry_test9+0x4/0x10 > 6 91204 bpf_fentry_test10+0x4/0x10 > > Signed-off-by: Jiri Olsa <[email protected]> > --- > kernel/trace/bpf_trace.c | 26 ++++++++++++++++++++++++++ > 1 file changed, 26 insertions(+) > > diff --git a/kernel/trace/bpf_trace.c b/kernel/trace/bpf_trace.c > index 761501ce3a5f..41b691e83dc4 100644 > --- a/kernel/trace/bpf_trace.c > +++ b/kernel/trace/bpf_trace.c > @@ -3618,9 +3618,35 @@ static void bpf_tracing_multi_link_dealloc(struct > bpf_link *link) > kvfree(tr_link); > } > > +#ifdef CONFIG_PROC_FS > +static void bpf_tracing_multi_show_fdinfo(const struct bpf_link *link, > + struct seq_file *seq) > +{ > + struct bpf_tracing_multi_link *tr_link = > + container_of(link, struct bpf_tracing_multi_link, link); > + bool has_cookies = !!tr_link->cookies; > + > + seq_printf(seq, "cnt:\t%u\n", tr_link->nodes_cnt); > + > + seq_printf(seq, "%s\t %s\t %s\n", "cookie", "BTF-id", "func"); > + for (int i = 0; i < tr_link->nodes_cnt; i++) { > + struct bpf_tracing_multi_node *mnode = &tr_link->nodes[i]; > + u32 btf_id; > + > + bpf_trampoline_unpack_key(mnode->trampoline->key, NULL, > &btf_id); > + seq_printf(seq, "%llu\t %u\t %pS\n", > + has_cookies ? tr_link->cookies[i] : 0, > + btf_id, (void *) mnode->trampoline->ip); > + } > +} > +#endif > + > static const struct bpf_link_ops bpf_tracing_multi_link_lops = { > .release = bpf_tracing_multi_link_release, > .dealloc_deferred = bpf_tracing_multi_link_dealloc, > +#ifdef CONFIG_PROC_FS > + .show_fdinfo = bpf_tracing_multi_show_fdinfo, > +#endif > }; > > int bpf_tracing_multi_attach(struct bpf_prog *prog, const union bpf_attr > *attr)
