On Mon, Aug 26, 2024 at 3:48 PM JP Kobryn <inwardvessel@xxxxxxxxx> wrote: > > The additional hooks (and prog-to-hook mapping) for tracepoint and perf > event programs allow for registering kfuncs to be used within these > program types. > > Signed-off-by: JP Kobryn <inwardvessel@xxxxxxxxx> > --- > kernel/bpf/btf.c | 6 ++++++ > 1 file changed, 6 insertions(+) > > diff --git a/kernel/bpf/btf.c b/kernel/bpf/btf.c > index 520f49f422fe..4816e309314e 100644 > --- a/kernel/bpf/btf.c > +++ b/kernel/bpf/btf.c > @@ -210,6 +210,7 @@ enum btf_kfunc_hook { > BTF_KFUNC_HOOK_TC, > BTF_KFUNC_HOOK_STRUCT_OPS, > BTF_KFUNC_HOOK_TRACING, > + BTF_KFUNC_HOOK_TRACEPOINT, > BTF_KFUNC_HOOK_SYSCALL, > BTF_KFUNC_HOOK_FMODRET, > BTF_KFUNC_HOOK_CGROUP_SKB, > @@ -219,6 +220,7 @@ enum btf_kfunc_hook { > BTF_KFUNC_HOOK_LWT, > BTF_KFUNC_HOOK_NETFILTER, > BTF_KFUNC_HOOK_KPROBE, > + BTF_KFUNC_HOOK_PERF_EVENT, > BTF_KFUNC_HOOK_MAX, > }; > > @@ -8306,6 +8308,8 @@ static int bpf_prog_type_to_kfunc_hook(enum bpf_prog_type prog_type) > case BPF_PROG_TYPE_TRACING: > case BPF_PROG_TYPE_LSM: > return BTF_KFUNC_HOOK_TRACING; > + case BPF_PROG_TYPE_TRACEPOINT: > + return BTF_KFUNC_HOOK_TRACEPOINT; why special case tp and perf_event and only limit them to cpumask? The following would be equally safe, no? case BPF_PROG_TYPE_TRACING: case BPF_PROG_TYPE_LSM: + case BPF_PROG_TYPE_TRACEPOINT: + case BPF_PROG_TYPE_PERF_EVENT: return BTF_KFUNC_HOOK_TRACING; ?