Skip to contentSkip to conversation

virtio-migration: Migrate config vector for virtio devices

PATCH In review Jason J. Herne 3 participants 4 messages Jun 3, 2015

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 virtio-migration: Migrate config vector for virtio devices

virtio_ccw_{save|load}_config are missing code to save and restore a vdev's config_vector value. This causes some virtio devices to become disabled following a migration.

This patch fixes a bug whereby the qmp/hmp balloon command (virsh setmem) silently fails to update the guest's available memory because the device was not properly migrated.

---
 hw/s390x/virtio-ccw.c | 4 ++++
 1 file changed, 4 insertions(+)
hw/s390x/virtio-ccw.c +4 -0
index ef90fed..05eaee2 100644
@@ -1310,6 +1310,7 @@ static void virtio_ccw_save_config(DeviceState *d, QEMUFile *f)
 {
     VirtioCcwDevice *dev = VIRTIO_CCW_DEVICE(d);
     SubchDev *s = dev->sch;
+    VirtIODevice *vdev = virtio_ccw_get_vdev(s);
 
     subch_device_save(s, f);
     if (dev->indicators != NULL) {
@@ -1333,6 +1334,7 @@ static void virtio_ccw_save_config(DeviceState *d, QEMUFile *f)
         qemu_put_be32(f, 0);
         qemu_put_be64(f, 0UL);
     }
+    qemu_put_be16(f, vdev->config_vector);
     qemu_put_be64(f, dev->routes.adapter.ind_offset);
     qemu_put_byte(f, dev->thinint_isc);
 }
@@ -1341,6 +1343,7 @@ static int virtio_ccw_load_config(DeviceState *d, QEMUFile *f)
 {
     VirtioCcwDevice *dev = VIRTIO_CCW_DEVICE(d);
     SubchDev *s = dev->sch;
+    VirtIODevice *vdev = virtio_ccw_get_vdev(s);
     int len;
 
     s->driver_data = dev;
@@ -1366,6 +1369,7 @@ static int virtio_ccw_load_config(DeviceState *d, QEMUFile *f)
         qemu_get_be64(f);
         dev->summary_indicator = NULL;
     }
+    qemu_get_be16s(f, &vdev->config_vector);
     dev->routes.adapter.ind_offset = qemu_get_be64(f);
     dev->thinint_isc = qemu_get_byte(f);
     if (s->thinint_active) {
Signature · 1 line
1.9.1
#1 lore raw

Am 03.06.2015 um 17:04 schrieb Jason J. Herne:

Quoted 9 lines

virtio_ccw_{save|load}_config are missing code to save and restore a vdev's config_vector value. This causes some virtio devices to become disabled following a migration.

This patch fixes a bug whereby the qmp/hmp balloon command (virsh setmem) silently fails to update the guest's available memory because the device was not properly migrated.

Will apply to my s390 branch with a slightly modified subject (virtio-ccw/migration:) and will add some explanation about how the machine cpu state version change between v2.3 and v2.4 will protect us.

Thanks.

Quoted 41 lines
---
 hw/s390x/virtio-ccw.c | 4 ++++
 1 file changed, 4 insertions(+)
hw/s390x/virtio-ccw.c +4 -0
index ef90fed..05eaee2 100644
@@ -1310,6 +1310,7 @@ static void virtio_ccw_save_config(DeviceState *d, QEMUFile *f)
 {
     VirtioCcwDevice *dev = VIRTIO_CCW_DEVICE(d);
     SubchDev *s = dev->sch;
+    VirtIODevice *vdev = virtio_ccw_get_vdev(s);
 
     subch_device_save(s, f);
     if (dev->indicators != NULL) {
@@ -1333,6 +1334,7 @@ static void virtio_ccw_save_config(DeviceState *d, QEMUFile *f)
         qemu_put_be32(f, 0);
         qemu_put_be64(f, 0UL);
     }
+    qemu_put_be16(f, vdev->config_vector);
     qemu_put_be64(f, dev->routes.adapter.ind_offset);
     qemu_put_byte(f, dev->thinint_isc);
 }
@@ -1341,6 +1343,7 @@ static int virtio_ccw_load_config(DeviceState *d, QEMUFile *f)
 {
     VirtioCcwDevice *dev = VIRTIO_CCW_DEVICE(d);
     SubchDev *s = dev->sch;
+    VirtIODevice *vdev = virtio_ccw_get_vdev(s);
     int len;
 
     s->driver_data = dev;
@@ -1366,6 +1369,7 @@ static int virtio_ccw_load_config(DeviceState *d, QEMUFile *f)
         qemu_get_be64(f);
         dev->summary_indicator = NULL;
     }
+    qemu_get_be16s(f, &vdev->config_vector);
     dev->routes.adapter.ind_offset = qemu_get_be64(f);
     dev->thinint_isc = qemu_get_byte(f);
     if (s->thinint_active) {
Reviewed-by on v1 1/1
#3 lore raw
In reply to Jason J. Herne
Quoted 9 lines · Jason J. Herne

virtio_ccw_{save|load}_config are missing code to save and restore a vdev's config_vector value. This causes some virtio devices to become disabled following a migration.

This patch fixes a bug whereby the qmp/hmp balloon command (virsh setmem) silently fails to update the guest's available memory because the device was not properly migrated.

Quoted 42 lines
---
 hw/s390x/virtio-ccw.c | 4 ++++
 1 file changed, 4 insertions(+)
hw/s390x/virtio-ccw.c +4 -0
index ef90fed..05eaee2 100644
@@ -1310,6 +1310,7 @@ static void virtio_ccw_save_config(DeviceState *d, QEMUFile *f)
 {
     VirtioCcwDevice *dev = VIRTIO_CCW_DEVICE(d);
     SubchDev *s = dev->sch;
+    VirtIODevice *vdev = virtio_ccw_get_vdev(s);
 
     subch_device_save(s, f);
     if (dev->indicators != NULL) {
@@ -1333,6 +1334,7 @@ static void virtio_ccw_save_config(DeviceState *d, QEMUFile *f)
         qemu_put_be32(f, 0);
         qemu_put_be64(f, 0UL);
     }
+    qemu_put_be16(f, vdev->config_vector);
     qemu_put_be64(f, dev->routes.adapter.ind_offset);
     qemu_put_byte(f, dev->thinint_isc);
 }
@@ -1341,6 +1343,7 @@ static int virtio_ccw_load_config(DeviceState *d, QEMUFile *f)
 {
     VirtioCcwDevice *dev = VIRTIO_CCW_DEVICE(d);
     SubchDev *s = dev->sch;
+    VirtIODevice *vdev = virtio_ccw_get_vdev(s);
     int len;
 
     s->driver_data = dev;
@@ -1366,6 +1369,7 @@ static int virtio_ccw_load_config(DeviceState *d, QEMUFile *f)
         qemu_get_be64(f);
         dev->summary_indicator = NULL;
     }
+    qemu_get_be16s(f, &vdev->config_vector);
     dev->routes.adapter.ind_offset = qemu_get_be64(f);
     dev->thinint_isc = qemu_get_byte(f);
     if (s->thinint_active) {
Signature · 1 line
1.9.1
#2 lore raw
In reply to Christian Borntraeger
Quoted 9 lines · Christian Borntraeger

Am 03.06.2015 um 17:04 schrieb Jason J. Herne:

Quoted 8 lines

virtio_ccw_{save|load}_config are missing code to save and restore a vdev's config_vector value. This causes some virtio devices to become disabled following a migration.

This patch fixes a bug whereby the qmp/hmp balloon command (virsh setmem) silently fails to update the guest's available memory because the device was not properly migrated.

Quoted 7 lines
Quoted 1 line

Will apply to my s390 branch with a slightly modified subject (virtio-ccw/migration:) and will add some explanation about how the machine cpu state version change between v2.3 and v2.4 will protect us.

Thanks.

OK I queued this but I can back it out. Sent a review tag.

Quoted 41 lines
Quoted 41 lines
---
 hw/s390x/virtio-ccw.c | 4 ++++
 1 file changed, 4 insertions(+)
hw/s390x/virtio-ccw.c +4 -0
index ef90fed..05eaee2 100644
@@ -1310,6 +1310,7 @@ static void virtio_ccw_save_config(DeviceState *d, QEMUFile *f)
 {
     VirtioCcwDevice *dev = VIRTIO_CCW_DEVICE(d);
     SubchDev *s = dev->sch;
+    VirtIODevice *vdev = virtio_ccw_get_vdev(s);
 
     subch_device_save(s, f);
     if (dev->indicators != NULL) {
@@ -1333,6 +1334,7 @@ static void virtio_ccw_save_config(DeviceState *d, QEMUFile *f)
         qemu_put_be32(f, 0);
         qemu_put_be64(f, 0UL);
     }
+    qemu_put_be16(f, vdev->config_vector);
     qemu_put_be64(f, dev->routes.adapter.ind_offset);
     qemu_put_byte(f, dev->thinint_isc);
 }
@@ -1341,6 +1343,7 @@ static int virtio_ccw_load_config(DeviceState *d, QEMUFile *f)
 {
     VirtioCcwDevice *dev = VIRTIO_CCW_DEVICE(d);
     SubchDev *s = dev->sch;
+    VirtIODevice *vdev = virtio_ccw_get_vdev(s);
     int len;
 
     s->driver_data = dev;
@@ -1366,6 +1369,7 @@ static int virtio_ccw_load_config(DeviceState *d, QEMUFile *f)
         qemu_get_be64(f);
         dev->summary_indicator = NULL;
     }
+    qemu_get_be16s(f, &vdev->config_vector);
     dev->routes.adapter.ind_offset = qemu_get_be64(f);
     dev->thinint_isc = qemu_get_byte(f);
     if (s->thinint_active) {