From: "Morten Brørup" <mb@smartsharesystems.com>
To: "Robin Jarry" <rjarry@redhat.com>, <dev@dpdk.org>,
"Konstantin Ananyev" <konstantin.ananyev@huawei.com>,
"Wathsala Vithanage" <wathsala.vithanage@arm.com>,
"Stephen Hemminger" <stephen@networkplumber.org>
Cc: <stable@dpdk.org>
Subject: RE: [PATCH dpdk v2] ring: assert wraparound enqueue stays within input
Date: Tue, 1 Dec 2026 10:09:51 +0100 [thread overview]
Message-ID: <98CBD80474FA8B44BF855DF32C47DC35F65B45@smartserver.smartshare.dk> (raw)
In-Reply-To: <20261201090034.387274-2-rjarry@redhat.com>
> From: Robin Jarry [mailto:rjarry@redhat.com]
> Sent: Tuesday, 1 December 2026 10.01
>
> GCC 13 at -O2 reports -Wmaybe-uninitialized for a fully initialized
> 24-byte item passed to rte_ring_enqueue_elem(). The acquire fence
> introduced by commit f2f3cf6d098a ("ring: replace SMP barrier with
> acquire fence") exposes GCC's inability to infer that a valid wrap
> consumes fewer than n input words before restarting.
>
> State that invariant with __rte_assume() inside the wrap loop instead
> of
> adding a condition to the loop.
>
> Fixes: f2f3cf6d098a ("ring: replace SMP barrier with acquire fence")
> Cc: stable@dpdk.org
> Signed-off-by: Robin Jarry <rjarry@redhat.com>
> ---
>
> Notes:
> v2: replaced loop condition with __rte_assume()
>
> lib/ring/rte_ring_elem_pvt.h | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/lib/ring/rte_ring_elem_pvt.h
> b/lib/ring/rte_ring_elem_pvt.h
> index 3d680749ad96..77a2efafe119 100644
> --- a/lib/ring/rte_ring_elem_pvt.h
> +++ b/lib/ring/rte_ring_elem_pvt.h
> @@ -47,8 +47,10 @@ __rte_ring_enqueue_elems_32(void *ring_table, const
> void *obj_table,
> ring[idx++] = obj[i++]; /* fallthrough */
> }
> } else {
> - for (i = 0; idx < size; i++, idx++)
> + for (i = 0; idx < size; i++, idx++) {
> + __rte_assume(i < n);
> ring[idx] = obj[i];
> + }
> /* Start at the beginning */
> for (idx = 0; i < n; i++, idx++)
> ring[idx] = obj[i];
> --
> 2.56.1
Reviewed-by: Morten Brørup <mb@smartsharesystems.com>
prev parent reply other threads:[~2026-12-01 9:09 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-30 12:31 [PATCH dpdk] ring: bound wraparound enqueue by input length Robin Jarry
2026-11-30 14:00 ` Morten Brørup
2026-12-01 9:00 ` [PATCH dpdk v2] ring: assert wraparound enqueue stays within input Robin Jarry
2026-12-01 9:09 ` Morten Brørup [this message]
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=98CBD80474FA8B44BF855DF32C47DC35F65B45@smartserver.smartshare.dk \
--to=mb@smartsharesystems.com \
--cc=dev@dpdk.org \
--cc=konstantin.ananyev@huawei.com \
--cc=rjarry@redhat.com \
--cc=stable@dpdk.org \
--cc=stephen@networkplumber.org \
--cc=wathsala.vithanage@arm.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox