vhost: add fdset-event thread name
authorTonghao Zhang <xiangxia.m.yue@gmail.com>
Fri, 23 Mar 2018 02:18:51 +0000 (19:18 -0700)
committerFerruh Yigit <ferruh.yigit@intel.com>
Fri, 30 Mar 2018 12:08:44 +0000 (14:08 +0200)
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>
lib/librte_vhost/socket.c

index 5e24230..8bc8228 100644 (file)
@@ -841,6 +841,7 @@ rte_vhost_driver_start(const char *path)
 {
        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);
@@ -856,6 +857,14 @@ rte_vhost_driver_start(const char *path)
                        RTE_LOG(ERR, VHOST_CONFIG,
                                "failed to create fdset handling thread");
                        return -1;
+               } 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");
+                       }
                }
        }