diff options
| author | Andrii Nakryiko <[email protected]> | 2021-01-12 07:55:17 +0000 |
|---|---|---|
| committer | Alexei Starovoitov <[email protected]> | 2021-01-13 01:23:47 +0000 |
| commit | 635599bace259a2c42741c3ea61bfa7be6f15556 (patch) | |
| tree | a50085d6b0dc9ca61778aad8a06cc285114c3084 /tools/lib/bpf/bpf_helpers.h | |
| parent | bpf: Declare __bpf_free_used_maps() unconditionally (diff) | |
| download | kernel-635599bace259a2c42741c3ea61bfa7be6f15556.tar.gz kernel-635599bace259a2c42741c3ea61bfa7be6f15556.zip | |
selftests/bpf: Sync RCU before unloading bpf_testmod
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_SHARED) or 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 <[email protected]>
Signed-off-by: Andrii Nakryiko <[email protected]>
Signed-off-by: Alexei Starovoitov <[email protected]>
Acked-by: Yonghong Song <[email protected]>
Acked-by: Hao Luo <[email protected]>
Link: https://lore.kernel.org/bpf/[email protected]
Diffstat (limited to 'tools/lib/bpf/bpf_helpers.h')
0 files changed, 0 insertions, 0 deletions
