[PATCH v6 1/1] examples/l2fwd-jobstats: fix timer stats display with lock contention
rkudurumalla
rkudurumalla at marvell.com
Mon Mar 2 07:18:05 CET 2026
From: Rakesh Kudurumalla <rkudurumalla at marvell.com>
Race condition between jobstats and time metrics
for forwarding and flushing is maintained using spinlock.
Timer metrics are not displayed properly due to the
frequent unavailability of the lock.
This patch fixes the issue by introducing a delay before
acquiring the lock in the loop. This delay allows for better
availability of the lock, ensuring that show_lcore_stats() can
periodically update the statistics even when forwarding
jobs are running.
Fixes: 204896f8d66c ("examples/l2fwd-jobstats: add new example")
Cc: stable at dpdk.org
Signed-off-by: Rakesh Kudurumalla <rkudurumalla at marvell.com>
---
examples/l2fwd-jobstats/main.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/examples/l2fwd-jobstats/main.c b/examples/l2fwd-jobstats/main.c
index a7cd5b4840..036bd4f951 100644
--- a/examples/l2fwd-jobstats/main.c
+++ b/examples/l2fwd-jobstats/main.c
@@ -541,7 +541,9 @@ l2fwd_main_loop(void)
} while (likely(stats_read_pending == 0));
rte_spinlock_unlock(&qconf->lock);
- rte_pause();
+ while (rte_atomic_load_explicit(&qconf->stats_read_pending,
+ rte_memory_order_relaxed) != 0)
+ rte_pause();
}
/* >8 End of minimize impact of stats reading. */
}
--
2.25.1
More information about the dev
mailing list