aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPierre Pfister <ppfister@cisco.com>2016-11-09 10:16:57 +0000
committerPierre Pfister <ppfister@cisco.com>2016-11-09 10:16:57 +0000
commit22665d23e1ec4d5de10f610441d98d593a89b20a (patch)
tree4ee0c68154c5a9ab8c85de78cbb95894fc1f1757
parentd1f3123795162370885d5920c402f76f64e05891 (diff)
Vhost: Add thread sync while receiving vhost messagestable/1609
It is important to stop the working threads while some operations are performed on the working threads. This is a backport of a fix brought in commit e21c52861d. This should solve Jira ticket VPP526 Change-Id: I6deb27f5de44f0f19401161ee6adecaba86dae1a Signed-off-by: Pierre Pfister <ppfister@cisco.com>
-rw-r--r--vnet/vnet/devices/virtio/vhost-user.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/vnet/vnet/devices/virtio/vhost-user.c b/vnet/vnet/devices/virtio/vhost-user.c
index 25bcbca50ac..f00fd9665c6 100644
--- a/vnet/vnet/devices/virtio/vhost-user.c
+++ b/vnet/vnet/devices/virtio/vhost-user.c
@@ -344,6 +344,9 @@ vhost_user_socket_read (unix_file_t * uf)
n = recvmsg (uf->file_descriptor, &mh, 0);
+ /* Stop workers to avoid end of the world */
+ vlib_worker_thread_barrier_sync (vlib_get_main ());
+
if (n != VHOST_USER_MSG_HDR_SZ)
goto close_socket;
@@ -724,10 +727,12 @@ vhost_user_socket_read (unix_file_t * uf)
goto close_socket;
}
+ vlib_worker_thread_barrier_release (vlib_get_main ());
return 0;
close_socket:
vhost_user_if_disconnect (vui);
+ vlib_worker_thread_barrier_release (vlib_get_main ());
return 0;
}