set namespace prefix to threads
Subsystems (4)
PATCH 1/1 set namespace prefix to threads
When looking at threads in a system, it can be confusing to find some unknown threads without a clue it is started by DPDK.
Let's start all thread names with "dpdk-"
and the driver name if it comes from a driver.
One more constraint: the thread names are generally limited to 16 characters, including NUL character.
---
Please review carefully, I may have missed things.
Note: we should use rte_ctrl_thread_create() as much as possible.
--- app/test/test_lcores.c | 2 +- drivers/event/dlb2/pf/base/dlb2_osdep.h | 2 +- drivers/net/ark/ark_ethdev.c | 4 ++-- drivers/net/ipn3ke/ipn3ke_representor.c | 2 +- drivers/net/kni/rte_eth_kni.c | 2 +- drivers/net/mlx5/mlx5_hws_cnt.c | 2 +- drivers/net/sfc/sfc_mae_counter.c | 2 +- drivers/raw/ifpga/ifpga_rawdev.c | 2 +- drivers/vdpa/ifc/ifcvf_vdpa.c | 6 +++--- drivers/vdpa/mlx5/mlx5_vdpa_cthread.c | 2 +- drivers/vdpa/mlx5/mlx5_vdpa_event.c | 2 +- examples/vhost/main.c | 4 ++-- examples/vhost_blk/vhost_blk.c | 2 +- lib/eal/common/eal_common_proc.c | 2 +- lib/eal/freebsd/eal.c | 2 +- lib/eal/freebsd/eal_interrupts.c | 2 +- lib/eal/linux/eal.c | 2 +- lib/eal/linux/eal_interrupts.c | 2 +- lib/eal/linux/eal_timer.c | 2 +- lib/eal/windows/eal.c | 2 +- lib/eventdev/rte_event_eth_rx_adapter.c | 2 +- lib/telemetry/telemetry.c | 4 ++-- lib/vhost/socket.c | 4 ++-- lib/vhost/vduse.c | 2 +- 24 files changed, 30 insertions(+), 30 deletions(-)
app/test/test_lcores.c +1 -1
@@ -362,7 +362,7 @@ test_ctrl_thread(void)/* Create one control thread */ t = &ctrl_thread_context; t->state = Thread_INIT; -if (rte_ctrl_thread_create ((pthread_t *)&t->id,"test_ctrl_threads" , +if (rte_ctrl_thread_create ((pthread_t *)&t->id,"dpdk-test-ctrlt" ,NULL , ctrl_thread_loop, t) !=0 )return -1 ;
drivers/event/dlb2/pf/base/dlb2_osdep.h +1 -1
@@ -200,7 +200,7 @@ static inline void os_schedule_work(struct dlb2_hw *hw) dlb2_dev = container_of(hw, struct dlb2_dev, hw); ret =rte_ctrl_thread_create (&complete_queue_map_unmap_thread, -"dlb_queue_unmap_waiter" , +"dpdk-dlb-qunmap" ,NULL , dlb2_complete_queue_map_unmap, dlb2_dev);
drivers/net/ark/ark_ethdev.c +2 -2
@@ -600,11 +600,11 @@ eth_ark_dev_start(struct rte_eth_dev *dev)if (!ark->isvf && ark->start_pg && !ark->pg_running) {pthread_t thread; -/* Delay packet generatpr start allow the hardware to be ready +/* Delay packet generator start allow the hardware to be ready * This is only used for sanity checking with internal generator */ char tname[32 ]; -snprintf (tname,sizeof (tname),"ark-delay-pg-%d" , +snprintf (tname,sizeof (tname),"dpdk-ark-pg%d" , dev->data->port_id); if (rte_ctrl_thread_create(&thread, tname, NULL,
drivers/net/ipn3ke/ipn3ke_representor.c +1 -1
@@ -2593,7 +2593,7 @@ ipn3ke_rpst_scan_check(void)if (ipn3ke_rpst_scan_num ==1 ) { ret =rte_ctrl_thread_create (&ipn3ke_rpst_scan_thread, -"ipn3ke scanner" , +"dpdk-ipn3ke-scn" ,NULL , ipn3ke_rpst_scan_handle_request,NULL );if (ret) {
drivers/net/kni/rte_eth_kni.c +1 -1
@@ -163,7 +163,7 @@ eth_kni_dev_start(struct rte_eth_dev *dev) internals->stop_thread =0 ; ret =rte_ctrl_thread_create (&internals->thread, -"kni_handle_req" ,NULL , +"dpdk-kni-req" ,NULL , kni_handle_request, internals);if (ret) { PMD_LOG(ERR,
drivers/net/mlx5/mlx5_hws_cnt.c +1 -1
@@ -453,7 +453,7 @@ mlx5_hws_cnt_service_thread_create(struct mlx5_dev_ctx_shared *sh)DRV_LOG (ERR ,"Failed to create HW steering's counter service thread." );return -ENOSYS ; } -snprintf (name,CNT_THREAD_NAME_MAX -1 ,"%s/svc@%d" , +snprintf (name,CNT_THREAD_NAME_MAX -1 ,"dpdk-mlx5-hws-%s/svc@%d" , sh->ibdev_name, service_core);rte_thread_set_name ((rte_thread_t ){(uintptr_t )sh->cnt_svc->service_thread}, name);
drivers/net/sfc/sfc_mae_counter.c +1 -1
@@ -711,7 +711,7 @@ sfc_mae_counter_thread_spawn(struct sfc_adapter *sa, counter_registry->polling.thread.run = true; rc =rte_ctrl_thread_create (&sa->mae.counter_registry.polling.thread.id, -"mae_counter_thread" ,NULL , +"dpdk-sfc-maecnt" ,NULL , sfc_mae_counter_thread, sa);return rc;
drivers/raw/ifpga/ifpga_rawdev.c +1 -1
@@ -551,7 +551,7 @@ ifpga_monitor_start_func(struct ifpga_rawdev *dev)if (!__atomic_fetch_add (&ifpga_monitor_refcnt,1 , __ATOMIC_RELAXED)) { ret =rte_ctrl_thread_create (&ifpga_monitor_start_thread, -"ifpga-monitor" ,NULL , +"dpdk-ifpga-mon" ,NULL , ifpga_rawdev_gsd_handle,NULL );if (ret !=0 ) { ifpga_monitor_start_thread =0 ;
drivers/vdpa/ifc/ifcvf_vdpa.c +3 -3
@@ -570,7 +570,7 @@ setup_notify_relay(struct ifcvf_internal *internal)char name[THREAD_NAME_LEN ];int ret; -snprintf (name,sizeof (name),"ifc-notify-%d" , internal->vid); +snprintf (name,sizeof (name),"dpdk-ifc-noti%d" , internal->vid); ret =rte_ctrl_thread_create (&internal->tid, name,NULL , notify_relay, (void *)internal);if (ret !=0 ) {
@@ -681,7 +681,7 @@ setup_intr_relay(struct ifcvf_internal *internal)char name[THREAD_NAME_LEN ];int ret; -snprintf (name,sizeof (name),"ifc-intr-%d" , internal->vid); +snprintf (name,sizeof (name),"dpdk-ifc-int%d" , internal->vid); ret =rte_ctrl_thread_create (&internal->intr_tid, name,NULL , intr_relay, (void *)internal);if (ret) {
@@ -1019,7 +1019,7 @@ setup_vring_relay(struct ifcvf_internal *internal)char name[THREAD_NAME_LEN ];int ret; -snprintf (name,sizeof (name),"ifc-vring-%d" , internal->vid); +snprintf (name,sizeof (name),"dpdk-ifc-ring%d" , internal->vid); ret =rte_ctrl_thread_create (&internal->tid, name,NULL , vring_relay, (void *)internal);if (ret !=0 ) {
drivers/vdpa/mlx5/mlx5_vdpa_cthread.c +1 -1
@@ -312,7 +312,7 @@ mlx5_vdpa_c_thread_create(int cpu_core) "vdpa multi-threads %d.", thrd_idx); goto c_thread_err; } -snprintf (name,sizeof (name),"vDPA-mthread-%d" , thrd_idx); +snprintf (name,sizeof (name),"dpdk-vmlx5-c%d" , thrd_idx); ret =pthread_setname_np ( conf_thread_mng.cthrd[thrd_idx].tid, name);if (ret)
drivers/vdpa/mlx5/mlx5_vdpa_event.c +1 -1
@@ -546,7 +546,7 @@ mlx5_vdpa_cqe_event_setup(struct mlx5_vdpa_priv *priv)DRV_LOG (ERR ,"Failed to set thread affinity." ); goto out; } -snprintf (name,sizeof (name),"vDPA-mlx5-%d" , priv->vid); +snprintf (name,sizeof (name),"dpdk-vmlx5-%d" , priv->vid);rte_thread_set_name ((rte_thread_t ){(uintptr_t )priv->timer_tid}, name); out:if (attrp !=NULL )
examples/vhost/main.c +2 -2
@@ -1986,11 +1986,11 @@ main(int argc, char *argv[])/* Enable stats if the user option is set. */ if (enable_stats) { - ret =rte_ctrl_thread_create (&tid,"print-stats" ,NULL , + ret =rte_ctrl_thread_create (&tid,"dpdk-vhost-stat" ,NULL , print_stats,NULL );if (ret <0 )rte_exit (EXIT_FAILURE , -"Cannot create print-stats thread\n" ); +"Cannot create dpdk-vhost-stat thread\n" ); }/* Launch all data cores. */
examples/vhost_blk/vhost_blk.c +1 -1
@@ -686,7 +686,7 @@ new_device(int vid)/* start polling vring */ worker_thread_status =WORKER_STATE_START ;fprintf (stdout,"New Device %s, Device ID %d\n" , path, vid); -if (rte_ctrl_thread_create (&tid,"vhostblk-ctrlr" ,NULL , +if (rte_ctrl_thread_create (&tid,"dpdk-vhost-blk" ,NULL , &ctrlr_worker, ctrlr) !=0 ) {fprintf (stderr,"Worker Thread Started Failed\n" );return -1 ;
lib/eal/common/eal_common_proc.c +1 -1
@@ -635,7 +635,7 @@ rte_mp_channel_init(void)return -1 ; } -if (rte_ctrl_thread_create (&mp_handle_tid,"rte_mp_handle" , +if (rte_ctrl_thread_create (&mp_handle_tid,"dpdk-mp-msg" ,NULL , mp_handle,NULL ) <0 ) {RTE_LOG (ERR ,EAL ,"failed to create mp thread: %s\n" ,strerror (errno));
lib/eal/freebsd/eal.c +1 -1
@@ -843,7 +843,7 @@ rte_eal_init(int argc, char **argv)/* Set thread_name for aid in debugging. */ snprintf (thread_name,sizeof (thread_name), -"rte-worker-%d" , i); +"dpdk-worker-%d" , i);rte_thread_set_name (lcore_config[i].thread_id, thread_name); ret = rte_thread_set_affinity_by_id(lcore_config[i].thread_id,
lib/eal/freebsd/eal_interrupts.c +1 -1
@@ -637,7 +637,7 @@ rte_eal_intr_init(void) }/* create the host thread to wait/handle the interrupt */ - ret =rte_ctrl_thread_create (&intr_thread,"eal-intr-thread" ,NULL , + ret =rte_ctrl_thread_create (&intr_thread,"dpdk-intr" ,NULL , eal_intr_thread_main,NULL );if (ret !=0 ) { rte_errno = -ret;
lib/eal/linux/eal.c +1 -1
@@ -1272,7 +1272,7 @@ rte_eal_init(int argc, char **argv)/* Set thread_name for aid in debugging. */ snprintf (thread_name,sizeof (thread_name), -"rte-worker-%d" , i); +"dpdk-worker-%d" , i);rte_thread_set_name (lcore_config[i].thread_id, thread_name); ret = rte_thread_set_affinity_by_id(lcore_config[i].thread_id,
lib/eal/linux/eal_interrupts.c +1 -1
@@ -1188,7 +1188,7 @@ rte_eal_intr_init(void) }/* create the host thread to wait/handle the interrupt */ - ret =rte_ctrl_thread_create (&intr_thread,"eal-intr-thread" ,NULL , + ret =rte_ctrl_thread_create (&intr_thread,"dpdk-intr" ,NULL , eal_intr_thread_main,NULL );if (ret !=0 ) { rte_errno = -ret;
lib/eal/linux/eal_timer.c +1 -1
@@ -176,7 +176,7 @@ rte_eal_hpet_init(int make_default)/* create a thread that will increment a global variable for * msb (hpet is 32 bits by default under linux) */ - ret =rte_ctrl_thread_create (&msb_inc_thread_id,"hpet-msb-inc" ,NULL , + ret =rte_ctrl_thread_create (&msb_inc_thread_id,"dpdk-hpet-msb" ,NULL , hpet_msb_inc,NULL );if (ret !=0 ) {RTE_LOG (ERR ,EAL ,"ERROR: Cannot create HPET timer thread!\n" );
lib/eal/windows/eal.c +1 -1
@@ -468,7 +468,7 @@ rte_eal_init(int argc, char **argv)/* Set thread name for aid in debugging. */ snprintf (thread_name,sizeof (thread_name), -"rte-worker-%d" , i); +"dpdk-worker-%d" , i);rte_thread_set_name (lcore_config[i].thread_id, thread_name); ret = rte_thread_set_affinity_by_id(lcore_config[i].thread_id,
lib/eventdev/rte_event_eth_rx_adapter.c +1 -1
@@ -1620,7 +1620,7 @@ rxa_create_intr_thread(struct event_eth_rx_adapter *rx_adapter)rte_spinlock_init (&rx_adapter->intr_ring_lock);snprintf (thread_name,RTE_MAX_THREAD_NAME_LEN , -"rx-intr-thread-%d" , rx_adapter->id); +"dpdk-evt-rx%d" , rx_adapter->id); err =rte_ctrl_thread_create (&rx_adapter->rx_intr_thread, thread_name,NULL , rxa_intr_thread, rx_adapter);
lib/telemetry/telemetry.c +2 -2
@@ -563,7 +563,7 @@ telemetry_legacy_init(void)return -1 ; }pthread_setaffinity_np (t_old,sizeof (*thread_cpuset), thread_cpuset); -set_thread_name (t_old,"telemetry-v1" ); +set_thread_name (t_old,"dpdk-telemet-v1" );TMTY_LOG (DEBUG ,"Legacy telemetry socket initialized ok\n" );pthread_detach (t_old);return 0 ;
@@ -617,7 +617,7 @@ telemetry_v2_init(void)return -1 ; }pthread_setaffinity_np (t_new,sizeof (*thread_cpuset), thread_cpuset); -set_thread_name (t_new,"telemetry-v2" ); +set_thread_name (t_new,"dpdk-telemet-v2" );pthread_detach (t_new);atexit (unlink_sockets);
lib/vhost/socket.c +2 -2
@@ -513,7 +513,7 @@ vhost_user_reconnect_init(void) }TAILQ_INIT (&reconn_list.head); - ret =rte_ctrl_thread_create (&reconn_tid,"vhost_reconn" ,NULL , + ret =rte_ctrl_thread_create (&reconn_tid,"dpdk-vhost-reco" ,NULL , vhost_user_client_reconnect,NULL );if (ret !=0 ) {VHOST_LOG_CONFIG ("thread" ,ERR ,"failed to create reconnect thread\n" );
@@ -1239,7 +1239,7 @@ rte_vhost_driver_start(const char *path) }int ret =rte_ctrl_thread_create (&fdset_tid, -"vhost-events" ,NULL , fdset_event_dispatch, +"dpdk-vhost-evts" ,NULL , fdset_event_dispatch, &vhost_user.fdset);if (ret !=0 ) {VHOST_LOG_CONFIG (path,ERR ,"failed to create fdset handling thread\n" );
lib/vhost/vduse.c +1 -1
@@ -455,7 +455,7 @@ vduse_device_create(const char *path)return -1 ; } - ret =rte_ctrl_thread_create (&fdset_tid,"vduse-events" ,NULL , + ret =rte_ctrl_thread_create (&fdset_tid,"dpdk-vduse-evt" ,NULL , fdset_event_dispatch, &vduse.fdset);if (ret !=0 ) {VHOST_LOG_CONFIG (path,ERR ,"failed to create vduse fdset handling thread\n" );
Signature · 1 line
2.41.0
Quoted 9 lines · Thomas Monjalon
When looking at threads in a system, it can be confusing to find some unknown threads without a clue it is started by DPDK.
Let's start all thread names with "dpdk-"
and the driver name if it comes from a driver.One more constraint: the thread names are generally limited to 16 characters, including NUL character.
Yes, and no way to discover this limit.
Quoted 7 lines
Signed-off-by Thomas Monjalon <[email protected]>---
Please review carefully, I may have missed things.Note: we should use
rte_ctrl_thread_create()as much as possible.
As for this comment, we should advertise rte_thread_create_control() instead, as it is thread library agnostic.
Which leads me to suggest looking at rte_thread_create_control() calls too.
lib/eal/freebsd/eal.c rte_eal_init(int argc, char **argv) · line 849
Quoted 13 lines
lib/eal/freebsd/eal.c +1
-1@@ -843,7 +843,7 @@ rte_eal_init(int argc, char **argv)/* Set thread_name for aid in debugging. */ snprintf (thread_name,sizeof (thread_name), -"rte-worker-%d" , i); +"dpdk-worker-%d" , i);rte_thread_set_name (lcore_config[i].thread_id, thread_name); ret = rte_thread_set_affinity_by_id(lcore_config[i].thread_id,
We changed this not so long ago with 8ae946970ed3 ("eal: fix thread name for high order lcores") which offered up to 4 digits for lcores. With your proposal, we are back to only 3 digits, which is probably enough, but I preferred to raise it.
Signature · 1 line
David Marchand
03/07/2023 13:38, David Marchand:
Quoted 19 lines · Thomas Monjalon
Quoted 9 lines
When looking at threads in a system, it can be confusing to find some unknown threads without a clue it is started by DPDK.
Let's start all thread names with "dpdk-"
and the driver name if it comes from a driver.One more constraint: the thread names are generally limited to 16 characters, including NUL character.
Yes, and no way to discover this limit.
Quoted 5 lines
Signed-off-by Thomas Monjalon <[email protected]>---
Please review carefully, I may have missed things.
Quoted 6 lines
Quoted 2 lines
Note: we should use
rte_ctrl_thread_create()as much as possible.As for this comment, we should advertise
rte_thread_create_control()instead, as it is thread library agnostic.
Which leads me to suggest looking atrte_thread_create_control()calls too.
You're right, I'll do a second pass.
Quoted 12 lines
Quoted 12 lines
lib/eal/freebsd/eal.c +1
-1@@ -843,7 +843,7 @@ rte_eal_init(int argc, char **argv)/* Set thread_name for aid in debugging. */ snprintf (thread_name,sizeof (thread_name), -"rte-worker-%d" , i); +"dpdk-worker-%d" , i);rte_thread_set_name (lcore_config[i].thread_id, thread_name);
Quoted 6 lines
lib/eal/freebsd/eal.c rte_eal_init(int argc, char **argv) · line 849
Quoted 1 line
lib/eal/freebsd/eal.c +0
-0ret = rte_thread_set_affinity_by_id(lcore_config[i].thread_id,We changed this not so long ago with
8ae946970ed3("eal: fix thread name for high order lcores") which offered up to 4 digits for lcores. With your proposal, we are back to only 3 digits, which is probably enough, but I preferred to raise it.
In general no need of hyphen before a number.
I will change to dpdk-worker%d.
Quoted 48 lines · Thomas Monjalon
03/07/2023 13:38, David Marchand:
Quoted 19 lines · Thomas Monjalon
Quoted 9 lines
When looking at threads in a system, it can be confusing to find some unknown threads without a clue it is started by DPDK.
Let's start all thread names with "dpdk-"
and the driver name if it comes from a driver.One more constraint: the thread names are generally limited to 16 characters, including NUL character.
Yes, and no way to discover this limit.
Quoted 5 lines
Signed-off-by Thomas Monjalon <[email protected]>---
Please review carefully, I may have missed things.Quoted 6 lines
Quoted 2 lines
Note: we should use
rte_ctrl_thread_create()as much as possible.As for this comment, we should advertise
rte_thread_create_control()instead, as it is thread library agnostic.
Which leads me to suggest looking atrte_thread_create_control()calls too.You're right, I'll do a second pass.
Quoted 12 lines
Quoted 12 lines
lib/eal/freebsd/eal.c +1
-1@@ -843,7 +843,7 @@ rte_eal_init(int argc, char **argv)/* Set thread_name for aid in debugging. */ snprintf (thread_name,sizeof (thread_name), -"rte-worker-%d" , i); +"dpdk-worker-%d" , i);rte_thread_set_name (lcore_config[i].thread_id, thread_name);Quoted 6 lines
lib/eal/freebsd/eal.c rte_eal_init(int argc, char **argv) · line 849
Quoted 1 line
lib/eal/freebsd/eal.c +0
-0ret = rte_thread_set_affinity_by_id(lcore_config[i].thread_id,We changed this not so long ago with
8ae946970ed3("eal: fix thread name for high order lcores") which offered up to 4 digits for lcores. With your proposal, we are back to only 3 digits, which is probably enough, but I preferred to raise it.
Quoted 3 lines
In general no need of hyphen before a number.
I will change to dpdk-worker%d.
While I know that "dpdk-" is probably the clearer prefix, "rte-" is also well-know as the standard API prefix for DPDK. Give we have a 16-char limit, I would suggest keeping using the "rte" prefix on the basis of brevity!
A third alternative is to just use "dp-" as prefix...
/Bruce
17/07/2023 16:09, Bruce Richardson:
Quoted 49 lines · Thomas Monjalon
Quoted 48 lines
03/07/2023 13:38, David Marchand:
Quoted 19 lines · Thomas Monjalon
Quoted 9 lines
When looking at threads in a system, it can be confusing to find some unknown threads without a clue it is started by DPDK.
Let's start all thread names with "dpdk-"
and the driver name if it comes from a driver.One more constraint: the thread names are generally limited to 16 characters, including NUL character.
Yes, and no way to discover this limit.
Quoted 5 lines
Signed-off-by Thomas Monjalon <[email protected]>---
Please review carefully, I may have missed things.Quoted 6 lines
Quoted 2 lines
Note: we should use
rte_ctrl_thread_create()as much as possible.As for this comment, we should advertise
rte_thread_create_control()instead, as it is thread library agnostic.
Which leads me to suggest looking atrte_thread_create_control()calls too.You're right, I'll do a second pass.
Quoted 18 lines
lib/eal/freebsd/eal.c rte_eal_init(int argc, char **argv) · line 849
Quoted 13 lines
lib/eal/freebsd/eal.c +1
-1@@ -843,7 +843,7 @@ rte_eal_init(int argc, char **argv)/* Set thread_name for aid in debugging. */ snprintf (thread_name,sizeof (thread_name), -"rte-worker-%d" , i); +"dpdk-worker-%d" , i);rte_thread_set_name (lcore_config[i].thread_id, thread_name); ret = rte_thread_set_affinity_by_id(lcore_config[i].thread_id,We changed this not so long ago with
8ae946970ed3("eal: fix thread name for high order lcores") which offered up to 4 digits for lcores. With your proposal, we are back to only 3 digits, which is probably enough, but I preferred to raise it.
Quoted 7 lines
Quoted 3 lines
In general no need of hyphen before a number.
I will change to dpdk-worker%d.While I know that "dpdk-" is probably the clearer prefix, "rte-" is also well-know as the standard API prefix for DPDK. Give we have a 16-char limit, I would suggest keeping using the "rte" prefix on the basis of brevity!
It's one character less :)
"rte" is used for API.
"dpdk-" is used for file prefixes.
When running an application, users may understand what is a "dpdk-xyz" thread, while "rte-xyz" is more cryptic if they are not involved with DPDK at all.
Quoted 1 line
A third alternative is to just use "dp-" as prefix...
A third alternative looks like more confusion.
The idea of the thread prefix is to indicate,
to anyone monitoring a system, where the threads come from.
Quoted 53 lines · Thomas Monjalon
17/07/2023 16:09, Bruce Richardson:
Quoted 52 lines · Thomas Monjalon
Quoted 51 lines
03/07/2023 13:38, David Marchand:
Quoted 19 lines · Thomas Monjalon
Quoted 9 lines
When looking at threads in a system, it can be confusing to find some unknown threads without a clue it is started by DPDK.
Let's start all thread names with "dpdk-"
and the driver name if it comes from a driver.One more constraint: the thread names are generally limited to 16 characters, including NUL character.
Yes, and no way to discover this limit.
Quoted 5 lines
Signed-off-by Thomas Monjalon <[email protected]>---
Please review carefully, I may have missed things.Quoted 6 lines
Quoted 2 lines
Note: we should use
rte_ctrl_thread_create()as much as possible.As for this comment, we should advertise
rte_thread_create_control()instead, as it is thread library agnostic.
Which leads me to suggest looking atrte_thread_create_control()calls too.You're right, I'll do a second pass.
Quoted 12 lines
Quoted 12 lines
lib/eal/freebsd/eal.c +1
-1@@ -843,7 +843,7 @@ rte_eal_init(int argc, char **argv)/* Set thread_name for aid in debugging. */ snprintf (thread_name,sizeof (thread_name), -"rte-worker-%d" , i); +"dpdk-worker-%d" , i);rte_thread_set_name (lcore_config[i].thread_id, thread_name);Quoted 6 lines
lib/eal/freebsd/eal.c rte_eal_init(int argc, char **argv) · line 849
Quoted 1 line
lib/eal/freebsd/eal.c +0
-0ret = rte_thread_set_affinity_by_id(lcore_config[i].thread_id,We changed this not so long ago with
8ae946970ed3("eal: fix thread name for high order lcores") which offered up to 4 digits for lcores. With your proposal, we are back to only 3 digits, which is probably enough, but I preferred to raise it.In general no need of hyphen before a number.
I will change to dpdk-worker%d.
Quoted 6 lines
Quoted 4 lines
While I know that "dpdk-" is probably the clearer prefix, "rte-" is also well-know as the standard API prefix for DPDK. Give we have a 16-char limit, I would suggest keeping using the "rte" prefix on the basis of brevity!
It's one character less :)
Yes, but when you are limited to 16 characters, each char counts! "dpdk-" uses 31% of the available chars, vs 25% for the shorter prefix.
Quoted 11 lines
"rte" is used for API.
"dpdk-" is used for file prefixes.
When running an application, users may understand what is a "dpdk-xyz" thread, while "rte-xyz" is more cryptic if they are not involved with DPDK at all.Quoted 1 line
A third alternative is to just use "dp-" as prefix...
A third alternative looks like more confusion.
The idea of the thread prefix is to indicate,
to anyone monitoring a system, where the threads come from.
Sure. No massive objections either way, just keen to see the names being as meaningful as possible.
PATCH v2 1/1 set namespace prefix to threads
In reply to Thomas MonjalonWhen looking at threads in a system, it can be confusing to find some unknown threads without a clue it is started by DPDK.
Let's start all thread names with "dpdk-"
plus the driver name if it comes from a driver.
One more constraint: the thread names are generally limited to 16 characters, including the NUL character.
---
Please review carefully, I may have missed things.
Note: we should use rte_thread_create_control() as much as possible.
--- app/test/test_lcores.c | 2 +- app/test/test_threads.c | 2 +- drivers/dma/skeleton/skeleton_dmadev.c | 2 +- drivers/event/dlb2/pf/base/dlb2_osdep.h | 2 +- drivers/net/ark/ark_ethdev.c | 4 ++-- drivers/net/iavf/iavf_vchnl.c | 2 +- drivers/net/ice/ice_dcf_parent.c | 2 +- drivers/net/ipn3ke/ipn3ke_representor.c | 2 +- drivers/net/ixgbe/ixgbe_ethdev.c | 2 +- drivers/net/kni/rte_eth_kni.c | 2 +- drivers/net/mlx5/mlx5_hws_cnt.c | 6 ++---- drivers/net/sfc/sfc_mae_counter.c | 2 +- drivers/raw/ifpga/ifpga_rawdev.c | 2 +- drivers/vdpa/ifc/ifcvf_vdpa.c | 6 +++--- drivers/vdpa/mlx5/mlx5_vdpa_cthread.c | 2 +- drivers/vdpa/mlx5/mlx5_vdpa_event.c | 2 +- examples/vhost/main.c | 4 ++-- examples/vhost_blk/vhost_blk.c | 2 +- lib/eal/common/eal_common_proc.c | 2 +- lib/eal/freebsd/eal.c | 2 +- lib/eal/freebsd/eal_interrupts.c | 2 +- lib/eal/linux/eal.c | 2 +- lib/eal/linux/eal_interrupts.c | 2 +- lib/eal/linux/eal_timer.c | 2 +- lib/eal/windows/eal.c | 2 +- lib/eal/windows/eal_interrupts.c | 2 +- lib/eventdev/rte_event_eth_rx_adapter.c | 2 +- lib/telemetry/telemetry.c | 4 ++-- lib/vhost/socket.c | 4 ++-- lib/vhost/vduse.c | 2 +- 30 files changed, 37 insertions(+), 39 deletions(-)
app/test/test_lcores.c +1 -1
@@ -362,7 +362,7 @@ test_ctrl_thread(void)/* Create one control thread */ t = &ctrl_thread_context; t->state = Thread_INIT; -if (rte_ctrl_thread_create ((pthread_t *)&t->id,"test_ctrl_threads" , +if (rte_ctrl_thread_create ((pthread_t *)&t->id,"dpdk-test-ctrlt" ,NULL , ctrl_thread_loop, t) !=0 )return -1 ;
app/test/test_threads.c +1 -1
@@ -239,7 +239,7 @@ test_thread_control_create_join(void)rte_thread_t thread_main_id; thread_id_ready =0 ; -RTE_TEST_ASSERT (rte_thread_create_control (&thread_id,"test_control_threads" , +RTE_TEST_ASSERT (rte_thread_create_control (&thread_id,"dpdk-test-thcc" ,NULL , thread_main, &thread_main_id) ==0 ,"Failed to create thread." );
drivers/dma/skeleton/skeleton_dmadev.c +1 -1
@@ -127,7 +127,7 @@ skeldma_start(struct rte_dma_dev *dev)rte_mb (); -snprintf (name,sizeof (name),"dma_skel_%d" , dev->data->dev_id); +snprintf (name,sizeof (name),"dpdk-dma-skel%d" , dev->data->dev_id); ret =rte_thread_create_control (&hw->thread, name,NULL , cpucopy_thread, dev);if (ret) {
drivers/event/dlb2/pf/base/dlb2_osdep.h +1 -1
@@ -200,7 +200,7 @@ static inline void os_schedule_work(struct dlb2_hw *hw) dlb2_dev = container_of(hw, struct dlb2_dev, hw); ret =rte_ctrl_thread_create (&complete_queue_map_unmap_thread, -"dlb_queue_unmap_waiter" , +"dpdk-dlb-qunmap" ,NULL , dlb2_complete_queue_map_unmap, dlb2_dev);
drivers/net/ark/ark_ethdev.c +2 -2
@@ -600,11 +600,11 @@ eth_ark_dev_start(struct rte_eth_dev *dev)if (!ark->isvf && ark->start_pg && !ark->pg_running) {pthread_t thread; -/* Delay packet generatpr start allow the hardware to be ready +/* Delay packet generator start allow the hardware to be ready * This is only used for sanity checking with internal generator */ char tname[32 ]; -snprintf (tname,sizeof (tname),"ark-delay-pg-%d" , +snprintf (tname,sizeof (tname),"dpdk-ark-pg%d" , dev->data->port_id); if (rte_ctrl_thread_create(&thread, tname, NULL,
drivers/net/iavf/iavf_vchnl.c +1 -1
@@ -135,7 +135,7 @@ iavf_dev_event_handler_init(void)TAILQ_INIT (&handler->pending);pthread_mutex_init (&handler->lock,NULL ); -if (rte_thread_create_control (&handler->tid,"iavf-event-thread" , +if (rte_thread_create_control (&handler->tid,"dpdk-iavf-event" ,NULL , iavf_dev_event_handle,NULL )) {__atomic_fetch_sub (&handler->ndev,1 , __ATOMIC_RELAXED);return -1 ;
drivers/net/ice/ice_dcf_parent.c +1 -1
@@ -181,7 +181,7 @@ start_vsi_reset_thread(struct ice_dcf_hw *dcf_hw, bool vfr, uint16_t vf_id) param->vfr = vfr; param->vf_id = vf_id; -snprintf (name,sizeof (name),"ice-reset-%u" , vf_id); +snprintf (name,sizeof (name),"dpdk-ice-rst%u" , vf_id); ret =rte_thread_create_control (&thread, name,NULL , ice_dcf_vsi_update_service_handler, param);if (ret !=0 ) {
drivers/net/ipn3ke/ipn3ke_representor.c +1 -1
@@ -2593,7 +2593,7 @@ ipn3ke_rpst_scan_check(void)if (ipn3ke_rpst_scan_num ==1 ) { ret =rte_ctrl_thread_create (&ipn3ke_rpst_scan_thread, -"ipn3ke scanner" , +"dpdk-ipn3ke-scn" ,NULL , ipn3ke_rpst_scan_handle_request,NULL );if (ret) {
drivers/net/ixgbe/ixgbe_ethdev.c +1 -1
@@ -4329,7 +4329,7 @@ ixgbe_dev_link_update_share(struct rte_eth_dev *dev,*/ intr->flags |=IXGBE_FLAG_NEED_LINK_CONFIG ;if (rte_thread_create_control (&ad->link_thread_tid, -"ixgbe-link-handler" , +"dpdk-ixgbe-link" ,NULL , ixgbe_dev_setup_link_thread_handler, dev) <0 ) {
drivers/net/kni/rte_eth_kni.c +1 -1
@@ -163,7 +163,7 @@ eth_kni_dev_start(struct rte_eth_dev *dev) internals->stop_thread =0 ; ret =rte_ctrl_thread_create (&internals->thread, -"kni_handle_req" ,NULL , +"dpdk-kni-req" ,NULL , kni_handle_request, internals);if (ret) { PMD_LOG(ERR,
drivers/net/mlx5/mlx5_hws_cnt.c +2 -4
@@ -439,8 +439,7 @@ mlx5_hws_cnt_pool_init(struct mlx5_dev_ctx_shared *sh,int mlx5_hws_cnt_service_thread_create (struct mlx5_dev_ctx_shared *sh) { -#define CNT_THREAD_NAME_MAX 256 -char name[CNT_THREAD_NAME_MAX ]; +char name[RTE_MAX_THREAD_NAME_LEN ];rte_cpuset_t cpuset;int ret;uint32_t service_core = sh->cnt_svc->service_core;
@@ -453,8 +452,7 @@ mlx5_hws_cnt_service_thread_create(struct mlx5_dev_ctx_shared *sh)DRV_LOG (ERR ,"Failed to create HW steering's counter service thread." );return -ENOSYS ; } -snprintf (name,CNT_THREAD_NAME_MAX -1 ,"%s/svc@%d" , - sh->ibdev_name, service_core); +snprintf (name,RTE_MAX_THREAD_NAME_LEN ,"dpdk-mlx5-%d" , service_core);rte_thread_set_name ((rte_thread_t ){(uintptr_t )sh->cnt_svc->service_thread}, name);CPU_SET (service_core, &cpuset);
drivers/net/sfc/sfc_mae_counter.c +1 -1
@@ -711,7 +711,7 @@ sfc_mae_counter_thread_spawn(struct sfc_adapter *sa, counter_registry->polling.thread.run = true; rc =rte_ctrl_thread_create (&sa->mae.counter_registry.polling.thread.id, -"mae_counter_thread" ,NULL , +"dpdk-sfc-maecnt" ,NULL , sfc_mae_counter_thread, sa);return rc;
drivers/raw/ifpga/ifpga_rawdev.c +1 -1
@@ -551,7 +551,7 @@ ifpga_monitor_start_func(struct ifpga_rawdev *dev)if (!__atomic_fetch_add (&ifpga_monitor_refcnt,1 , __ATOMIC_RELAXED)) { ret =rte_ctrl_thread_create (&ifpga_monitor_start_thread, -"ifpga-monitor" ,NULL , +"dpdk-ifpga-mon" ,NULL , ifpga_rawdev_gsd_handle,NULL );if (ret !=0 ) { ifpga_monitor_start_thread =0 ;
drivers/vdpa/ifc/ifcvf_vdpa.c +3 -3
@@ -570,7 +570,7 @@ setup_notify_relay(struct ifcvf_internal *internal)char name[THREAD_NAME_LEN ];int ret; -snprintf (name,sizeof (name),"ifc-notify-%d" , internal->vid); +snprintf (name,sizeof (name),"dpdk-ifc-noti%d" , internal->vid); ret =rte_ctrl_thread_create (&internal->tid, name,NULL , notify_relay, (void *)internal);if (ret !=0 ) {
@@ -681,7 +681,7 @@ setup_intr_relay(struct ifcvf_internal *internal)char name[THREAD_NAME_LEN ];int ret; -snprintf (name,sizeof (name),"ifc-intr-%d" , internal->vid); +snprintf (name,sizeof (name),"dpdk-ifc-int%d" , internal->vid); ret =rte_ctrl_thread_create (&internal->intr_tid, name,NULL , intr_relay, (void *)internal);if (ret) {
@@ -1019,7 +1019,7 @@ setup_vring_relay(struct ifcvf_internal *internal)char name[THREAD_NAME_LEN ];int ret; -snprintf (name,sizeof (name),"ifc-vring-%d" , internal->vid); +snprintf (name,sizeof (name),"dpdk-ifc-ring%d" , internal->vid); ret =rte_ctrl_thread_create (&internal->tid, name,NULL , vring_relay, (void *)internal);if (ret !=0 ) {
drivers/vdpa/mlx5/mlx5_vdpa_cthread.c +1 -1
@@ -312,7 +312,7 @@ mlx5_vdpa_c_thread_create(int cpu_core) "vdpa multi-threads %d.", thrd_idx); goto c_thread_err; } -snprintf (name,sizeof (name),"vDPA-mthread-%d" , thrd_idx); +snprintf (name,sizeof (name),"dpdk-vmlx5-c%d" , thrd_idx); ret =pthread_setname_np ( conf_thread_mng.cthrd[thrd_idx].tid, name);if (ret)
drivers/vdpa/mlx5/mlx5_vdpa_event.c +1 -1
@@ -546,7 +546,7 @@ mlx5_vdpa_cqe_event_setup(struct mlx5_vdpa_priv *priv)DRV_LOG (ERR ,"Failed to set thread affinity." ); goto out; } -snprintf (name,sizeof (name),"vDPA-mlx5-%d" , priv->vid); +snprintf (name,sizeof (name),"dpdk-vmlx5-%d" , priv->vid);rte_thread_set_name ((rte_thread_t ){(uintptr_t )priv->timer_tid}, name); out:if (attrp !=NULL )
examples/vhost/main.c +2 -2
@@ -1986,11 +1986,11 @@ main(int argc, char *argv[])/* Enable stats if the user option is set. */ if (enable_stats) { - ret =rte_ctrl_thread_create (&tid,"print-stats" ,NULL , + ret =rte_ctrl_thread_create (&tid,"dpdk-vhost-stat" ,NULL , print_stats,NULL );if (ret <0 )rte_exit (EXIT_FAILURE , -"Cannot create print-stats thread\n" ); +"Cannot create dpdk-vhost-stat thread\n" ); }/* Launch all data cores. */
examples/vhost_blk/vhost_blk.c +1 -1
@@ -686,7 +686,7 @@ new_device(int vid)/* start polling vring */ worker_thread_status =WORKER_STATE_START ;fprintf (stdout,"New Device %s, Device ID %d\n" , path, vid); -if (rte_ctrl_thread_create (&tid,"vhostblk-ctrlr" ,NULL , +if (rte_ctrl_thread_create (&tid,"dpdk-vhost-blk" ,NULL , &ctrlr_worker, ctrlr) !=0 ) {fprintf (stderr,"Worker Thread Started Failed\n" );return -1 ;
lib/eal/common/eal_common_proc.c +1 -1
@@ -635,7 +635,7 @@ rte_mp_channel_init(void)return -1 ; } -if (rte_ctrl_thread_create (&mp_handle_tid,"rte_mp_handle" , +if (rte_ctrl_thread_create (&mp_handle_tid,"dpdk-mp-msg" ,NULL , mp_handle,NULL ) <0 ) {RTE_LOG (ERR ,EAL ,"failed to create mp thread: %s\n" ,strerror (errno));
lib/eal/freebsd/eal.c +1 -1
@@ -843,7 +843,7 @@ rte_eal_init(int argc, char **argv)/* Set thread_name for aid in debugging. */ snprintf (thread_name,sizeof (thread_name), -"rte-worker-%d" , i); +"dpdk-worker%d" , i);rte_thread_set_name (lcore_config[i].thread_id, thread_name); ret = rte_thread_set_affinity_by_id(lcore_config[i].thread_id,
lib/eal/freebsd/eal_interrupts.c +1 -1
@@ -637,7 +637,7 @@ rte_eal_intr_init(void) }/* create the host thread to wait/handle the interrupt */ - ret =rte_ctrl_thread_create (&intr_thread,"eal-intr-thread" ,NULL , + ret =rte_ctrl_thread_create (&intr_thread,"dpdk-intr" ,NULL , eal_intr_thread_main,NULL );if (ret !=0 ) { rte_errno = -ret;
lib/eal/linux/eal.c +1 -1
@@ -1272,7 +1272,7 @@ rte_eal_init(int argc, char **argv)/* Set thread_name for aid in debugging. */ snprintf (thread_name,sizeof (thread_name), -"rte-worker-%d" , i); +"dpdk-worker%d" , i);rte_thread_set_name (lcore_config[i].thread_id, thread_name); ret = rte_thread_set_affinity_by_id(lcore_config[i].thread_id,
lib/eal/linux/eal_interrupts.c +1 -1
@@ -1188,7 +1188,7 @@ rte_eal_intr_init(void) }/* create the host thread to wait/handle the interrupt */ - ret =rte_ctrl_thread_create (&intr_thread,"eal-intr-thread" ,NULL , + ret =rte_ctrl_thread_create (&intr_thread,"dpdk-intr" ,NULL , eal_intr_thread_main,NULL );if (ret !=0 ) { rte_errno = -ret;
lib/eal/linux/eal_timer.c +1 -1
@@ -176,7 +176,7 @@ rte_eal_hpet_init(int make_default)/* create a thread that will increment a global variable for * msb (hpet is 32 bits by default under linux) */ - ret =rte_ctrl_thread_create (&msb_inc_thread_id,"hpet-msb-inc" ,NULL , + ret =rte_ctrl_thread_create (&msb_inc_thread_id,"dpdk-hpet-msb" ,NULL , hpet_msb_inc,NULL );if (ret !=0 ) {RTE_LOG (ERR ,EAL ,"ERROR: Cannot create HPET timer thread!\n" );
lib/eal/windows/eal.c +1 -1
@@ -468,7 +468,7 @@ rte_eal_init(int argc, char **argv)/* Set thread name for aid in debugging. */ snprintf (thread_name,sizeof (thread_name), -"rte-worker-%d" , i); +"dpdk-worker%d" , i);rte_thread_set_name (lcore_config[i].thread_id, thread_name); ret = rte_thread_set_affinity_by_id(lcore_config[i].thread_id,
lib/eal/windows/eal_interrupts.c +1 -1
@@ -98,7 +98,7 @@ rte_eal_intr_init(void)return -1 ; } - ret =rte_thread_create_control (&intr_thread,"eal-intr-thread" ,NULL , + ret =rte_thread_create_control (&intr_thread,"dpdk-intr" ,NULL , eal_intr_thread_main,NULL );if (ret !=0 ) { rte_errno = -ret;
lib/eventdev/rte_event_eth_rx_adapter.c +1 -1
@@ -1620,7 +1620,7 @@ rxa_create_intr_thread(struct event_eth_rx_adapter *rx_adapter)rte_spinlock_init (&rx_adapter->intr_ring_lock);snprintf (thread_name,RTE_MAX_THREAD_NAME_LEN , -"rx-intr-thread-%d" , rx_adapter->id); +"dpdk-evt-rx%d" , rx_adapter->id); err =rte_ctrl_thread_create (&rx_adapter->rx_intr_thread, thread_name,NULL , rxa_intr_thread, rx_adapter);
lib/telemetry/telemetry.c +2 -2
@@ -563,7 +563,7 @@ telemetry_legacy_init(void)return -1 ; }pthread_setaffinity_np (t_old,sizeof (*thread_cpuset), thread_cpuset); -set_thread_name (t_old,"telemetry-v1" ); +set_thread_name (t_old,"dpdk-telemet-v1" );TMTY_LOG (DEBUG ,"Legacy telemetry socket initialized ok\n" );pthread_detach (t_old);return 0 ;
@@ -617,7 +617,7 @@ telemetry_v2_init(void)return -1 ; }pthread_setaffinity_np (t_new,sizeof (*thread_cpuset), thread_cpuset); -set_thread_name (t_new,"telemetry-v2" ); +set_thread_name (t_new,"dpdk-telemet-v2" );pthread_detach (t_new);atexit (unlink_sockets);
lib/vhost/socket.c +2 -2
@@ -513,7 +513,7 @@ vhost_user_reconnect_init(void) }TAILQ_INIT (&reconn_list.head); - ret =rte_ctrl_thread_create (&reconn_tid,"vhost_reconn" ,NULL , + ret =rte_ctrl_thread_create (&reconn_tid,"dpdk-vhost-reco" ,NULL , vhost_user_client_reconnect,NULL );if (ret !=0 ) {VHOST_LOG_CONFIG ("thread" ,ERR ,"failed to create reconnect thread\n" );
@@ -1239,7 +1239,7 @@ rte_vhost_driver_start(const char *path) }int ret =rte_ctrl_thread_create (&fdset_tid, -"vhost-events" ,NULL , fdset_event_dispatch, +"dpdk-vhost-evt" ,NULL , fdset_event_dispatch, &vhost_user.fdset);if (ret !=0 ) {VHOST_LOG_CONFIG (path,ERR ,"failed to create fdset handling thread\n" );
lib/vhost/vduse.c +1 -1
@@ -455,7 +455,7 @@ vduse_device_create(const char *path)return -1 ; } - ret =rte_ctrl_thread_create (&fdset_tid,"vduse-events" ,NULL , + ret =rte_ctrl_thread_create (&fdset_tid,"dpdk-vduse-evt" ,NULL , fdset_event_dispatch, &vduse.fdset);if (ret !=0 ) {VHOST_LOG_CONFIG (path,ERR ,"failed to create vduse fdset handling thread\n" );
Signature · 1 line
2.41.0
+1 for same prefix.
Quoted 15 lines · Thomas Monjalon
When looking at threads in a system, it can be confusing to find some unknown threads without a clue it is started by DPDK.
Let's start all thread names with "dpdk-"
plus the driver name if it comes from a driver.One more constraint: the thread names are generally limited to 16 characters, including the NUL character.
Signed-off-by Thomas Monjalon <[email protected]>---
Please review carefully, I may have missed things.Note: we should use
rte_thread_create_control()as much as possible.
...
Quoted 1 line
Quoted 6 lines · Thomas Monjalon
When looking at threads in a system, it can be confusing to find some unknown threads without a clue it is started by DPDK.
Let's start all thread names with "dpdk-"
plus the driver name if it comes from a driver.
Quoted 6 lines
One more constraint: the thread names are generally limited to 16 characters, including the NUL character.
Signed-off-by Thomas Monjalon <[email protected]>---
Please review carefully, I may have missed things.
i think the only caution here is that some of the new names may be truncated where the valuable information is lost in the truncation?
#define RTE_MAX_THREAD_NAME_LEN 16
a limit inherited from linux and adopted as the dpdk standard/maximum. by prefixing dpdk- we end up with a bit less name length budget to spend potentially causing the most important part of the thread name to be lost.
a couple of notes though.
* some of the existing names may already suffer from truncation. i didn't check but can see some that look close.
* some of your new names have reduced the length so they are in fact better.
10/07/2023 20:42, Tyler Retzlaff:
Quoted 23 lines · Thomas Monjalon
Quoted 6 lines
When looking at threads in a system, it can be confusing to find some unknown threads without a clue it is started by DPDK.
Let's start all thread names with "dpdk-"
plus the driver name if it comes from a driver.Quoted 6 lines
One more constraint: the thread names are generally limited to 16 characters, including the NUL character.
Signed-off-by Thomas Monjalon <[email protected]>---
Please review carefully, I may have missed things.i think the only caution here is that some of the new names may be truncated where the valuable information is lost in the truncation?
#define
RTE_MAX_THREAD_NAME_LEN16a limit inherited from linux and adopted as the dpdk standard/maximum. by prefixing dpdk- we end up with a bit less name length budget to spend potentially causing the most important part of the thread name to be lost.
Quoted 7 lines
a couple of notes though.
* some of the existing names may already suffer from truncation. i didn't check but can see some that look close.
* some of your new names have reduced the length so they are in fact better.Acked-by Tyler Retzlaff <[email protected]>
Updated for the recently added txgbe thread,
and applied.