DPDK-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Robin Jarry <rjarry@redhat.com>
To: dev@dpdk.org,
	"Konstantin Ananyev" <konstantin.ananyev@huawei.com>,
	"Wathsala Vithanage" <wathsala.vithanage@arm.com>,
	"Morten Brørup" <mb@smartsharesystems.com>,
	"Stephen Hemminger" <stephen@networkplumber.org>
Cc: stable@dpdk.org
Subject: [PATCH dpdk v2] ring: split 128-bit pair copies for unoptimized GCC
Date: Mon, 30 Nov 2026 15:04:26 +0100	[thread overview]
Message-ID: <20261130140425.322090-2-rjarry@redhat.com> (raw)
In-Reply-To: <20261130122929.246502-2-rjarry@redhat.com>

GCC 14 and 16 at -O0 report -Wstringop-overread for a 24-byte
enqueue item, and GCC 14 reports -Wstringop-overflow for an
8-byte dequeue destination. Both warnings come from 32-byte copies
in unreachable 128-bit paths of inlined ring operations. The
unoptimized-build warning flag does not cover applications compiling
DPDK headers, and the header-local suppression is gone.

Split each pair into 16-byte copies to avoid these false warnings
without suppressing diagnostics for applications.

Fixes: 812a18c167f4 ("build: disable GCC string op warnings when unoptimized")
Cc: stable@dpdk.org
Signed-off-by: Robin Jarry <rjarry@redhat.com>
---

Notes:
    v2: also fix the dequeue path

 lib/ring/rte_ring_elem_pvt.h | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/lib/ring/rte_ring_elem_pvt.h b/lib/ring/rte_ring_elem_pvt.h
index 404bf1d8d24e..b3552fe5df91 100644
--- a/lib/ring/rte_ring_elem_pvt.h
+++ b/lib/ring/rte_ring_elem_pvt.h
@@ -98,9 +98,12 @@ __rte_ring_enqueue_elems_128(void *ring_table, const void *obj_table,
 	const rte_int128_t *obj = (const rte_int128_t *)obj_table;
 
 	if (likely(idx + n <= size)) {
-		for (i = 0; i < (n & ~0x1); i += 2, idx += 2)
+		for (i = 0; i < (n & ~0x1); i += 2, idx += 2) {
 			memcpy((void *)(ring + idx),
-				(const void *)(obj + i), 32);
+				(const void *)(obj + i), 16);
+			memcpy((void *)(ring + idx + 1),
+				(const void *)(obj + i + 1), 16);
+		}
 		switch (n & 0x1) {
 		case 1:
 			memcpy((void *)(ring + idx),
@@ -240,8 +243,10 @@ __rte_ring_dequeue_elems_128(void *obj_table, const void *ring_table,
 	const rte_int128_t *ring = (const rte_int128_t *)ring_table;
 
 	if (likely(idx + n <= size)) {
-		for (i = 0; i < (n & ~0x1); i += 2, idx += 2)
-			memcpy((obj + i), (const void *)(ring + idx), 32);
+		for (i = 0; i < (n & ~0x1); i += 2, idx += 2) {
+			memcpy((obj + i), (const void *)(ring + idx), 16);
+			memcpy((obj + i + 1), (const void *)(ring + idx + 1), 16);
+		}
 		switch (n & 0x1) {
 		case 1:
 			memcpy((obj + i), (const void *)(ring + idx), 16);
-- 
2.56.1


  reply	other threads:[~2026-11-30 14:04 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-30 12:29 [PATCH dpdk] ring: split 128-bit pair copies for unoptimized GCC Robin Jarry
2026-11-30 14:04 ` Robin Jarry [this message]
2026-11-30 14:04 ` Morten Brørup
2026-11-30 14:14 ` Bruce Richardson
2026-11-30 15:57   ` Robin Jarry
2026-11-30 14:33 ` Morten Brørup
2026-12-01  9:01 ` [PATCH dpdk v3] ring: suppress unoptimized GCC string warnings locally Robin Jarry
2026-12-01  9:08   ` Morten Brørup

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=20261130140425.322090-2-rjarry@redhat.com \
    --to=rjarry@redhat.com \
    --cc=dev@dpdk.org \
    --cc=konstantin.ananyev@huawei.com \
    --cc=mb@smartsharesystems.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