patch 'test/timer: replace volatile with C11 atomics' has been queued to stable release 25.11.1
Kevin Traynor
ktraynor at redhat.com
Thu Mar 19 11:03:15 CET 2026
Hi,
FYI, your patch has been queued to stable release 25.11.1
Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 03/23/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/bd03dcdd53df15387022fb934fdfed8fc7ae867c
Thanks.
Kevin
---
>From bd03dcdd53df15387022fb934fdfed8fc7ae867c Mon Sep 17 00:00:00 2001
From: Stephen Hemminger <stephen at networkplumber.org>
Date: Thu, 5 Mar 2026 09:51:00 -0800
Subject: [PATCH] test/timer: replace volatile with C11 atomics
[ upstream commit 5e52e43cdf823a9c59199eed40413e2bd5e9c09a ]
Replace volatile variables in test_timer_secondary shared memory
structure with RTE_ATOMIC() and rte_atomic_*_explicit() operations.
Change expected_count and expired_count from int to unsigned int
since they are non-negative counters.
Fixes: 50247fe03fe0 ("test/timer: exercise new APIs in secondary process")
Signed-off-by: Stephen Hemminger <stephen at networkplumber.org>
---
app/test/test_timer_secondary.c | 28 +++++++++++++++++++---------
1 file changed, 19 insertions(+), 9 deletions(-)
diff --git a/app/test/test_timer_secondary.c b/app/test/test_timer_secondary.c
index d85878dc5b..7d146edefb 100644
--- a/app/test/test_timer_secondary.c
+++ b/app/test/test_timer_secondary.c
@@ -13,5 +13,7 @@
#include <rte_cycles.h>
#include <rte_mempool.h>
+#include <rte_pause.h>
#include <rte_random.h>
+#include <rte_stdatomic.h>
#include "test.h"
@@ -42,10 +44,10 @@ struct test_info {
unsigned int num_timers;
uint32_t timer_data_id;
- volatile int expected_count;
- volatile int expired_count;
+ RTE_ATOMIC(unsigned int) expected_count;
+ RTE_ATOMIC(unsigned int) expired_count;
struct rte_mempool *tim_mempool;
struct rte_timer *expired_timers[NUM_TIMERS_MAX];
int expired_timers_idx;
- volatile int exit_flag;
+ RTE_ATOMIC(int) exit_flag;
};
@@ -81,5 +83,6 @@ handle_expired_timer(struct rte_timer *tim)
struct test_info *test_info = tim->arg;
- test_info->expired_count++;
+ rte_atomic_fetch_add_explicit(&test_info->expired_count, 1,
+ rte_memory_order_relaxed);
test_info->expired_timers[test_info->expired_timers_idx++] = tim;
}
@@ -93,5 +96,6 @@ timer_manage_loop(void *arg)
struct test_info *test_info = arg;
- while (!test_info->exit_flag) {
+ while (!rte_atomic_load_explicit(&test_info->exit_flag,
+ rte_memory_order_acquire)) {
cur_tsc = rte_rdtsc();
diff_tsc = cur_tsc - prev_tsc;
@@ -168,5 +172,6 @@ test_timer_secondary(void)
rte_delay_ms(2000);
- test_info->exit_flag = 1;
+ rte_atomic_store_explicit(&test_info->exit_flag, 1,
+ rte_memory_order_release);
TEST_ASSERT_SUCCESS(ret, "Secondary process execution failed");
@@ -177,5 +182,8 @@ test_timer_secondary(void)
#endif
- return test_info->expected_count == test_info->expired_count ?
+ return rte_atomic_load_explicit(&test_info->expected_count,
+ rte_memory_order_relaxed) ==
+ rte_atomic_load_explicit(&test_info->expired_count,
+ rte_memory_order_relaxed) ?
TEST_SUCCESS : TEST_FAILED;
@@ -207,5 +215,6 @@ test_timer_secondary(void)
return TEST_FAILED;
- test_info->expected_count++;
+ rte_atomic_fetch_add_explicit(&test_info->expected_count,
+ 1, rte_memory_order_relaxed);
/* randomly leave timer running or stop it */
@@ -216,5 +225,6 @@ test_timer_secondary(void)
tim);
if (ret == 0) {
- test_info->expected_count--;
+ rte_atomic_fetch_sub_explicit(&test_info->expected_count,
+ 1, rte_memory_order_relaxed);
rte_mempool_put(test_info->tim_mempool,
(void *)tim);
--
2.53.0
---
Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- - 2026-03-19 10:01:09.287111107 +0000
+++ 0077-test-timer-replace-volatile-with-C11-atomics.patch 2026-03-19 10:01:07.131185030 +0000
@@ -1 +1 @@
-From 5e52e43cdf823a9c59199eed40413e2bd5e9c09a Mon Sep 17 00:00:00 2001
+From bd03dcdd53df15387022fb934fdfed8fc7ae867c Mon Sep 17 00:00:00 2001
@@ -5,0 +6,2 @@
+[ upstream commit 5e52e43cdf823a9c59199eed40413e2bd5e9c09a ]
+
@@ -13 +14,0 @@
-Cc: stable at dpdk.org
@@ -21 +22 @@
-index c80dee9c6c..57ab39130d 100644
+index d85878dc5b..7d146edefb 100644
@@ -46 +47 @@
-@@ -77,5 +79,6 @@ handle_expired_timer(struct rte_timer *tim)
+@@ -81,5 +83,6 @@ handle_expired_timer(struct rte_timer *tim)
@@ -54 +55 @@
-@@ -89,5 +92,6 @@ timer_manage_loop(void *arg)
+@@ -93,5 +96,6 @@ timer_manage_loop(void *arg)
@@ -62 +63 @@
-@@ -164,5 +168,6 @@ test_timer_secondary(void)
+@@ -168,5 +172,6 @@ test_timer_secondary(void)
@@ -64 +65 @@
- rte_delay_ms(500);
+ rte_delay_ms(2000);
@@ -70 +71 @@
-@@ -173,5 +178,8 @@ test_timer_secondary(void)
+@@ -177,5 +182,8 @@ test_timer_secondary(void)
@@ -80 +81 @@
-@@ -203,5 +211,6 @@ test_timer_secondary(void)
+@@ -207,5 +215,6 @@ test_timer_secondary(void)
@@ -88 +89 @@
-@@ -212,5 +221,6 @@ test_timer_secondary(void)
+@@ -216,5 +225,6 @@ test_timer_secondary(void)
More information about the stable
mailing list