dev.dpdk.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 1/2] vhost: make sure vhost fdset-thread created successfully
@ 2018-03-23  2:18 xiangxia.m.yue
  2018-03-23  2:18 ` [PATCH v2 2/2] vhost: add fdset-event thread name xiangxia.m.yue
  2018-03-30  8:03 ` [PATCH v2 1/2] vhost: make sure vhost fdset-thread created successfully Maxime Coquelin
  0 siblings, 2 replies; 4+ messages in thread
From: xiangxia.m.yue @ 2018-03-23  2:18 UTC (permalink / raw)
  To: jianfeng.tan; +Cc: dev, Tonghao Zhang

From: Tonghao Zhang <xiangxia.m.yue@gmail.com>

When first call the 'rte_vhost_driver_start', the
fdset_event_dispatch thread should be created successfully.
Because the vhost uses it to poll socket events for vhost
server or clients. Without it, for example, vhost will not
get the connection event.

This patch returns err code directly when created not successful.

Signed-off-by: Tonghao Zhang <xiangxia.m.yue@gmail.com>
Reviewed-by: Jianfeng Tan <jianfeng.tan@intel.com>
---
v2:
According to rte_vhost_driver_start doc, replace the err code
of pthread_create with -1.
---
 lib/librte_vhost/socket.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/lib/librte_vhost/socket.c b/lib/librte_vhost/socket.c
index 83befdc..8c98806 100644
--- a/lib/librte_vhost/socket.c
+++ b/lib/librte_vhost/socket.c
@@ -831,9 +831,11 @@ struct vhost_device_ops const *
 	if (fdset_tid == 0) {
 		int ret = pthread_create(&fdset_tid, NULL, fdset_event_dispatch,
 				     &vhost_user.fdset);
-		if (ret != 0)
+		if (ret != 0) {
 			RTE_LOG(ERR, VHOST_CONFIG,
 				"failed to create fdset handling thread");
+			return -1;
+		}
 	}
 
 	if (vsocket->is_server)
-- 
1.8.3.1

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

end of thread, other threads:[~2018-03-30  8:05 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-23  2:18 [PATCH v2 1/2] vhost: make sure vhost fdset-thread created successfully xiangxia.m.yue
2018-03-23  2:18 ` [PATCH v2 2/2] vhost: add fdset-event thread name xiangxia.m.yue
2018-03-30  8:05   ` Maxime Coquelin
2018-03-30  8:03 ` [PATCH v2 1/2] vhost: make sure vhost fdset-thread created successfully Maxime Coquelin

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).