On Thu, Jul 3, 2025 at 5:23 AM Menglong Dong <menglong8.dong@xxxxxxxxx> wrote: > > We add skip_invalid and attach_tracing for tracing_multi for the > selftests. > > When we try to attach all the functions in available_filter_functions with > tracing_multi, we can't tell if the target symbol can be attached > successfully, and the attaching will fail. When skip_invalid is set to > true, we will check if it can be attached in libbpf, and skip the invalid > entries. > > We will skip the symbols in the following cases: > > 1. the btf type not exist > 2. the btf type is not a function proto > 3. the function args count more that 6 > 4. the return type is struct or union > 5. any function args is struct or union > > The 5th rule can be a manslaughter, but it's ok for the testings. > > "attach_tracing" is used to convert a TRACING prog to TRACING_MULTI. For > example, we can set the attach type to FENTRY_MULTI before we load the > skel. And we can attach the prog with > bpf_program__attach_trace_multi_opts() with "attach_tracing=1". The libbpf > will attach the target btf type of the prog automatically. This is also > used to reuse the selftests of tracing. > > (Oh my goodness! What am I doing?) exactly... Let's think if we need any of that, as in: take a step back, and try to explain why you think any of this should be part of libbpf's UAPI. > > Signed-off-by: Menglong Dong <dongml2@xxxxxxxxxxxxxxx> > --- > tools/lib/bpf/libbpf.c | 97 ++++++++++++++++++++++++++++++++++++------ > tools/lib/bpf/libbpf.h | 6 ++- > 2 files changed, 89 insertions(+), 14 deletions(-) > [...]