patch 'test/latency: fix intermittent failure on slow platforms' has been queued to stable release 25.11.3
Kevin Traynor
ktraynor at redhat.com
Thu Jul 23 19:15:37 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/e676bd868cd983380f7b7c9d3454936a8efc46bc
Thanks.
Kevin
---
>From e676bd868cd983380f7b7c9d3454936a8efc46bc Mon Sep 17 00:00:00 2001
From: Stephen Hemminger <stephen at networkplumber.org>
Date: Sun, 31 May 2026 11:01:18 -0700
Subject: [PATCH] test/latency: fix intermittent failure on slow platforms
[ upstream commit feb15ecd65e7c916a547d1e5471c159e7276c4c5 ]
The forwarding loop was bounded by a fixed interval of 0.5ms
but on slow or emulated platforms with a low-frequency timebase
(e.g. RISC-V rdtime) this fails because the loop only ran once.
The test needs two iterations to get any samples.
Rearrange the forwarding loop so that a minimum number of iterations
are required. The loop still has an upper bound on packets and time
interval which is expanded to 10 ms.
If no samples are collected, mark the test as skipped.
Refactor the forwarding loop test so that cleanup happens on
failure.
Fixes: b34508b9cbcd ("test/latency: update with more checks")
Reported-by: Luca Boccassi <luca.boccassi at gmail.com>
Signed-off-by: Stephen Hemminger <stephen at networkplumber.org>
Acked-by: Luca Boccassi <luca.boccassi at gmail.com>
---
app/test/test_latencystats.c | 75 ++++++++++++++++++++++--------------
1 file changed, 46 insertions(+), 29 deletions(-)
diff --git a/app/test/test_latencystats.c b/app/test/test_latencystats.c
index ad0237ce78..034a925a8a 100644
--- a/app/test/test_latencystats.c
+++ b/app/test/test_latencystats.c
@@ -17,4 +17,8 @@
#define NUM_STATS 5
#define LATENCY_NUM_PACKETS 10
+#define LATENCY_FORWARD_ITERATIONS 10000u
+#define LATENCY_FORWARD_MS 10u
+#define MIN_ITERATIONS 10u
+
#define QUEUE_ID 0
@@ -141,26 +145,11 @@ static void test_latency_ring_free(void)
}
-static int test_latency_packet_forward(void)
+static int test_forward_loop(uint16_t portid, struct rte_mbuf *pbuf[LATENCY_NUM_PACKETS])
{
- unsigned int i;
- int ret;
- struct rte_mbuf *pbuf[LATENCY_NUM_PACKETS] = { };
- struct rte_mempool *mp;
- char poolname[] = "mbuf_pool";
+ unsigned int i, iters = 0;
uint64_t end_cycles;
struct rte_metric_value values[NUM_STATS] = { };
struct rte_metric_name names[NUM_STATS] = { };
-
- ret = test_get_mbuf_from_pool(&mp, pbuf, poolname);
- if (ret < 0) {
- printf("allocate mbuf pool Failed\n");
- return TEST_FAILED;
- }
- ret = test_dev_start(portid, mp);
- if (ret < 0) {
- printf("test_dev_start(%hu, %p) failed, error code: %d\n",
- portid, mp, ret);
- return TEST_FAILED;
- }
+ int ret;
ret = rte_latencystats_get_names(names, NUM_STATS);
@@ -171,25 +160,29 @@ static int test_latency_packet_forward(void)
TEST_ASSERT(values[4].value == 0, "Samples not zero at start of test");
- /*
- * Want test to run long enough to collect sufficient samples
- * but not so long that scheduler decides to reschedule it (1000 hz).
- */
- end_cycles = rte_rdtsc() + rte_get_tsc_hz() / 2000;
- do {
+ /* Want test to run long enough to collect sufficient samples */
+ end_cycles = rte_rdtsc() + rte_get_tsc_hz() / MS_PER_S * LATENCY_FORWARD_MS;
+ for (i = 0; i < LATENCY_FORWARD_ITERATIONS; i++) {
ret = test_packet_forward(pbuf, portid, QUEUE_ID);
if (ret < 0)
printf("send pkts Failed\n");
- } while (rte_rdtsc() < end_cycles);
+
+ if (++iters >= MIN_ITERATIONS && rte_rdtsc() >= end_cycles)
+ break;
+ }
ret = rte_latencystats_get(values, NUM_STATS);
TEST_ASSERT(ret == NUM_STATS, "Test failed to get results after forwarding");
+ if (values[4].value == 0) {
+ printf("No latency samples collected after %u iterations, skipping\n", iters);
+ return TEST_SKIPPED;
+ }
+
for (i = 0; i < NUM_STATS; i++) {
uint16_t k = values[i].key;
- printf("%s = %"PRIu64"\n",
- names[k].name, values[i].value);
+ printf("%s = %"PRIu64"\n", names[k].name, values[i].value);
}
-
+ fflush(stdout);
TEST_ASSERT(values[4].value > 0, "No samples taken");
@@ -197,9 +190,33 @@ static int test_latency_packet_forward(void)
TEST_ASSERT(values[0].value < values[2].value, "Min latency > Max latency");
TEST_ASSERT(values[1].value < values[2].value, "Avg latency > Max latency");
+ return TEST_SUCCESS;
+}
+
+static int test_latency_packet_forward(void)
+{
+ struct rte_mempool *mp = NULL;
+ char poolname[] = "mbuf_pool";
+ struct rte_mbuf *pbuf[LATENCY_NUM_PACKETS] = { };
+ int ret;
+
+ ret = test_get_mbuf_from_pool(&mp, pbuf, poolname);
+ if (ret < 0) {
+ printf("allocate mbuf pool Failed\n");
+ return TEST_FAILED;
+ }
+
+ ret = test_dev_start(portid, mp);
+ if (ret < 0) {
+ printf("test_dev_start(%hu, %p) failed, error code: %d\n",
+ portid, mp, ret);
+ ret = TEST_FAILED;
+ } else {
+ ret = test_forward_loop(portid, pbuf);
+ }
rte_eth_dev_stop(portid);
test_put_mbuf_to_pool(mp, pbuf);
- return (ret >= 0) ? TEST_SUCCESS : TEST_FAILED;
+ return ret;
}
--
2.55.0
---
Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- - 2026-07-23 17:58:00.779016016 +0100
+++ 0074-test-latency-fix-intermittent-failure-on-slow-platfo.patch 2026-07-23 17:57:58.688721441 +0100
@@ -1 +1 @@
-From feb15ecd65e7c916a547d1e5471c159e7276c4c5 Mon Sep 17 00:00:00 2001
+From e676bd868cd983380f7b7c9d3454936a8efc46bc Mon Sep 17 00:00:00 2001
@@ -5,0 +6,2 @@
+[ upstream commit feb15ecd65e7c916a547d1e5471c159e7276c4c5 ]
+
@@ -20 +21,0 @@
-Cc: stable at dpdk.org
@@ -30 +31 @@
-index e0483e3e4f..76498b66b4 100644
+index ad0237ce78..034a925a8a 100644
More information about the stable
mailing list