Acked-by: Hao Luo <haoluo@xxxxxxxxxx> On Sun, Jan 10, 2021 at 8:05 PM Yonghong Song <yhs@xxxxxx> wrote: > > > > On 1/8/21 2:09 PM, Andrii Nakryiko wrote: > > If some of the subtests use module BTFs through ksyms, they will cause > > bpf_prog to take a refcount on bpf_testmod module, which will prevent it from > > successfully unloading. Module's refcnt is decremented when bpf_prog is freed, > > which generally happens in RCU callback. So we need to trigger > > syncronize_rcu() in the kernel, which can be achieved nicely with > > membarrier(MEMBARRIER_CMD_GLOBAL) syscall. So do that in kernel_sync_rcu() and > > make it available to other test inside the test_progs. This synchronize_rcu() > > is called before attempting to unload bpf_testmod. > > > > Fixes: 9f7fa225894c ("selftests/bpf: Add bpf_testmod kernel module for testing") > > Suggested-by: Alexei Starovoitov <ast@xxxxxxxxxx> > > Signed-off-by: Andrii Nakryiko <andrii@xxxxxxxxxx> > > Acked-by: Yonghong Song <yhs@xxxxxx>