From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LKVX7-00038h-Mt for qemu-devel@nongnu.org; Wed, 07 Jan 2009 05:21:05 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LKVX5-00038R-WB for qemu-devel@nongnu.org; Wed, 07 Jan 2009 05:21:05 -0500 Received: from [199.232.76.173] (port=45376 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LKVX5-00038K-LG for qemu-devel@nongnu.org; Wed, 07 Jan 2009 05:21:03 -0500 Received: from mx2.redhat.com ([66.187.237.31]:60459) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1LKVX4-0004fv-G6 for qemu-devel@nongnu.org; Wed, 07 Jan 2009 05:21:03 -0500 From: Mark McLoughlin In-Reply-To: <4963943C.8060304@codemonkey.ws> References: <1231242281-2597-1-git-send-email-markmc@redhat.com> <4963943C.8060304@codemonkey.ws> Content-Type: text/plain Date: Wed, 07 Jan 2009 10:20:50 +0000 Message-Id: <1231323650.5050.8.camel@localhost.localdomain> Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [Qemu-devel] Re: [PATCH] virtio-net migration fix Reply-To: Mark McLoughlin , qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Anthony Liguori Cc: qemu-devel@nongnu.org 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 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 --- 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