qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] virtio-net migration fix
@ 2009-01-06 11:44 Mark McLoughlin
  2009-01-06 17:26 ` [Qemu-devel] " Anthony Liguori
  0 siblings, 1 reply; 4+ messages in thread
From: Mark McLoughlin @ 2009-01-06 11:44 UTC (permalink / raw)
  To: Anthony Liguori; +Cc: Mark McLoughlin, qemu-devel

We are failing to save whether the guest will supply us rx
buffers using the new mergeable format; this can cause a
migrated guest to crash with:

   virtio-net header not in first element

Signed-off-by: Mark McLoughlin <markmc@redhat.com>
---
 hw/virtio-net.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/hw/virtio-net.c b/hw/virtio-net.c
index 1f45b2d..66d43d9 100644
--- a/hw/virtio-net.c
+++ b/hw/virtio-net.c
@@ -275,6 +275,7 @@ static void virtio_net_save(QEMUFile *f, void *opaque)
 
     qemu_put_buffer(f, n->mac, 6);
     qemu_put_be32(f, n->tx_timer_active);
+    qemu_put_be32(f, n->mergeable_rx_bufs);
 }
 
 static int virtio_net_load(QEMUFile *f, void *opaque, int version_id)
@@ -288,6 +289,7 @@ static int virtio_net_load(QEMUFile *f, void *opaque, int version_id)
 
     qemu_get_buffer(f, n->mac, 6);
     n->tx_timer_active = qemu_get_be32(f);
+    n->mergeable_rx_bufs = qemu_get_be32(f);
 
     if (n->tx_timer_active) {
         qemu_mod_timer(n->tx_timer,
-- 
1.6.0.6

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

* [Qemu-devel] Re: [PATCH] virtio-net migration fix
  2009-01-06 11:44 [Qemu-devel] [PATCH] virtio-net migration fix Mark McLoughlin
@ 2009-01-06 17:26 ` Anthony Liguori
  2009-01-07 10:20   ` Mark McLoughlin
  0 siblings, 1 reply; 4+ messages in thread
From: Anthony Liguori @ 2009-01-06 17:26 UTC (permalink / raw)
  To: Mark McLoughlin; +Cc: qemu-devel

Mark McLoughlin wrote:
> We are failing to save whether the guest will supply us rx
> buffers using the new mergeable format; this can cause a
> migrated guest to crash with:
>
>    virtio-net header not in first element
>   

We should bump the version number so that we can gracefully fail 
migrations where the dest or source end is broken.  I would make the 
virtio_net_load not accept version 1 saves too just to be on the safe side.

Regards,

Anthony Liguori

> Signed-off-by: Mark McLoughlin <markmc@redhat.com>
> ---
>  hw/virtio-net.c |    2 ++
>  1 files changed, 2 insertions(+), 0 deletions(-)
>
> diff --git a/hw/virtio-net.c b/hw/virtio-net.c
> index 1f45b2d..66d43d9 100644
> --- a/hw/virtio-net.c
> +++ b/hw/virtio-net.c
> @@ -275,6 +275,7 @@ static void virtio_net_save(QEMUFile *f, void *opaque)
>  
>      qemu_put_buffer(f, n->mac, 6);
>      qemu_put_be32(f, n->tx_timer_active);
> +    qemu_put_be32(f, n->mergeable_rx_bufs);
>  }
>  
>  static int virtio_net_load(QEMUFile *f, void *opaque, int version_id)
> @@ -288,6 +289,7 @@ static int virtio_net_load(QEMUFile *f, void *opaque, int version_id)
>  
>      qemu_get_buffer(f, n->mac, 6);
>      n->tx_timer_active = qemu_get_be32(f);
> +    n->mergeable_rx_bufs = qemu_get_be32(f);
>  
>      if (n->tx_timer_active) {
>          qemu_mod_timer(n->tx_timer,
>   

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

* [Qemu-devel] Re: [PATCH] virtio-net migration fix
  2009-01-06 17:26 ` [Qemu-devel] " Anthony Liguori
@ 2009-01-07 10:20   ` Mark McLoughlin
  2009-01-07 17:51     ` Anthony Liguori
  0 siblings, 1 reply; 4+ messages in thread
From: Mark McLoughlin @ 2009-01-07 10:20 UTC (permalink / raw)
  To: Anthony Liguori; +Cc: qemu-devel

On Tue, 2009-01-06 at 11:26 -0600, Anthony Liguori wrote:
> Mark McLoughlin wrote:
> > We are failing to save whether the guest will supply us rx
> > buffers using the new mergeable format; this can cause a
> > migrated guest to crash with:
> >
> >    virtio-net header not in first element
> >   
> 
> We should bump the version number so that we can gracefully fail 
> migrations where the dest or source end is broken.  I would make the 
> virtio_net_load not accept version 1 saves too just to be on the safe side.

Thanks, I should have seen that myself ...

Cheers,
Mark.

From: Mark McLoughlin <markmc@redhat.com>
Subject: [PATCH] virtio-net migration fix

We are failing to save whether the guest will supply us rx
buffers using the new mergeable format; this can cause a
migrated guest to crash with:

   virtio-net header not in first element

Bump the savevm version number and refuse to load v1 saves
just to be on the safe side.

Signed-off-by: Mark McLoughlin <markmc@redhat.com>
---
 hw/virtio-net.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/hw/virtio-net.c b/hw/virtio-net.c
index 1f45b2d..65a2cdd 100644
--- a/hw/virtio-net.c
+++ b/hw/virtio-net.c
@@ -275,19 +275,21 @@ static void virtio_net_save(QEMUFile *f, void *opaque)
 
     qemu_put_buffer(f, n->mac, 6);
     qemu_put_be32(f, n->tx_timer_active);
+    qemu_put_be32(f, n->mergeable_rx_bufs);
 }
 
 static int virtio_net_load(QEMUFile *f, void *opaque, int version_id)
 {
     VirtIONet *n = opaque;
 
-    if (version_id != 1)
+    if (version_id != 2)
         return -EINVAL;
 
     virtio_load(&n->vdev, f);
 
     qemu_get_buffer(f, n->mac, 6);
     n->tx_timer_active = qemu_get_be32(f);
+    n->mergeable_rx_bufs = qemu_get_be32(f);
 
     if (n->tx_timer_active) {
         qemu_mod_timer(n->tx_timer,
@@ -322,7 +324,7 @@ PCIDevice *virtio_net_init(PCIBus *bus, NICInfo *nd, int devfn)
     n->tx_timer_active = 0;
     n->mergeable_rx_bufs = 0;
 
-    register_savevm("virtio-net", virtio_net_id++, 1,
+    register_savevm("virtio-net", virtio_net_id++, 2,
                     virtio_net_save, virtio_net_load, n);
 
     return (PCIDevice *)n;
-- 
1.6.0.6

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

* [Qemu-devel] Re: [PATCH] virtio-net migration fix
  2009-01-07 10:20   ` Mark McLoughlin
@ 2009-01-07 17:51     ` Anthony Liguori
  0 siblings, 0 replies; 4+ messages in thread
From: Anthony Liguori @ 2009-01-07 17:51 UTC (permalink / raw)
  To: Mark McLoughlin; +Cc: qemu-devel


> Thanks, I should have seen that myself ...
>
> Cheers,
> Mark.
>
> From: Mark McLoughlin <markmc@redhat.com>
> Subject: [PATCH] virtio-net migration fix
>
> We are failing to save whether the guest will supply us rx
> buffers using the new mergeable format; this can cause a
> migrated guest to crash with:
>
>    virtio-net header not in first element
>
> Bump the savevm version number and refuse to load v1 saves
> just to be on the safe side.
>
> Signed-off-by: Mark McLoughlin <markmc@redhat.com>
>   

Applied.  Thanks.

Regards,

Anthony Liguori

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

end of thread, other threads:[~2009-01-07 17:51 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-01-06 11:44 [Qemu-devel] [PATCH] virtio-net migration fix Mark McLoughlin
2009-01-06 17:26 ` [Qemu-devel] " Anthony Liguori
2009-01-07 10:20   ` Mark McLoughlin
2009-01-07 17:51     ` Anthony Liguori

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).