Commit 376be52b authored by Changpeng Liu's avatar Changpeng Liu Committed by Ben Walker
Browse files

vhost: fix the coredump when perform live migration



QEMU will send SET_VRING_ADDR when perform live migration,
it's not correct to update the memory table while the device
is running.

Change-Id: I899d3a996355ab6aa69835d90da14a86f93240fa
Signed-off-by: default avatarChangpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.gerrithub.io/420944


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: default avatarPawel Wodkowski <pawelx.wodkowski@intel.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
Reviewed-by: default avatarBen Walker <benjamin.walker@intel.com>
parent 1f0bff73
Loading
Loading
Loading
Loading
+6 −7
Original line number Diff line number Diff line
@@ -364,21 +364,20 @@ vhost_user_set_vring_addr(struct virtio_net *dev, VhostUserMsg *msg)
	struct vhost_virtqueue *vq;
	uint64_t len;

	/* Remove from the data plane. */
	if (dev->flags & VIRTIO_DEV_RUNNING) {
		dev->flags &= ~VIRTIO_DEV_RUNNING;
		dev->notify_ops->destroy_device(dev->vid);
	}

	if (dev->has_new_mem_table) {
		vhost_setup_mem_table(dev);
		dev->has_new_mem_table = 0;
	}


	if (dev->mem == NULL)
		return -1;

	/* Remove from the data plane. */
	if (dev->flags & VIRTIO_DEV_RUNNING) {
		dev->flags &= ~VIRTIO_DEV_RUNNING;
		dev->notify_ops->destroy_device(dev->vid);
	}

	/* addr->index refers to the queue index. The txq 1, rxq is 0. */
	vq = dev->virtqueue[msg->payload.addr.index];