[PATCH v3 07/16] eal: warn if thread name is truncated
Stephen Hemminger
stephen at networkplumber.org
Fri Dec 5 21:11:36 CET 2025
Thread name is very short 16 characters and therefore the name
dpdk-worker-%d will overflow with more than 9999 worker cores.
Error should be non-fatal since name only matters for debug.
Signed-off-by: Stephen Hemminger <stephen at networkplumber.org>
Acked-by: Bruce Richardson <bruce.richardson at intel.com>
---
lib/eal/linux/eal.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/lib/eal/linux/eal.c b/lib/eal/linux/eal.c
index b12f325ddd..d848de03d8 100644
--- a/lib/eal/linux/eal.c
+++ b/lib/eal/linux/eal.c
@@ -863,8 +863,10 @@ rte_eal_init(int argc, char **argv)
rte_panic("Cannot create thread\n");
/* Set thread_name for aid in debugging. */
- snprintf(thread_name, sizeof(thread_name),
- "dpdk-worker%d", i);
+ ret = snprintf(thread_name, sizeof(thread_name), "dpdk-worker%d", i);
+ if (ret >= RTE_THREAD_NAME_SIZE)
+ EAL_LOG(INFO, "Worker thread name %s truncated", thread_name);
+
rte_thread_set_name(lcore_config[i].thread_id, thread_name);
ret = rte_thread_set_affinity_by_id(lcore_config[i].thread_id,
--
2.51.0
More information about the dev
mailing list