From: sashiko-bot@kernel.org
To: "Mykyta Yatsenko" <mykyta.yatsenko5@gmail.com>, bpf@vger.kernel.org
Subject: Re: [PATCH bpf-next 5/5] selftests/bpf: Test sk storage lookups during TCP transmit
Date: Fri, 04 Dec 2026 20:17:07 +0000 [thread overview]
Message-ID: <sashiko-outbox-250612@kernel.org> (raw)
In-Reply-To: <20261204-sk_storage_prefetch-v1-5-ea52fb48b52b@meta.com>
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Low] selftests/bpf: scheduling race in churn() can fail deleted
assertion
--
commit c50686a666890adca4b04b7b43ac8b9ddda340a7
Author: Mykyta Yatsenko <yatsenko@meta.com>
selftests/bpf: Test sk storage lookups during TCP transmit
This commit adds the sk_storage_xmit BPF selftest to exercise concurrent
sk_storage map lookups on TCP egress while user space deletes elements and
destroys and reloads the maps.
> diff --git a/tools/testing/selftests/bpf/prog_tests/sk_storage_xmit.c b/tools/testing/selftests/bpf/prog_tests/sk_storage_xmit.c
> new file mode 100644
> index 0000000000000..9e80011e6630c
> --- /dev/null
> +++ b/tools/testing/selftests/bpf/prog_tests/sk_storage_xmit.c
[ ... ]
> +/* Delete the elements of cli for NR_TRIPS round trips */
> +static void churn(struct sk_storage_xmit *skel, struct pair *p)
> +{
> + struct bpf_map *a = skel->maps.sk_a, *b = skel->maps.sk_b;
> + __u64 end = get_time_ns() + TIMEOUT_NS;
> + int done = READ_ONCE(trips) + NR_TRIPS;
> + int deleted = 0;
> +
> + while (!READ_ONCE(stop) && READ_ONCE(trips) < done &&
> + get_time_ns() < end) {
> + deleted += !bpf_map__delete_elem(a, &p->cli, sizeof(p->cli), 0);
> + deleted += !bpf_map__delete_elem(b, &p->cli, sizeof(p->cli), 0);
> + }
> + ASSERT_GT(deleted, 0, "deleted");
> +}
[Severity: Low]
Can a scheduling delay between the main thread and ping_pong() make
ASSERT_GT(deleted, 0, "deleted") fail spuriously?
ping_pong() runs continuously in a tight loopback round-trip loop without
coordination with churn(). During the second churn() call, ping_pong() is
already running at full speed:
main thread ping_pong thread
churn()
done = READ_ONCE(trips) + 1000
(preempted)
round_trip() x 1000
WRITE_ONCE(trips, trips + 1)
while (READ_ONCE(trips) < done)
/* exits with deleted == 0 */
ASSERT_GT(deleted, 0, ...) <-- spurious failure
On an oversubscribed or single-CPU VM, preemption of the main thread lets
trips reach done before bpf_map__delete_elem() succeeds once, failing the
test even though the kernel behaved correctly.
Looping while (READ_ONCE(trips) < done || !deleted), still bounded by
!READ_ONCE(stop) and get_time_ns() < end, would avoid this race.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261204-sk_storage_prefetch-v1-0-ea52fb48b52b@meta.com?part=5
next prev parent reply other threads:[~2026-12-04 20:17 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-04 20:03 [PATCH bpf-next 0/5] bpf: tcp: Prefetch sk storage before TCP transmit Mykyta Yatsenko
2026-12-04 20:03 ` [PATCH bpf-next 1/5] bpf: Make a NULL cache slot mean that local storage has no value Mykyta Yatsenko
2026-12-04 20:03 ` [PATCH bpf-next 2/5] selftests/bpf: Test sk storage maps that share cache slots Mykyta Yatsenko
2026-12-04 20:03 ` [PATCH bpf-next 3/5] bpf: tcp: Prefetch sk storage cache[] before TCP transmit Mykyta Yatsenko
2026-12-04 20:23 ` sashiko-bot
2026-12-04 21:25 ` Mykyta Yatsenko
2026-12-04 20:03 ` [PATCH bpf-next 4/5] bpf: tcp: Prefetch values of hot sk storage maps before transmit Mykyta Yatsenko
2026-12-04 20:18 ` sashiko-bot
2026-12-04 21:35 ` Mykyta Yatsenko
2026-12-04 20:03 ` [PATCH bpf-next 5/5] selftests/bpf: Test sk storage lookups during TCP transmit Mykyta Yatsenko
2026-12-04 20:17 ` sashiko-bot [this message]
2026-12-04 21:40 ` Mykyta Yatsenko
2026-12-04 21:38 ` [PATCH bpf-next 0/5] bpf: tcp: Prefetch sk storage before " Andrii Nakryiko
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-250612@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=mykyta.yatsenko5@gmail.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