patch 'spinlock: remove volatile qualifier' has been queued to stable release 25.11.3

Kevin Traynor ktraynor at redhat.com
Thu Jul 23 19:14:31 CEST 2026


Hi,

FYI, your patch has been queued to stable release 25.11.3

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 07/27/26. So please
shout if anyone has objections.

Also note that after the patch there's a diff of the upstream commit vs the
patch applied to the branch. This will indicate if there was any rebasing
needed to apply to the stable branch. If there were code changes for rebasing
(ie: not only metadata diffs), please double check that the rebase was
correctly done.

Queued patches are on a temporary branch at:
https://github.com/kevintraynor/dpdk-stable

This queued commit can be viewed at:
https://github.com/kevintraynor/dpdk-stable/commit/4328a8cbe9d2e89e7897c18c0c34359bb843dabd

Thanks.

Kevin

---
>From 4328a8cbe9d2e89e7897c18c0c34359bb843dabd Mon Sep 17 00:00:00 2001
From: Thomas Monjalon <thomas at monjalon.net>
Date: Tue, 19 May 2026 12:34:14 +0200
Subject: [PATCH] spinlock: remove volatile qualifier

[ upstream commit 85af443ef8b55475da3f0f28e678fad5faf14d03 ]

When compiling with C++20 standard requirement (default in GCC 16),
the increment and decrement of volatile variables are rejected:

rte_spinlock.h:241:14: error:
	'++' expression of 'volatile'-qualified type is deprecated
rte_spinlock.h:252:21: error:
	'--' expression of 'volatile'-qualified type is deprecated
rte_spinlock.h:278:14: error:
	'++' expression of 'volatile'-qualified type is deprecated

The count field of rte_spinlock_recursive_t
does not need the volatile qualifier
because it is only accessed by the thread holding the lock,
which already provides the necessary memory ordering.

The user field can be accessed outside of the lock,
so it must handled as a C11 atomic variable.
The name is also changed from user to owner.
It will break if an application is accessing this field directly,
which should never happen.

Fixes: af75078fece3 ("first public release")

Signed-off-by: Thomas Monjalon <thomas at monjalon.net>
Acked-by: Bruce Richardson <bruce.richardson at intel.com>
Acked-by: Stephen Hemminger <stephen at networkplumber.org>
---
 lib/eal/include/generic/rte_spinlock.h | 17 ++++++++---------
 1 file changed, 8 insertions(+), 9 deletions(-)

diff --git a/lib/eal/include/generic/rte_spinlock.h b/lib/eal/include/generic/rte_spinlock.h
index c907d4e45c..ffdcb8fa3d 100644
--- a/lib/eal/include/generic/rte_spinlock.h
+++ b/lib/eal/include/generic/rte_spinlock.h
@@ -198,6 +198,6 @@ rte_spinlock_trylock_tm(rte_spinlock_t *sl)
 typedef struct {
 	rte_spinlock_t sl; /**< the actual spinlock */
-	volatile int user; /**< core id using lock, -1 for unused */
-	volatile int count; /**< count of time this lock has been called */
+	RTE_ATOMIC(int) owner; /**< core id using lock, -1 for unused */
+	int count; /**< count of time this lock has been called */
 } rte_spinlock_recursive_t;
 
@@ -216,5 +216,5 @@ static inline void rte_spinlock_recursive_init(rte_spinlock_recursive_t *slr)
 {
 	rte_spinlock_init(&slr->sl);
-	slr->user = -1;
+	rte_atomic_store_explicit(&slr->owner, -1, rte_memory_order_relaxed);
 	slr->count = 0;
 }
@@ -231,7 +231,7 @@ static inline void rte_spinlock_recursive_lock(rte_spinlock_recursive_t *slr)
 	int id = rte_gettid();
 
-	if (slr->user != id) {
+	if (rte_atomic_load_explicit(&slr->owner, rte_memory_order_relaxed) != id) {
 		rte_spinlock_lock(&slr->sl);
-		slr->user = id;
+		rte_atomic_store_explicit(&slr->owner, id, rte_memory_order_relaxed);
 	}
 	slr->count++;
@@ -247,8 +247,7 @@ static inline void rte_spinlock_recursive_unlock(rte_spinlock_recursive_t *slr)
 {
 	if (--(slr->count) == 0) {
-		slr->user = -1;
+		rte_atomic_store_explicit(&slr->owner, -1, rte_memory_order_relaxed);
 		rte_spinlock_unlock(&slr->sl);
 	}
-
 }
 
@@ -267,8 +266,8 @@ static inline int rte_spinlock_recursive_trylock(rte_spinlock_recursive_t *slr)
 	int id = rte_gettid();
 
-	if (slr->user != id) {
+	if (rte_atomic_load_explicit(&slr->owner, rte_memory_order_relaxed) != id) {
 		if (rte_spinlock_trylock(&slr->sl) == 0)
 			return 0;
-		slr->user = id;
+		rte_atomic_store_explicit(&slr->owner, id, rte_memory_order_relaxed);
 	}
 	slr->count++;
-- 
2.55.0

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2026-07-23 17:57:58.949689358 +0100
+++ 0008-spinlock-remove-volatile-qualifier.patch	2026-07-23 17:57:58.629438747 +0100
@@ -1 +1 @@
-From 85af443ef8b55475da3f0f28e678fad5faf14d03 Mon Sep 17 00:00:00 2001
+From 4328a8cbe9d2e89e7897c18c0c34359bb843dabd Mon Sep 17 00:00:00 2001
@@ -5,0 +6,2 @@
+[ upstream commit 85af443ef8b55475da3f0f28e678fad5faf14d03 ]
+
@@ -28 +29,0 @@
-Cc: stable at dpdk.org



More information about the stable mailing list