vhost: prevent IO freeze by kicking all queues after starting device

See comment in vhost.c file for more details why this fix is needed.

Change-Id: I782119768fb200ad36f9253e704cc08a3be36ae6
Signed-off-by: Pawel Wodkowski <pawelx.wodkowski@intel.com>
Reviewed-on: https://review.gerrithub.io/395514
Reviewed-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
Pawel Wodkowski 2018-01-18 19:27:41 +01:00 committed by Jim Harris
parent a4f3920d51
commit 29181903ce

View File

@ -985,6 +985,21 @@ start_device(int vid)
goto out;
}
/*
* Not sure right now but this look like some kind of QEMU bug and guest IO
* might be frozed without kicking all queues after live-migration. This look like
* the previous vhost instance failed to effectively deliver all interrupts before
* the GET_VRING_BASE message. This shouldn't harm guest since spurious interrupts
* should be ignored by guest virtio driver.
*
* Tested on QEMU 2.10.91 and 2.11.50.
*/
for (i = 0; i < num_queues; i++) {
if (vdev->virtqueue[i].vring.callfd != -1) {
eventfd_write(vdev->virtqueue[i].vring.callfd, (eventfd_t)1);
}
}
vdev->lcore = spdk_vhost_allocate_reactor(vdev->cpumask);
rc = spdk_vhost_event_send(vdev, vdev->backend->start_device, 3, "start device");
if (rc != 0) {