* [PATCH 1/1] kvm: qemu: virtio-net: migration fixes
@ 2009-01-06 11:48 Mark McLoughlin
2009-01-07 10:23 ` Mark McLoughlin
0 siblings, 1 reply; 5+ messages in thread
From: Mark McLoughlin @ 2009-01-06 11:48 UTC (permalink / raw)
To: Avi Kivity; +Cc: kvm, Mark McLoughlin
We were failing to save two important pieces of state:
1) Whether the guest will supply us rx buffers using the
new mergeable format; this caused the migrated guest
to crash with "virtio-net header not in first element"
2) Whether the tx/rx buffers we exchange with the tap
code should include a virtio_net_hdr header; this
caused the migrated guest to receive garbage packets
because the tap code was stripping away the header
and virtio_net was interpreting packet data as the
virtio_net header
With these fixes a guest using mergeable rx buffers and
GSO passes a simple "ping while migrating" test.
The mergeable rx buffers part has been sent upstream to
qemu-devel, but the GSO part is KVM specific.
Signed-off-by: Mark McLoughlin <markmc@redhat.com>
---
qemu/hw/virtio-net.c | 11 +++++++++++
1 files changed, 11 insertions(+), 0 deletions(-)
diff --git a/qemu/hw/virtio-net.c b/qemu/hw/virtio-net.c
index ef8f591..e47a0a4 100644
--- a/qemu/hw/virtio-net.c
+++ b/qemu/hw/virtio-net.c
@@ -360,6 +360,11 @@ 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);
+
+#ifdef TAP_VNET_HDR
+ qemu_put_be32(f, tap_has_vnet_hdr(n->vc->vlan->first_client));
+#endif
}
static int virtio_net_load(QEMUFile *f, void *opaque, int version_id)
@@ -373,6 +378,12 @@ 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);
+
+#ifdef TAP_VNET_HDR
+ if (qemu_get_be32(f))
+ tap_using_vnet_hdr(n->vc->vlan->first_client, 1);
+#endif
if (n->tx_timer_active) {
qemu_mod_timer(n->tx_timer,
--
1.6.0.6
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH 1/1] kvm: qemu: virtio-net: migration fixes
2009-01-06 11:48 [PATCH 1/1] kvm: qemu: virtio-net: migration fixes Mark McLoughlin
@ 2009-01-07 10:23 ` Mark McLoughlin
2009-01-08 14:11 ` Avi Kivity
2009-01-11 15:50 ` Avi Kivity
0 siblings, 2 replies; 5+ messages in thread
From: Mark McLoughlin @ 2009-01-07 10:23 UTC (permalink / raw)
To: Avi Kivity; +Cc: kvm
Hi Avi,
A new version, with Anthony's suggested savevm version number bump.
Cheers,
Mark.
From: Mark McLoughlin <markmc@redhat.com>
Subject: [PATCH] kvm: qemu: virtio-net: migration fixes
We were failing to save two important pieces of state:
1) Whether the guest will supply us rx buffers using the
new mergeable format; this caused the migrated guest
to crash with "virtio-net header not in first element"
2) Whether the tx/rx buffers we exchange with the tap
code should include a virtio_net_hdr header; this
caused the migrated guest to receive garbage packets
because the tap code was stripping away the header
and virtio_net was interpreting packet data as the
virtio_net header
With these fixes a guest using mergeable rx buffers and
GSO passes a simple "ping while migrating" test.
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>
---
qemu/hw/virtio-net.c | 15 +++++++++++++--
1 files changed, 13 insertions(+), 2 deletions(-)
diff --git a/qemu/hw/virtio-net.c b/qemu/hw/virtio-net.c
index ef8f591..dfe370a 100644
--- a/qemu/hw/virtio-net.c
+++ b/qemu/hw/virtio-net.c
@@ -360,19 +360,30 @@ 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);
+
+#ifdef TAP_VNET_HDR
+ qemu_put_be32(f, tap_has_vnet_hdr(n->vc->vlan->first_client));
+#endif
}
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);
+
+#ifdef TAP_VNET_HDR
+ if (qemu_get_be32(f))
+ tap_using_vnet_hdr(n->vc->vlan->first_client, 1);
+#endif
if (n->tx_timer_active) {
qemu_mod_timer(n->tx_timer,
@@ -407,7 +418,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] 5+ messages in thread
* Re: [PATCH 1/1] kvm: qemu: virtio-net: migration fixes
2009-01-07 10:23 ` Mark McLoughlin
@ 2009-01-08 14:11 ` Avi Kivity
2009-01-11 15:50 ` Avi Kivity
1 sibling, 0 replies; 5+ messages in thread
From: Avi Kivity @ 2009-01-08 14:11 UTC (permalink / raw)
To: Mark McLoughlin; +Cc: kvm
Mark McLoughlin wrote:
> Hi Avi,
>
> A new version, with Anthony's suggested savevm version number bump.
>
Applied, thanks. There wasn't much chance of me applying this before
Anthony; so next time please send an incremental patch.
--
error compiling committee.c: too many arguments to function
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 1/1] kvm: qemu: virtio-net: migration fixes
2009-01-07 10:23 ` Mark McLoughlin
2009-01-08 14:11 ` Avi Kivity
@ 2009-01-11 15:50 ` Avi Kivity
2009-01-11 15:51 ` Avi Kivity
1 sibling, 1 reply; 5+ messages in thread
From: Avi Kivity @ 2009-01-11 15:50 UTC (permalink / raw)
To: Mark McLoughlin; +Cc: kvm
Mark McLoughlin wrote:
> Hi Avi,
>
> A new version, with Anthony's suggested savevm version number bump.
>
I've already committed this as ea47a77149b1. Sorry if my previous
message gave the impression I didn't.
--
error compiling committee.c: too many arguments to function
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 1/1] kvm: qemu: virtio-net: migration fixes
2009-01-11 15:50 ` Avi Kivity
@ 2009-01-11 15:51 ` Avi Kivity
0 siblings, 0 replies; 5+ messages in thread
From: Avi Kivity @ 2009-01-11 15:51 UTC (permalink / raw)
To: Mark McLoughlin; +Cc: kvm
Avi Kivity wrote:
> Mark McLoughlin wrote:
>> Hi Avi,
>>
>> A new version, with Anthony's suggested savevm version number bump.
>>
>
> I've already committed this as ea47a77149b1. Sorry if my previous
> message gave the impression I didn't.
>
>
Oops. For some reason I though this was a new message.
--
error compiling committee.c: too many arguments to function
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2009-01-11 15:51 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-01-06 11:48 [PATCH 1/1] kvm: qemu: virtio-net: migration fixes Mark McLoughlin
2009-01-07 10:23 ` Mark McLoughlin
2009-01-08 14:11 ` Avi Kivity
2009-01-11 15:50 ` Avi Kivity
2009-01-11 15:51 ` Avi Kivity
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).