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 <[email protected]>
Signed-off-by: Patrik Andersson R <[email protected]>
Signed-off-by: Kevin Traynor <[email protected]>
Signed-off-by: Daniele Di Proietto <[email protected]>
  • Loading branch information
kevintraynor authored and ddiproietto committed Feb 6, 2016
1 parent e752914 commit afee281
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 13 deletions.
1 change: 1 addition & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -360,6 +360,7 @@ Niels van Adrichem [email protected]
Niklas Andersson [email protected]
Pankaj Thakkar [email protected]
Pasi Kärkkäinen [email protected]
Patrik Andersson R [email protected]
Paulo Cravero [email protected]
Pawan Shukla [email protected]
Peter Amidon [email protected]
Expand Down
35 changes: 22 additions & 13 deletions lib/netdev-dpdk.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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 *
Expand Down

0 comments on commit afee281

Please sign in to comment.