On Mon, Apr 29, 2024 at 2:36 PM Kui-Feng Lee <thinker.li@xxxxxxxxx> wrote: > > Verify whether a user space program is informed through epoll with EPOLLHUP > when a struct_ops object is detached or unregistered using the function > bpf_struct_ops_kvalue_unreg() or BPF_LINK_DETACH. > > Signed-off-by: Kui-Feng Lee <thinker.li@xxxxxxxxx> > --- > .../selftests/bpf/bpf_testmod/bpf_testmod.c | 18 ++- > .../selftests/bpf/bpf_testmod/bpf_testmod.h | 1 + > .../bpf/prog_tests/test_struct_ops_module.c | 104 ++++++++++++++++++ > .../selftests/bpf/progs/struct_ops_module.c | 7 ++ > 4 files changed, 126 insertions(+), 4 deletions(-) > [...] > diff --git a/tools/testing/selftests/bpf/progs/struct_ops_module.c b/tools/testing/selftests/bpf/progs/struct_ops_module.c > index 63b065dae002..7a697a7dd0ac 100644 > --- a/tools/testing/selftests/bpf/progs/struct_ops_module.c > +++ b/tools/testing/selftests/bpf/progs/struct_ops_module.c this file is a bit overloaded with code for various subtests, it's quite hard already to follow what's going on, I suggest adding a separate .c file for this new subtest > @@ -81,3 +81,10 @@ struct bpf_testmod_ops___incompatible testmod_incompatible = { > .test_2 = (void *)test_2, > .data = 3, > }; > + > +SEC(".struct_ops.link") > +struct bpf_testmod_ops testmod_do_unreg = { > + .test_1 = (void *)test_1, > + .test_2 = (void *)test_2, > + .do_unreg = true, > +}; > -- > 2.34.1 >