Re: [RFC v2 06/14] eal: warn if thread name is truncated

Bruce Richardson
2025-12-05T08:32:46Z

On Thu, Dec 04, 2025 at 06:28:15PM -0800, Stephen Hemminger wrote:
> 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@networkplumber.org>
> ---

Can't see this issue being hit any time soon, but no harm.

Acked-by: Bruce Richardson <bruce.richardson@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
>