[PATCH v2 2/2] app/dma-perf: fix infinite loop

Dengdui Huang huangdengdui at huawei.com
Thu Mar 27 10:01:16 CET 2025


When a core that is not used by the rte is specified in the config
for testing, the problem of infinite loop occurs. This patch fix it
by adding a check for lcore_id.

Fixes: 623dc9364dc6 ("app/dma-perf: introduce DMA performance test")
Cc: stable at dpdk.org

Signed-off-by: Dengdui Huang <huangdengdui at huawei.com>
---
 app/test-dma-perf/main.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/app/test-dma-perf/main.c b/app/test-dma-perf/main.c
index 0586b3e1d0..1365456dd1 100644
--- a/app/test-dma-perf/main.c
+++ b/app/test-dma-perf/main.c
@@ -523,7 +523,7 @@ main(int argc, char *argv[])
 {
 	int ret;
 	uint16_t case_nb;
-	uint32_t i, nb_lcores;
+	uint32_t i, j, nb_lcores, lcore;
 	pid_t cpid, wpid;
 	int wstatus;
 	char args[MAX_EAL_PARAM_NB][MAX_EAL_PARAM_LEN];
@@ -603,6 +603,12 @@ main(int argc, char *argv[])
 			if (nb_lcores < 2)
 				rte_exit(EXIT_FAILURE,
 					"There should be at least 2 worker lcores.\n");
+			for (j = 0; j < test_cases[i].num_worker; j++) {
+				lcore = test_cases[i].dma_config[j].lcore_dma_map.lcore;
+				if (!rte_lcore_has_role(lcore, ROLE_RTE))
+					rte_exit(EXIT_FAILURE,
+						 "Worker lcore %u not enabled in EAL\n", lcore);
+			}
 
 			fd = fopen(rst_path_ptr, "a");
 			if (!fd) {
-- 
2.33.0



More information about the dev mailing list