DPDK-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] spinlock: remove volatile qualifier
@ 2026-05-04  8:37 Thomas Monjalon
  2026-05-04  9:06 ` Thomas Monjalon
  2026-05-04 17:02 ` [PATCH] spinlock: remove volatile qualifier Stephen Hemminger
  0 siblings, 2 replies; 7+ messages in thread
From: Thomas Monjalon @ 2026-05-04  8:37 UTC (permalink / raw)
  To: dev; +Cc: stable

The user and count fields of rte_spinlock_recursive_t
do not need the volatile qualifier
because they are only accessed by the thread holding the lock,
which already provides the necessary memory ordering.

Removing volatile aligns with a C++20 deprecation
for increment and decrement of volatile variables.

This issue was seen with GCC 16 which changes the default C++ version
from -std=gnu++17 to -std=gnu++20.

Fixes: af75078fece3 ("first public release")
Cc: stable@dpdk.org

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
---
 lib/eal/include/generic/rte_spinlock.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/eal/include/generic/rte_spinlock.h b/lib/eal/include/generic/rte_spinlock.h
index c907d4e45c..19c0e34f0a 100644
--- a/lib/eal/include/generic/rte_spinlock.h
+++ b/lib/eal/include/generic/rte_spinlock.h
@@ -197,8 +197,8 @@ 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 */
+	int user; /**< core id using lock, -1 for unused */
+	int count; /**< count of time this lock has been called */
 } rte_spinlock_recursive_t;
 
 /**
-- 
2.54.0


^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2026-05-05 13:24 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-04  8:37 [PATCH] spinlock: remove volatile qualifier Thomas Monjalon
2026-05-04  9:06 ` Thomas Monjalon
2026-05-04  9:12   ` [PATCH] spinlock: fix API comments Thomas Monjalon
2026-05-04 12:46     ` Thomas Monjalon
2026-05-04 17:02 ` [PATCH] spinlock: remove volatile qualifier Stephen Hemminger
2026-05-05  7:01   ` Thomas Monjalon
2026-05-05 13:24     ` Stephen Hemminger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox