From: sashiko-bot@kernel.org
To: "Emil Tsalapatis" <emil@etsalapatis.com>
Cc: bpf@vger.kernel.org
Subject: Re: [PATCH bpf-next v2 2/3] selftests/bpf: libarena: Add spmc queue data structure
Date: Wed, 03 Jun 2026 18:46:45 +0000 [thread overview]
Message-ID: <20260603184646.5ABD41F00893@smtp.kernel.org> (raw)
In-Reply-To: <20260603182727.3922-3-emil@etsalapatis.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] Duplicate pops occur in spmc_owned_remove.
--
commit 32e23022b6cf8e4bb5da76036f824fc171bf9e71
Author: Emil Tsalapatis <emil@etsalapatis.com>
selftests/bpf: libarena: Add spmc queue data structure
Expand libarena with a single producer multiple consumer deque data
structure. This is a single producer, multiple consumer lockless structure
that permits efficient work stealing. The structure is a Lev-Chase queue,
so it is lock-free and wait-free.
> diff --git a/tools/testing/selftests/bpf/libarena/src/spmc.bpf.c b/tools/testing/selftests/bpf/libarena/src/spmc.bpf.c
> new file mode 100644
> index 0000000000000..7fd7b18a03732
> --- /dev/null
> +++ b/tools/testing/selftests/bpf/libarena/src/spmc.bpf.c
[ ... ]
> +__weak
> +int spmc_owned_remove(struct spmc __arena *spmc, u64 *val)
> +{
> + volatile struct spmc_arr __arena *arr;
> + int ret = 0;
> + ssize_t sz;
> + u64 value;
> + u64 b, t;
> +
> + if (unlikely(!spmc || !val))
> + return -EINVAL;
> +
> + b = smp_load_acquire(&spmc->bottom) - 1;
> + t = smp_load_acquire(&spmc->top);
> + arr = READ_ONCE(spmc->cur);
> +
> + smp_store_release(&spmc->bottom, b);
[Severity: Medium]
Could this ordering result in duplicate pops?
Because top is read before bottom is updated here, could stealers erroneously
consume the same item as the owner? In a standard Chase-Lev queue, storing
bottom before evaluating top, separated by a full memory barrier, is required
to avoid this race.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260603182727.3922-1-emil@etsalapatis.com?part=2
next prev parent reply other threads:[~2026-06-03 18:46 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-03 18:27 [PATCH bpf-next v2 0/3] selftests/bpf: libarena: Add initial data structures Emil Tsalapatis
2026-06-03 18:27 ` [PATCH bpf-next v2 1/3] selftests/bpf: libarena: Add rbtree data structure Emil Tsalapatis
2026-06-03 18:38 ` sashiko-bot
2026-06-03 18:27 ` [PATCH bpf-next v2 2/3] selftests/bpf: libarena: Add spmc queue " Emil Tsalapatis
2026-06-03 18:46 ` sashiko-bot [this message]
2026-06-03 18:27 ` [PATCH bpf-next v2 3/3] selftests/bpf: libarena: parallel test harness and spmc parallel selftest Emil Tsalapatis
2026-06-03 18:55 ` sashiko-bot
2026-06-04 16:51 ` [PATCH bpf-next v2 0/3] selftests/bpf: libarena: Add initial data structures Alexei Starovoitov
2026-06-04 17:05 ` Emil Tsalapatis
2026-06-04 17:27 ` Alexei Starovoitov
2026-06-05 0:29 ` Emil Tsalapatis
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=20260603184646.5ABD41F00893@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 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.