Log must be started before backend is enabled, to make sure no memory changes are untracked.
Signed-off-by: Michael S. Tsirkin <m...@redhat.com> --- hw/vhost.c | 20 ++++++++++---------- 1 files changed, 10 insertions(+), 10 deletions(-) diff --git a/hw/vhost.c b/hw/vhost.c index 8586f66..e0152e2 100644 --- a/hw/vhost.c +++ b/hw/vhost.c @@ -650,15 +650,6 @@ int vhost_dev_start(struct vhost_dev *hdev, VirtIODevice *vdev) r = -errno; goto fail_mem; } - for (i = 0; i < hdev->nvqs; ++i) { - r = vhost_virtqueue_init(hdev, - vdev, - hdev->vqs + i, - i); - if (r < 0) { - goto fail_vq; - } - } if (hdev->log_enabled) { hdev->log_size = vhost_get_log_size(hdev); @@ -671,11 +662,19 @@ int vhost_dev_start(struct vhost_dev *hdev, VirtIODevice *vdev) goto fail_log; } } + for (i = 0; i < hdev->nvqs; ++i) { + r = vhost_virtqueue_init(hdev, + vdev, + hdev->vqs + i, + i); + if (r < 0) { + goto fail_vq; + } + } hdev->started = true; return 0; -fail_log: fail_vq: while (--i >= 0) { vhost_virtqueue_cleanup(hdev, @@ -683,6 +682,7 @@ fail_vq: hdev->vqs + i, i); } +fail_log: fail_mem: fail_features: vdev->binding->set_guest_notifiers(vdev->binding_opaque, false); -- 1.7.3-rc1