|SUCCESS| pw169219 [PATCH v5 08/17] eal: warn if thread name is truncated
0-day Robot
robot at bytheb.org
Tue Dec 16 17:12:14 CET 2025
Test-Label: 0day Robot - Claude SONNET
Test-Status: SUCCESS
http://dpdk.org/patch/159219
_AI Review Comments Available_
Looking at this patch, I have a few questions about the consistency and
implementation of the thread name truncation handling.
Git SHA: 20251207191242.165619-9-stephen at networkplumber.org
Author: Stephen Hemminger <stephen at networkplumber.org>
Subject: eal: warn if thread name is truncated
This patch adds warning messages when thread names get truncated due to
length limits, specifically for the dpdk-worker-%d pattern that can
overflow with more than 9999 worker cores.
> diff --git a/lib/eal/freebsd/eal.c b/lib/eal/freebsd/eal.c
> index 6215245ad5..beda7e0c5c 100644
> --- a/lib/eal/freebsd/eal.c
> +++ b/lib/eal/freebsd/eal.c
> @@ -690,8 +690,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 >= (int)sizeof(thread_name))
> + EAL_LOG(INFO, "Worker thread name %s truncated", thread_name);
> +
> rte_thread_set_name(lcore_config[i].thread_id, thread_name);
[ ... ]
> 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);
[ ... ]
> diff --git a/lib/eal/windows/eal.c b/lib/eal/windows/eal.c
> index 21fe7cb1d9..8b539f8601 100644
> --- a/lib/eal/windows/eal.c
> +++ b/lib/eal/windows/eal.c
> @@ -378,8 +378,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 >= (int)sizeof(thread_name))
> + EAL_LOG(INFO, "Worker thread name %s truncated", thread_name);
> +
> rte_thread_set_name(lcore_config[i].thread_id, thread_name);
Why does the Linux implementation check against RTE_THREAD_NAME_SIZE while
FreeBSD and Windows use sizeof(thread_name)? Should all platforms use the
same constant for consistency?
Does the logic make sense to log thread_name after truncation? The logged
name will already be truncated, so it won't show what the intended full
name was supposed to be.
Could this create confusion in debugging since you're logging the
truncated name rather than the original intended name?
More information about the test-report
mailing list