As ovsrcu_synchronize() is used when setting virtio_dev to NULL,
ovsrcu_quiesce_start() must be called before destroy_device() returns.
Otherwise there will be warnings about the thread not quiescing.
Use of ovs_thread_create() instead of pthread_create() is optional but
as we are now setting quiescent state, it is added.

Signed-off-by: Kevin Traynor <kevin.tray...@intel.com>
---
 lib/netdev-dpdk.c |   10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c
index 4e16f39..d52fc96 100644
--- a/lib/netdev-dpdk.c
+++ b/lib/netdev-dpdk.c
@@ -1586,6 +1586,8 @@ destroy_device(volatile struct virtio_net *dev)
              * setting the virtio_dev to NULL.
              */
             ovsrcu_synchronize();
+            /* Put the cuse thread into quiescent state. */
+            ovsrcu_quiesce_start();
         }
     }
     ovs_mutex_unlock(&dpdk_mutex);
@@ -1614,6 +1616,8 @@ static void *
 start_cuse_session_loop(void *dummy OVS_UNUSED)
 {
      pthread_detach(pthread_self());
+     /* Put the cuse thread into quiescent state. */
+     ovsrcu_quiesce_start();
      rte_vhost_driver_session_start();
      return NULL;
 }
@@ -1621,7 +1625,6 @@ start_cuse_session_loop(void *dummy OVS_UNUSED)
 static int
 dpdk_vhost_class_init(void)
 {
-    pthread_t thread;
     int err = -1;
 
     rte_vhost_driver_callback_register(&virtio_net_device_ops);
@@ -1637,9 +1640,8 @@ dpdk_vhost_class_init(void)
         return -1;
     }
 
-    /* start_cuse_session_loop blocks OVS RCU quiescent state, so directly use
-     * pthread API. */
-    return pthread_create(&thread, NULL, start_cuse_session_loop, NULL);
+    ovs_thread_create("cuse_thread", start_cuse_session_loop, NULL);
+    return 0;
 }
 
 static void
-- 
1.7.4.1

_______________________________________________
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev

Reply via email to