[fedora-virt] [PATCH 4/7] vhost: used addr migration fix
Michael S. Tsirkin
mst at redhat.com
Wed Feb 24 19:09:54 UTC 2010
Enable used buffer logging when migration starts.
Fixed 'id XX is not a head' message after migration.
Signed-off-by: Michael S. Tsirkin <mst at redhat.com>
---
hw/vhost.c | 29 +++++++++++++++++++++++++++--
1 files changed, 27 insertions(+), 2 deletions(-)
diff --git a/hw/vhost.c b/hw/vhost.c
index 54386e1..48034ba 100644
--- a/hw/vhost.c
+++ b/hw/vhost.c
@@ -325,7 +325,7 @@ static int vhost_virtqueue_set_addr(struct vhost_dev *dev,
return 0;
}
-static int vhost_dev_set_log(struct vhost_dev *dev, bool enable_log)
+static int vhost_dev_set_features(struct vhost_dev *dev, bool enable_log)
{
uint64_t features = dev->acked_features;
int r;
@@ -336,6 +336,31 @@ static int vhost_dev_set_log(struct vhost_dev *dev, bool enable_log)
return r < 0 ? -errno : 0;
}
+static int vhost_dev_set_log(struct vhost_dev *dev, bool enable_log)
+{
+ int r, t, i;
+ r = vhost_dev_set_features(dev, enable_log);
+ if (r < 0)
+ goto err_features;
+ for (i = 0; i < dev->nvqs; ++i) {
+ r = vhost_virtqueue_set_addr(dev, dev->vqs + i, i,
+ enable_log);
+ if (r < 0)
+ goto err_vq;
+ }
+ return 0;
+err_vq:
+ for (; i >= 0; --i) {
+ t = vhost_virtqueue_set_addr(dev, dev->vqs + i, i,
+ dev->log_enabled);
+ assert(t >= 0);
+ }
+ t = vhost_dev_set_features(dev, dev->log_enabled);
+ assert(t >= 0);
+err_features:
+ return r;
+}
+
static int vhost_client_migration_log(struct CPUPhysMemoryClient *client,
int enable)
{
@@ -544,7 +569,7 @@ int vhost_dev_start(struct vhost_dev *hdev, VirtIODevice *vdev)
{
int i, r;
- r = vhost_dev_set_log(hdev, hdev->log_enabled);
+ r = vhost_dev_set_features(hdev, hdev->log_enabled);
if (r < 0)
goto fail;
r = ioctl(hdev->control, VHOST_SET_MEM_TABLE, hdev->mem);
--
1.7.0.18.g0d53a5
More information about the virt
mailing list