BPF List
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Emil Tsalapatis" <emil@etsalapatis.com>
Cc: bpf@vger.kernel.org
Subject: Re: [PATCH RESEND bpf-next v3 6/6] selftests/bpf: libarena: Add parallel bitmap selftest
Date: Mon, 06 Jul 2026 18:32:21 +0000	[thread overview]
Message-ID: <20260706183221.8548F1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260706181730.21731-7-emil@etsalapatis.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] Spurious test failure due to BPF instruction budget exhaustion during atomic operation retries
--

commit 03c6a4c41937c3d9d257316bef5f1cacfa40aa71
Author: Emil Tsalapatis <emil@etsalapatis.com>

selftests/bpf: libarena: Add parallel bitmap selftest
    
This commit introduces a new selftest for the libarena atomic bitmap
operations. It spawns two threads that concurrently modify even and odd
bits to verify that operations do not improperly affect adjacent bits.

> diff --git a/tools/testing/selftests/bpf/libarena/selftests/test_parallel_bitmap.bpf.c b/tools/testing/selftests/bpf/libarena/selftests/test_parallel_bitmap.bpf.c
> new file mode 100644
> index 0000000000000..eec2871e2b0d1
> --- /dev/null
> +++ b/tools/testing/selftests/bpf/libarena/selftests/test_parallel_bitmap.bpf.c

[ ... ]

> +__weak
> +int bitmap_test_bit_sequence(u32 bit)
> +{

[ ... ]

> +	if (bmp_test_and_clear_bit(bit, bitmap))
> +		return -EINVAL;
> +
> +	bmp_set_bit(bit, bitmap);
> +	if (!bmp_test_bit(bit, bitmap))
> +		return -EINVAL;

[Severity: Medium]
Will this test fail spuriously if the BPF loop budget is exhausted during
the atomic operation retries?

The test executes a high number of iterations to intentionally run until
the BPF loop budget (can_loop) is exhausted.

Because the two threads heavily contend on the same bitmap words, cmpxchg
operations in helpers like bmp_set_bit can frequently fail and retry.

If the budget runs out precisely during a retry inside bmp_set_bit, the
helper will exit early without performing the atomic operation. This
function then unconditionally asserts the outcome by checking bmp_test_bit.

Since the bit was never set, this will fail and abort the test with
-EINVAL, rather than cleanly terminating due to budget exhaustion.

> +
> +	bmp_clear_bit(bit, bitmap);
> +	if (bmp_test_bit(bit, bitmap))
> +		return -EINVAL;

[ ... ]

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260706181730.21731-1-emil@etsalapatis.com?part=6

  reply	other threads:[~2026-07-06 18:32 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-06 18:17 [PATCH RESEND bpf-next v3 0/6] selftests/bpf: libarena cleanup and bitmap struct Emil Tsalapatis
2026-07-06 18:17 ` [PATCH RESEND bpf-next v3 1/6] selftests/bpf: libarena: Replace leftover st_ prefix with test_ Emil Tsalapatis
2026-07-06 18:17 ` [PATCH RESEND bpf-next v3 2/6] selftests/bpf: libarena: Fix can-loop zero variable definition Emil Tsalapatis
2026-07-06 18:17 ` [PATCH RESEND bpf-next v3 3/6] selftests/bpf: libarena: Clean up allocation state before buddy tests Emil Tsalapatis
2026-07-06 18:17 ` [PATCH RESEND bpf-next v3 4/6] selftests/bpf: Add arena-based bitmap data structure Emil Tsalapatis
2026-07-06 18:27   ` sashiko-bot
2026-07-06 19:04     ` Kumar Kartikeya Dwivedi
2026-07-06 19:17       ` Emil Tsalapatis
2026-07-06 19:23         ` Kumar Kartikeya Dwivedi
2026-07-06 18:17 ` [PATCH RESEND bpf-next v3 5/6] selftests/bpf: libarena: Add bitmap selftests Emil Tsalapatis
2026-07-06 18:17 ` [PATCH RESEND bpf-next v3 6/6] selftests/bpf: libarena: Add parallel bitmap selftest Emil Tsalapatis
2026-07-06 18:32   ` sashiko-bot [this message]
2026-07-06 19:10 ` [PATCH RESEND bpf-next v3 0/6] selftests/bpf: libarena cleanup and bitmap struct patchwork-bot+netdevbpf

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=20260706183221.8548F1F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=emil@etsalapatis.com \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox