Commit 29181903 authored by Pawel Wodkowski's avatar Pawel Wodkowski Committed by Jim Harris
Browse files

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: default avatarPawel Wodkowski <pawelx.wodkowski@intel.com>
Reviewed-on: https://review.gerrithub.io/395514


Reviewed-by: default avatarDariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-by: default avatarDaniel Verkamp <daniel.verkamp@intel.com>
Tested-by: default avatarSPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
parent a4f3920d
Loading
Loading
Loading
Loading
+15 −0
Original line number Diff line number Diff line
@@ -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) {