From: sashiko-bot@kernel.org
To: "Jonathan Bastari Thamrin" <thamrinjonathan@gmail.com>
Cc: bpf@vger.kernel.org
Subject: Re: [PATCH bpf-next v2] selftests/bpf: Wait for wq callback before checking ok_sleepable
Date: Mon, 02 Nov 2026 02:44:41 +0000 [thread overview]
Message-ID: <sashiko-outbox-192845@kernel.org> (raw)
In-Reply-To: <20261102-wq-poll-fix-v2-1-48b7d12815b8@gmail.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] selftests/bpf: missing error jump before spin loop in serial_test_wq()
--
commit b67542c75142d5bd693ad5ed6fa8a0252549f42f
Author: Jonathan Bastari Thamrin <thamrinjonathan@gmail.com>
selftests/bpf: Wait for wq callback before checking ok_sleepable
This commit replaces the 50us sleep in serial_test_wq() with a spin loop
waiting for a wq_cb_run counter to be incremented by wq_cb_sleepable()
before checking ok_sleepable.
Link: https://github.com/kernel-patches/vmtest/issues/455
> diff --git a/tools/testing/selftests/bpf/prog_tests/wq.c b/tools/testing/selftests/bpf/prog_tests/wq.c
> index 97926e35aaf26..95ed4b69c0f50 100644
> --- a/tools/testing/selftests/bpf/prog_tests/wq.c
> +++ b/tools/testing/selftests/bpf/prog_tests/wq.c
> @@ -28,8 +28,9 @@ void serial_test_wq(void)
> ASSERT_OK(err, "test_run");
> ASSERT_EQ(topts.retval, 0, "test_run");
>
> - usleep(50); /* 10 usecs should be enough, but give it extra */
> -
> + /* wait for wq callback to finish */
> + while (!READ_ONCE(wq_skel->bss->wq_cb_run))
> + sched_yield();
[Severity: Medium]
Can serial_test_wq() hang indefinitely here if bpf_prog_test_run_opts()
fails or if test_syscall_array_sleepable() -> test_elem_callback() in
tools/testing/selftests/bpf/progs/wq.c returns a non-zero error in
topts.retval before bpf_wq_start() schedules wq_cb_sleepable()?
Since ASSERT_OK() and ASSERT_EQ() only record the failure and evaluate to
false without returning or jumping to clean_up, execution falls through
into the while (!READ_ONCE(wq_skel->bss->wq_cb_run)) loop even when
wq_cb_sleepable() was never queued.
Should the assertions jump to clean_up on failure before entering the wait
loop, for example:
if (!ASSERT_OK(err, "test_run") ||
!ASSERT_EQ(topts.retval, 0, "test_run"))
goto clean_up;
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261102-wq-poll-fix-v2-1-48b7d12815b8@gmail.com?part=1
next prev parent reply other threads:[~2026-11-02 2:44 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-02 2:36 [PATCH bpf-next v2] selftests/bpf: Wait for wq callback before checking ok_sleepable Jonathan Bastari Thamrin via B4 Relay
2026-11-02 2:36 ` Jonathan Bastari Thamrin
2026-11-02 2:44 ` sashiko-bot [this message]
2026-11-02 6:15 ` Alexei Starovoitov
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=sashiko-outbox-192845@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=thamrinjonathan@gmail.com \
/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.