qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] virtio-migration: Migrate config vector for virtio devices
@ 2015-06-03 15:04 Jason J. Herne
  2015-06-03 15:42 ` Christian Borntraeger
  2015-06-03 15:44 ` Michael S. Tsirkin
  0 siblings, 2 replies; 4+ messages in thread
From: Jason J. Herne @ 2015-06-03 15:04 UTC (permalink / raw)
  To: dahi, amit.shah, dgilbert, borntraeger, quintela, qemu-devel,
	cornelia.huck, mst, pbonzini
  Cc: 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.

Signed-off-by: Jason J. Herne <jjherne@linux.vnet.ibm.com>
---
 hw/s390x/virtio-ccw.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/hw/s390x/virtio-ccw.c b/hw/s390x/virtio-ccw.c
index ef90fed..05eaee2 100644
--- a/hw/s390x/virtio-ccw.c
+++ b/hw/s390x/virtio-ccw.c
@@ -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) {
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] [PATCH] virtio-migration: Migrate config vector for virtio devices
  2015-06-03 15:04 [Qemu-devel] [PATCH] virtio-migration: Migrate config vector for virtio devices Jason J. Herne
@ 2015-06-03 15:42 ` Christian Borntraeger
  2015-06-03 15:44   ` Michael S. Tsirkin
  2015-06-03 15:44 ` Michael S. Tsirkin
  1 sibling, 1 reply; 4+ messages in thread
From: Christian Borntraeger @ 2015-06-03 15:42 UTC (permalink / raw)
  To: Jason J. Herne, dahi, amit.shah, dgilbert, quintela, qemu-devel,
	cornelia.huck, mst, pbonzini

Am 03.06.2015 um 17:04 schrieb 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.
> 
> Signed-off-by: Jason J. Herne <jjherne@linux.vnet.ibm.com>

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.

> ---
>  hw/s390x/virtio-ccw.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/hw/s390x/virtio-ccw.c b/hw/s390x/virtio-ccw.c
> index ef90fed..05eaee2 100644
> --- a/hw/s390x/virtio-ccw.c
> +++ b/hw/s390x/virtio-ccw.c
> @@ -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) {
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] [PATCH] virtio-migration: Migrate config vector for virtio devices
  2015-06-03 15:04 [Qemu-devel] [PATCH] virtio-migration: Migrate config vector for virtio devices Jason J. Herne
  2015-06-03 15:42 ` Christian Borntraeger
@ 2015-06-03 15:44 ` Michael S. Tsirkin
  1 sibling, 0 replies; 4+ messages in thread
From: Michael S. Tsirkin @ 2015-06-03 15:44 UTC (permalink / raw)
  To: Jason J. Herne
  Cc: cornelia.huck, quintela, qemu-devel, dgilbert, dahi, amit.shah,
	pbonzini, borntraeger

On Wed, Jun 03, 2015 at 11:04:03AM -0400, Jason J. Herne wrote:
> 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.
> 
> Signed-off-by: Jason J. Herne <jjherne@linux.vnet.ibm.com>

Reviewed-by: Michael S. Tsirkin <mst@redhat.com>

> ---
>  hw/s390x/virtio-ccw.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/hw/s390x/virtio-ccw.c b/hw/s390x/virtio-ccw.c
> index ef90fed..05eaee2 100644
> --- a/hw/s390x/virtio-ccw.c
> +++ b/hw/s390x/virtio-ccw.c
> @@ -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) {
> -- 
> 1.9.1

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] [PATCH] virtio-migration: Migrate config vector for virtio devices
  2015-06-03 15:42 ` Christian Borntraeger
@ 2015-06-03 15:44   ` Michael S. Tsirkin
  0 siblings, 0 replies; 4+ messages in thread
From: Michael S. Tsirkin @ 2015-06-03 15:44 UTC (permalink / raw)
  To: Christian Borntraeger
  Cc: cornelia.huck, quintela, qemu-devel, dgilbert, dahi,
	Jason J. Herne, amit.shah, pbonzini

On Wed, Jun 03, 2015 at 05:42:17PM +0200, Christian Borntraeger wrote:
> Am 03.06.2015 um 17:04 schrieb 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.
> > 
> > Signed-off-by: Jason J. Herne <jjherne@linux.vnet.ibm.com>
> 
> 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.

> > ---
> >  hw/s390x/virtio-ccw.c | 4 ++++
> >  1 file changed, 4 insertions(+)
> > 
> > diff --git a/hw/s390x/virtio-ccw.c b/hw/s390x/virtio-ccw.c
> > index ef90fed..05eaee2 100644
> > --- a/hw/s390x/virtio-ccw.c
> > +++ b/hw/s390x/virtio-ccw.c
> > @@ -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) {
> > 

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-06-03 15:44 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-06-03 15:04 [Qemu-devel] [PATCH] virtio-migration: Migrate config vector for virtio devices Jason J. Herne
2015-06-03 15:42 ` Christian Borntraeger
2015-06-03 15:44   ` Michael S. Tsirkin
2015-06-03 15:44 ` Michael S. Tsirkin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).