[dpdk-dev] [PATCH v2 3/7] vdpa/ifc: support set notify and vring relay thread name

Min Hu (Connor) humin29 at huawei.com
Sat Apr 17 11:09:44 CEST 2021


From: Chengwen Feng <fengchengwen at huawei.com>

This patch supports set notify and vring relay thread name which is
helpful for debugging.

Signed-off-by: Chengwen Feng <fengchengwen at huawei.com>
Signed-off-by: Min Hu (Connor) <humin29 at huawei.com>
---
 drivers/vdpa/ifc/ifcvf_vdpa.c | 20 ++++++++++++++------
 1 file changed, 14 insertions(+), 6 deletions(-)

diff --git a/drivers/vdpa/ifc/ifcvf_vdpa.c b/drivers/vdpa/ifc/ifcvf_vdpa.c
index 7a06f97..1dc813d 100644
--- a/drivers/vdpa/ifc/ifcvf_vdpa.c
+++ b/drivers/vdpa/ifc/ifcvf_vdpa.c
@@ -37,6 +37,8 @@ RTE_LOG_REGISTER(ifcvf_vdpa_logtype, pmd.vdpa.ifcvf, NOTICE);
 #define IFCVF_VDPA_MODE		"vdpa"
 #define IFCVF_SW_FALLBACK_LM	"sw-live-migration"
 
+#define THREAD_NAME_LEN	16
+
 static const char * const ifcvf_valid_arguments[] = {
 	IFCVF_VDPA_MODE,
 	IFCVF_SW_FALLBACK_LM,
@@ -494,14 +496,17 @@ notify_relay(void *arg)
 static int
 setup_notify_relay(struct ifcvf_internal *internal)
 {
+	char name[THREAD_NAME_LEN];
 	int ret;
 
-	ret = pthread_create(&internal->tid, NULL, notify_relay,
-			(void *)internal);
-	if (ret) {
+	snprintf(name, sizeof(name), "ifc-notify-%d", internal->vid);
+	ret = rte_ctrl_thread_create(&internal->tid, name, NULL, notify_relay,
+				     (void *)internal);
+	if (ret != 0) {
 		DRV_LOG(ERR, "failed to create notify relay pthread.");
 		return -1;
 	}
+
 	return 0;
 }
 
@@ -797,14 +802,17 @@ vring_relay(void *arg)
 static int
 setup_vring_relay(struct ifcvf_internal *internal)
 {
+	char name[THREAD_NAME_LEN];
 	int ret;
 
-	ret = pthread_create(&internal->tid, NULL, vring_relay,
-			(void *)internal);
-	if (ret) {
+	snprintf(name, sizeof(name), "ifc-vring-%d", internal->vid);
+	ret = rte_ctrl_thread_create(&internal->tid, name, NULL, vring_relay,
+				     (void *)internal);
+	if (ret != 0) {
 		DRV_LOG(ERR, "failed to create ring relay pthread.");
 		return -1;
 	}
+
 	return 0;
 }
 
-- 
2.7.4



More information about the dev mailing list