diff mbox

[dpdk-dev,2/2] vhost: add fdset-event thread name

Message ID 1521722398-93353-2-git-send-email-xiangxia.m.yue@gmail.com (mailing list archive)
State Superseded, archived
Delegated to: Maxime Coquelin
Headers show

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation fail Compilation issues

Commit Message

Tonghao Zhang March 22, 2018, 12:39 p.m. UTC
From: Tonghao Zhang <xiangxia.m.yue@gmail.com>

This patch adds the name for vhost fdset thread.
It can help us to know whether the thread is running.

Signed-off-by: Tonghao Zhang <xiangxia.m.yue@gmail.com>
---
 lib/librte_vhost/socket.c | 9 +++++++++
 1 file changed, 9 insertions(+)

Comments

Jianfeng Tan March 23, 2018, 1:38 a.m. UTC | #1
> -----Original Message-----
> From: xiangxia.m.yue@gmail.com [mailto:xiangxia.m.yue@gmail.com]
> Sent: Thursday, March 22, 2018 8:40 PM
> To: Tan, Jianfeng
> Cc: dev@dpdk.org; Tonghao Zhang
> Subject: [PATCH 2/2] vhost: add fdset-event thread name
> 
> From: Tonghao Zhang <xiangxia.m.yue@gmail.com>
> 
> This patch adds the name for vhost fdset thread.
> It can help us to know whether the thread is running.
> 
> Signed-off-by: Tonghao Zhang <xiangxia.m.yue@gmail.com>

Reviewed-by: Jianfeng Tan <jianfeng.tan@intel.com>

Thanks,
Jianfeng

> ---
>  lib/librte_vhost/socket.c | 9 +++++++++
>  1 file changed, 9 insertions(+)
> 
> diff --git a/lib/librte_vhost/socket.c b/lib/librte_vhost/socket.c
> index 8ca01df..93175ba 100644
> --- a/lib/librte_vhost/socket.c
> +++ b/lib/librte_vhost/socket.c
> @@ -820,6 +820,7 @@ struct vhost_device_ops const *
>  {
>  	struct vhost_user_socket *vsocket;
>  	static pthread_t fdset_tid;
> +	char thread_name[RTE_MAX_THREAD_NAME_LEN];
> 
>  	pthread_mutex_lock(&vhost_user.mutex);
>  	vsocket = find_vhost_user_socket(path);
> @@ -835,6 +836,14 @@ struct vhost_device_ops const *
>  			RTE_LOG(ERR, VHOST_CONFIG,
>  				"failed to create fdset handling thread");
>  			return ret;
> +		} else {
> +			snprintf(thread_name,
> RTE_MAX_THREAD_NAME_LEN,
> +				 "vhost-events");
> +
> +			if (rte_thread_setname(fdset_tid, thread_name)) {
> +				RTE_LOG(DEBUG, VHOST_CONFIG,
> +					"failed to set vhost-event thread
> name");
> +			}
>  		}
>  	}
> 
> --
> 1.8.3.1
diff mbox

Patch

diff --git a/lib/librte_vhost/socket.c b/lib/librte_vhost/socket.c
index 8ca01df..93175ba 100644
--- a/lib/librte_vhost/socket.c
+++ b/lib/librte_vhost/socket.c
@@ -820,6 +820,7 @@  struct vhost_device_ops const *
 {
 	struct vhost_user_socket *vsocket;
 	static pthread_t fdset_tid;
+	char thread_name[RTE_MAX_THREAD_NAME_LEN];
 
 	pthread_mutex_lock(&vhost_user.mutex);
 	vsocket = find_vhost_user_socket(path);
@@ -835,6 +836,14 @@  struct vhost_device_ops const *
 			RTE_LOG(ERR, VHOST_CONFIG,
 				"failed to create fdset handling thread");
 			return ret;
+		} else {
+			snprintf(thread_name, RTE_MAX_THREAD_NAME_LEN,
+				 "vhost-events");
+
+			if (rte_thread_setname(fdset_tid, thread_name)) {
+				RTE_LOG(DEBUG, VHOST_CONFIG,
+					"failed to set vhost-event thread name");
+			}
 		}
 	}