DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH] set namespace prefix to threads
@ 2023-07-03 11:23 Thomas Monjalon
  2023-07-03 11:38 ` David Marchand
  2023-07-03 12:14 ` [PATCH v2] " Thomas Monjalon
  0 siblings, 2 replies; 10+ messages in thread
From: Thomas Monjalon @ 2023-07-03 11:23 UTC (permalink / raw)
  To: dev
  Cc: Timothy McDaniel, Shepard Siegel, Ed Czeck, John Miller,
	Rosen Xu, Matan Azrad, Viacheslav Ovsiienko, Ori Kam,
	Suanming Mou, Andrew Rybchenko, Tianfei Zhang, Xiao Wang,
	Maxime Coquelin, Chenbo Xia, Anatoly Burakov, Bruce Richardson,
	Harman Kalra, Dmitry Kozlyuk, Narcisa Ana Maria Vasile,
	Dmitry Malloy, Pallavi Kadam, Naga Harish K S V, Jerin Jacob,
	Ciara Power

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.

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
---
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(-)

diff --git a/app/test/test_lcores.c b/app/test/test_lcores.c
index 2c945b0136..9522663f1a 100644
--- a/app/test/test_lcores.c
+++ b/app/test/test_lcores.c
@@ -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;
 
diff --git a/drivers/event/dlb2/pf/base/dlb2_osdep.h b/drivers/event/dlb2/pf/base/dlb2_osdep.h
index cffe22f3c5..75860cca4d 100644
--- a/drivers/event/dlb2/pf/base/dlb2_osdep.h
+++ b/drivers/event/dlb2/pf/base/dlb2_osdep.h
@@ -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);
diff --git a/drivers/net/ark/ark_ethdev.c b/drivers/net/ark/ark_ethdev.c
index b2995427c8..30814650bf 100644
--- a/drivers/net/ark/ark_ethdev.c
+++ b/drivers/net/ark/ark_ethdev.c
@@ -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,
diff --git a/drivers/net/ipn3ke/ipn3ke_representor.c b/drivers/net/ipn3ke/ipn3ke_representor.c
index e50fc73f43..c82f8b5333 100644
--- a/drivers/net/ipn3ke/ipn3ke_representor.c
+++ b/drivers/net/ipn3ke/ipn3ke_representor.c
@@ -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) {
diff --git a/drivers/net/kni/rte_eth_kni.c b/drivers/net/kni/rte_eth_kni.c
index c0e1f8db40..6b90c4e9b5 100644
--- a/drivers/net/kni/rte_eth_kni.c
+++ b/drivers/net/kni/rte_eth_kni.c
@@ -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,
diff --git a/drivers/net/mlx5/mlx5_hws_cnt.c b/drivers/net/mlx5/mlx5_hws_cnt.c
index d98df68f39..415bb7dae4 100644
--- a/drivers/net/mlx5/mlx5_hws_cnt.c
+++ b/drivers/net/mlx5/mlx5_hws_cnt.c
@@ -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);
diff --git a/drivers/net/sfc/sfc_mae_counter.c b/drivers/net/sfc/sfc_mae_counter.c
index 79043ff7d7..631b54afeb 100644
--- a/drivers/net/sfc/sfc_mae_counter.c
+++ b/drivers/net/sfc/sfc_mae_counter.c
@@ -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;
diff --git a/drivers/raw/ifpga/ifpga_rawdev.c b/drivers/raw/ifpga/ifpga_rawdev.c
index b9f6f432c8..a7b18299de 100644
--- a/drivers/raw/ifpga/ifpga_rawdev.c
+++ b/drivers/raw/ifpga/ifpga_rawdev.c
@@ -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;
diff --git a/drivers/vdpa/ifc/ifcvf_vdpa.c b/drivers/vdpa/ifc/ifcvf_vdpa.c
index e4133568c1..55346bbc08 100644
--- a/drivers/vdpa/ifc/ifcvf_vdpa.c
+++ b/drivers/vdpa/ifc/ifcvf_vdpa.c
@@ -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) {
diff --git a/drivers/vdpa/mlx5/mlx5_vdpa_cthread.c b/drivers/vdpa/mlx5/mlx5_vdpa_cthread.c
index 6e6624e5a3..a1d291bf71 100644
--- a/drivers/vdpa/mlx5/mlx5_vdpa_cthread.c
+++ b/drivers/vdpa/mlx5/mlx5_vdpa_cthread.c
@@ -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)
diff --git a/drivers/vdpa/mlx5/mlx5_vdpa_event.c b/drivers/vdpa/mlx5/mlx5_vdpa_event.c
index f3d392c73d..c486ded598 100644
--- a/drivers/vdpa/mlx5/mlx5_vdpa_event.c
+++ b/drivers/vdpa/mlx5/mlx5_vdpa_event.c
@@ -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)
diff --git a/examples/vhost/main.c b/examples/vhost/main.c
index bfe466ff77..9ff2c1f31b 100644
--- a/examples/vhost/main.c
+++ b/examples/vhost/main.c
@@ -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. */
diff --git a/examples/vhost_blk/vhost_blk.c b/examples/vhost_blk/vhost_blk.c
index 3709d7ed06..45699eb0b3 100644
--- a/examples/vhost_blk/vhost_blk.c
+++ b/examples/vhost_blk/vhost_blk.c
@@ -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;
diff --git a/lib/eal/common/eal_common_proc.c b/lib/eal/common/eal_common_proc.c
index 7a038e0a3c..39ee9bcd7e 100644
--- a/lib/eal/common/eal_common_proc.c
+++ b/lib/eal/common/eal_common_proc.c
@@ -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));
diff --git a/lib/eal/freebsd/eal.c b/lib/eal/freebsd/eal.c
index 7008303e11..e201acd1c2 100644
--- a/lib/eal/freebsd/eal.c
+++ b/lib/eal/freebsd/eal.c
@@ -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,
diff --git a/lib/eal/freebsd/eal_interrupts.c b/lib/eal/freebsd/eal_interrupts.c
index ffcf97ad4c..68cdb9deb3 100644
--- a/lib/eal/freebsd/eal_interrupts.c
+++ b/lib/eal/freebsd/eal_interrupts.c
@@ -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;
diff --git a/lib/eal/linux/eal.c b/lib/eal/linux/eal.c
index 145afafde2..655653e2c1 100644
--- a/lib/eal/linux/eal.c
+++ b/lib/eal/linux/eal.c
@@ -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,
diff --git a/lib/eal/linux/eal_interrupts.c b/lib/eal/linux/eal_interrupts.c
index c9881143be..19b36787b8 100644
--- a/lib/eal/linux/eal_interrupts.c
+++ b/lib/eal/linux/eal_interrupts.c
@@ -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;
diff --git a/lib/eal/linux/eal_timer.c b/lib/eal/linux/eal_timer.c
index 95c8cca992..1898709700 100644
--- a/lib/eal/linux/eal_timer.c
+++ b/lib/eal/linux/eal_timer.c
@@ -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");
diff --git a/lib/eal/windows/eal.c b/lib/eal/windows/eal.c
index 2d7a0e9ab2..d3c9de70f8 100644
--- a/lib/eal/windows/eal.c
+++ b/lib/eal/windows/eal.c
@@ -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,
diff --git a/lib/eventdev/rte_event_eth_rx_adapter.c b/lib/eventdev/rte_event_eth_rx_adapter.c
index f7f93ccdfd..ec5bec020d 100644
--- a/lib/eventdev/rte_event_eth_rx_adapter.c
+++ b/lib/eventdev/rte_event_eth_rx_adapter.c
@@ -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);
diff --git a/lib/telemetry/telemetry.c b/lib/telemetry/telemetry.c
index 590720bfa6..76b1677250 100644
--- a/lib/telemetry/telemetry.c
+++ b/lib/telemetry/telemetry.c
@@ -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);
 
diff --git a/lib/vhost/socket.c b/lib/vhost/socket.c
index 19a7469e45..906db3871d 100644
--- a/lib/vhost/socket.c
+++ b/lib/vhost/socket.c
@@ -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");
diff --git a/lib/vhost/vduse.c b/lib/vhost/vduse.c
index a509daf80c..50dad7022f 100644
--- a/lib/vhost/vduse.c
+++ b/lib/vhost/vduse.c
@@ -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");
-- 
2.41.0


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2023-08-31 14:38 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-03 11:23 [PATCH] set namespace prefix to threads Thomas Monjalon
2023-07-03 11:38 ` David Marchand
2023-07-03 11:49   ` Thomas Monjalon
2023-07-17 14:09     ` Bruce Richardson
2023-07-17 16:07       ` Thomas Monjalon
2023-07-17 16:14         ` Bruce Richardson
2023-07-03 12:14 ` [PATCH v2] " Thomas Monjalon
2023-07-04  9:18   ` fengchengwen
2023-07-10 18:42   ` Tyler Retzlaff
2023-08-31 14:37     ` Thomas Monjalon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).