dcavalca / rpms / qemu

Forked from rpms/qemu a year ago
Clone

Blame 0041-vhost-used-addr-migration-fix.patch

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