netdev-dpdk: Fix dpdk_watchdog failure to quiesce.
authorKevin Traynor <kevin.traynor@intel.com>
Fri, 5 Feb 2016 17:07:16 +0000 (17:07 +0000)
committerDaniele Di Proietto <diproiettod@vmware.com>
Sat, 6 Feb 2016 03:06:00 +0000 (19:06 -0800)
Fix issue whereby vhost_thread is waiting for dpdk_watchdog
thread to quiesce and at the same time dpdk_watchdog thread
is waiting for vhost_thread to give up dpdk_mutex.

Reported-by: Patrik Andersson R <patrik.r.andersson@ericsson.com>
Signed-off-by: Patrik Andersson R <patrik.r.andersson@ericsson.com>
Signed-off-by: Kevin Traynor <kevin.traynor@intel.com>
Signed-off-by: Daniele Di Proietto <diproiettod@vmware.com>
AUTHORS
lib/netdev-dpdk.c

diff --git a/AUTHORS b/AUTHORS
index 492f91a..3539e55 100644 (file)
--- a/AUTHORS
+++ b/AUTHORS
@@ -360,6 +360,7 @@ Niels van Adrichem      N.L.M.vanAdrichem@tudelft.nl
 Niklas Andersson        nandersson@nicira.com
 Pankaj Thakkar          thakkar@nicira.com
 Pasi Kärkkäinen         pasik@iki.fi
+Patrik Andersson R      patrik.r.andersson@ericsson.com
 Paulo Cravero           pcravero@as2594.net
 Pawan Shukla            shuklap@vmware.com
 Peter Amidon            peter@picnicpark.org
index 2a479e2..e4f789b 100644 (file)
@@ -1904,6 +1904,7 @@ static void
 destroy_device(volatile struct virtio_net *dev)
 {
     struct netdev_dpdk *vhost_dev;
+    bool exists = false;
 
     ovs_mutex_lock(&dpdk_mutex);
     LIST_FOR_EACH (vhost_dev, list_node, &dpdk_list) {
@@ -1912,24 +1913,32 @@ destroy_device(volatile struct virtio_net *dev)
             ovs_mutex_lock(&vhost_dev->mutex);
             dev->flags &= ~VIRTIO_DEV_RUNNING;
             ovsrcu_set(&vhost_dev->virtio_dev, NULL);
+            exists = true;
             ovs_mutex_unlock(&vhost_dev->mutex);
-
-            /*
-             * Wait for other threads to quiesce before
-             * setting the virtio_dev to NULL.
-             */
-            ovsrcu_synchronize();
-            /*
-             * As call to ovsrcu_synchronize() will end the quiescent state,
-             * put thread back into quiescent state before returning.
-             */
-            ovsrcu_quiesce_start();
+            break;
         }
     }
+
     ovs_mutex_unlock(&dpdk_mutex);
 
-    VLOG_INFO("vHost Device '%s' %"PRIu64" has been removed", dev->ifname,
-              dev->device_fh);
+    if (exists == true) {
+        /*
+         * Wait for other threads to quiesce after setting the 'virtio_dev'
+         * to NULL, before returning.
+         */
+        ovsrcu_synchronize();
+        /*
+         * As call to ovsrcu_synchronize() will end the quiescent state,
+         * put thread back into quiescent state before returning.
+         */
+        ovsrcu_quiesce_start();
+        VLOG_INFO("vHost Device '%s' %"PRIu64" has been removed", dev->ifname,
+                  dev->device_fh);
+    } else {
+        VLOG_INFO("vHost Device '%s' %"PRIu64" not found", dev->ifname,
+                  dev->device_fh);
+    }
+
 }
 
 struct virtio_net *