From: sashiko-bot@kernel.org
To: "Puranjay Mohan" <puranjay@kernel.org>
Cc: bpf@vger.kernel.org
Subject: Re: [PATCH bpf-next v2 2/4] selftests/bpf: Add tests for bpf_call_rcu()
Date: Tue, 15 Sep 2026 12:12:43 +0000 [thread overview]
Message-ID: <20260915121243.CE73D1F000FF@smtp.kernel.org> (raw)
In-Reply-To: <20260915114240.3269184-3-puranjay@kernel.org>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] bpf: missing acquire memory barrier in wait_for_callbacks() causes test flakes
--
commit 94884d64c04d541a6330ac72dab6a74a056c422a
Author: Puranjay Mohan <puranjay@kernel.org>
selftests/bpf: Add tests for bpf_call_rcu()
This commit adds test coverage for bpf_call_rcu(), verifying the callback
behavior after a grace period, including proper map, key, and value
recovery. It also includes negative tests for invalid usages.
> diff --git a/tools/testing/selftests/bpf/prog_tests/call_rcu.c b/tools/testing/selftests/bpf/prog_tests/call_rcu.c
> new file mode 100644
> --- /dev/null
> +++ b/tools/testing/selftests/bpf/prog_tests/call_rcu.c
> @@ -0,0 +1,212 @@
[ ... ]
> +/* call_rcu() is lazy on a CONFIG_RCU_LAZY kernel, so allow well over one grace period. */
> +static bool wait_for_callbacks(struct call_rcu *skel, int expected)
> +{
> + int i;
> +
> + for (i = 0; i < 3000; i++) {
> + if (READ_ONCE(skel->bss->callbacks) >= expected)
> + return true;
[Severity: Medium]
Does the poll condition here need an acquire barrier to prevent test flakes
on weakly ordered architectures like ARM64?
The BPF program reclaim() uses __sync_fetch_and_add() (which acts as a
release barrier) to update the callbacks counter after writing to cb_key,
cb_val, and cb_max_entries.
Since READ_ONCE() only provides a volatile read and control dependencies do
not prevent speculative loads from being reordered on ARM64, the CPU might
fetch the shared variables before seeing the updated callbacks flag.
Could this cause the subsequent ASSERT_EQ checks in test_call_rcu_run() to
fail by reading stale values, and would using smp_load_acquire() (or an
explicit barrier) be more appropriate here?
> + usleep(10000);
> + }
> + fprintf(stderr, "callbacks: got %d want %d\n", READ_ONCE(skel->bss->callbacks), expected);
> + return false;
> +}
[ ... ]
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260915114240.3269184-1-puranjay@kernel.org?part=2
next prev parent reply other threads:[~2026-09-15 12:12 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-15 11:42 [PATCH bpf-next v2 0/4] bpf: Add bpf_call_rcu() and bpf_call_rcu_tasks_trace() Puranjay Mohan
2026-09-15 11:42 ` [PATCH bpf-next v2 1/4] bpf: Add bpf_call_rcu() kfunc Puranjay Mohan
2026-09-15 12:01 ` sashiko-bot
2026-09-15 12:07 ` Puranjay Mohan
2026-09-15 11:42 ` [PATCH bpf-next v2 2/4] selftests/bpf: Add tests for bpf_call_rcu() Puranjay Mohan
2026-09-15 12:12 ` sashiko-bot [this message]
2026-09-15 11:42 ` [PATCH bpf-next v2 3/4] bpf: Add bpf_call_rcu_tasks_trace() kfunc Puranjay Mohan
2026-09-15 11:42 ` [PATCH bpf-next v2 4/4] selftests/bpf: Add a test for bpf_call_rcu_tasks_trace() Puranjay Mohan
2026-09-15 12:09 ` [PATCH bpf-next v2 0/4] bpf: Add bpf_call_rcu() and bpf_call_rcu_tasks_trace() Puranjay Mohan
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=20260915121243.CE73D1F000FF@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=puranjay@kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.