Skip to content

Commit

Permalink
netdev-dpdk: Fix dpdk_watchdog failure to quiesce.
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
kevintraynor authored and ddiproietto committed Feb 6, 2016
1 parent 4a627d4 commit 61c4e39
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 13 deletions.
1 change: 1 addition & 0 deletions AUTHORS
Expand Up @@ -356,6 +356,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
Expand Down
35 changes: 22 additions & 13 deletions lib/netdev-dpdk.c
Expand Up @@ -1888,6 +1888,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) {
Expand All @@ -1896,24 +1897,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 *
Expand Down

0 comments on commit 61c4e39

Please sign in to comment.