From: Yonghong Song <yhs@fb.com>
To: Andrii Nakryiko <andrii@kernel.org>, <bpf@vger.kernel.org>,
<netdev@vger.kernel.org>, <ast@fb.com>, <daniel@iogearbox.net>
Cc: <kernel-team@fb.com>, Hao Luo <haoluo@google.com>,
Alexei Starovoitov <ast@kernel.org>
Subject: Re: [PATCH v2 bpf-next 4/7] selftests/bpf: sync RCU before unloading bpf_testmod
Date: Sun, 10 Jan 2021 20:05:04 -0800 [thread overview]
Message-ID: <2e7a9040-6b16-bb9f-0cab-73161899e1f1@fb.com> (raw)
In-Reply-To: <20210108220930.482456-5-andrii@kernel.org>
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@kernel.org>
> Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Acked-by: Yonghong Song <yhs@fb.com>
next prev parent reply other threads:[~2021-01-11 4:06 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-01-08 22:09 [PATCH v2 bpf-next 0/7] Support kernel module ksym variables Andrii Nakryiko
2021-01-08 22:09 ` [PATCH v2 bpf-next 1/7] bpf: add bpf_patch_call_args prototype to include/linux/bpf.h Andrii Nakryiko
2021-01-11 4:02 ` Yonghong Song
2021-01-08 22:09 ` [PATCH v2 bpf-next 2/7] bpf: avoid warning when re-casting __bpf_call_base into __bpf_call_base_args Andrii Nakryiko
2021-01-11 4:03 ` Yonghong Song
2021-01-08 22:09 ` [PATCH v2 bpf-next 3/7] bpf: declare __bpf_free_used_maps() unconditionally Andrii Nakryiko
2021-01-11 4:03 ` Yonghong Song
2021-01-08 22:09 ` [PATCH v2 bpf-next 4/7] selftests/bpf: sync RCU before unloading bpf_testmod Andrii Nakryiko
2021-01-11 4:05 ` Yonghong Song [this message]
2021-01-11 18:59 ` Hao Luo
2021-01-08 22:09 ` [PATCH v2 bpf-next 5/7] bpf: support BPF ksym variables in kernel modules Andrii Nakryiko
2021-01-11 4:13 ` Yonghong Song
2021-01-11 21:29 ` Andrii Nakryiko
2021-01-12 1:25 ` Yonghong Song
2021-01-11 18:59 ` Hao Luo
2021-01-11 21:31 ` Andrii Nakryiko
2021-01-08 22:09 ` [PATCH v2 bpf-next 6/7] libbpf: support kernel module ksym externs Andrii Nakryiko
2021-01-11 4:15 ` Yonghong Song
2021-01-11 21:37 ` Andrii Nakryiko
2021-01-12 1:34 ` Yonghong Song
2021-01-12 6:45 ` Andrii Nakryiko
2021-01-11 19:00 ` Hao Luo
2021-01-11 21:39 ` Andrii Nakryiko
2021-01-08 22:09 ` [PATCH v2 bpf-next 7/7] selftests/bpf: test " Andrii Nakryiko
2021-01-11 4:18 ` Yonghong Song
2021-01-11 21:40 ` Andrii Nakryiko
2021-01-11 19:00 ` Hao Luo
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=2e7a9040-6b16-bb9f-0cab-73161899e1f1@fb.com \
--to=yhs@fb.com \
--cc=andrii@kernel.org \
--cc=ast@fb.com \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=haoluo@google.com \
--cc=kernel-team@fb.com \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).