[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <2e7a9040-6b16-bb9f-0cab-73161899e1f1@fb.com>
Date: Sun, 10 Jan 2021 20:05:04 -0800
From: Yonghong Song <yhs@...com>
To: Andrii Nakryiko <andrii@...nel.org>, <bpf@...r.kernel.org>,
<netdev@...r.kernel.org>, <ast@...com>, <daniel@...earbox.net>
CC: <kernel-team@...com>, Hao Luo <haoluo@...gle.com>,
Alexei Starovoitov <ast@...nel.org>
Subject: Re: [PATCH v2 bpf-next 4/7] selftests/bpf: sync RCU before unloading
bpf_testmod
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@...nel.org>
> Signed-off-by: Andrii Nakryiko <andrii@...nel.org>
Acked-by: Yonghong Song <yhs@...com>
Powered by blists - more mailing lists