Skip to contentSkip to conversation

networking in lguest: strange error: lguest: Guest moved used index from 6 to 256

Lguest Dor Laor 4 participants 8 messages Mar 5, 2008 – Mar 6, 2008 3 messages not in the archive

Subsystems (2)
lore
Share & tools
lore

Dor Laor

author
#2 lore raw
In reply to a message not in the archive
Quoted 19 lines · Rusty Russell
Quoted 11 lines · On Tuesday 04 March 2008 03:05:16 octane indice wrote:

Hello

I have some difficulty to use network inside lguest. I use a slackware 12 for guest and host with a 2.6.24 kernel.

I boot lguest like that:

# tunctl
# ifconfig tap0 192.168.19.1
# lguest --tunnet=192.168.19.1 --block=/var/samba/iso/lguest.img 48
/usr/src/linux/arch/i386/boot/bzImage root=/dev/vda rw
Quoted 6 lines

The init script files try to do a DHCP. It doesn't work (I do'nt have a DHCP server).

If in the host I try to configure the eth0, lguest crashes strangely:

root@slack12:~# ifconfig eth0 192.168.19.5
root@slack12:~# lguest: Guest moved used index from 6 to 256
Quoted 9 lines

Damn. This is fixed in Linus' tree, but I've reproduced it here for 2.6.24.

It's non-trivial to repair, unfortunately (2.6.25 has a complete reset
infrastructure for this). It will occur whenever the network device is reopened, after packets were sent (or received).

The workaround is to disable the dhcp in the init scripts...

You can also try to use backport scripts that automatically backport virtio to older guest kernels >= 2.6.18.
It was written by Anthony Liguori and was decorated also by Avi and myself.
Seems to work reliably with kvm, should do the same trick for lguest. You can download it from
git://kvm.qumranet.com/home/dor/src/kvm-guest-drivers-linux

Anthony, you can update your mercurial repository with our changes.

Cheers,
Dor

Quoted 6 lines

Thanks for the report,
Rusty.
_______________________________________________
Lguest mailing list
[email protected]
https://ozlabs.org/mailman/listinfo/lguest

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/

author
#10 lore raw
In reply to a message not in the archive
Quoted 19 lines · Rusty Russell
Quoted 11 lines · On Tuesday 04 March 2008 03:05:16 octane indice wrote:

Hello

I have some difficulty to use network inside lguest. I use a slackware 12 for guest and host with a 2.6.24 kernel.

I boot lguest like that:

# tunctl
# ifconfig tap0 192.168.19.1
# lguest --tunnet=192.168.19.1 --block=/var/samba/iso/lguest.img 48
/usr/src/linux/arch/i386/boot/bzImage root=/dev/vda rw
Quoted 6 lines

The init script files try to do a DHCP. It doesn't work (I do'nt have a DHCP server).

If in the host I try to configure the eth0, lguest crashes strangely:

root@slack12:~# ifconfig eth0 192.168.19.5
root@slack12:~# lguest: Guest moved used index from 6 to 256
Quoted 9 lines

Damn. This is fixed in Linus' tree, but I've reproduced it here for 2.6.24.

It's non-trivial to repair, unfortunately (2.6.25 has a complete reset
infrastructure for this). It will occur whenever the network device is reopened, after packets were sent (or received).

The workaround is to disable the dhcp in the init scripts...

You can also try to use backport scripts that automatically backport virtio to older guest kernels >= 2.6.18.
It was written by Anthony Liguori and was decorated also by Avi and myself.
Seems to work reliably with kvm, should do the same trick for lguest. You can download it from
git://kvm.qumranet.com/home/dor/src/kvm-guest-drivers-linux

Anthony, you can update your mercurial repository with our changes.

Cheers,
Dor

Quoted 6 lines

Thanks for the report,
Rusty.
_______________________________________________
Lguest mailing list
[email protected]
https://ozlabs.org/mailman/listinfo/lguest

#4 lore raw
In reply to a message not in the archive
Quoted 6 lines · Dor Laor

Seems to work reliably with kvm, should do the same trick for lguest. You can download it from
git://kvm.qumranet.com/home/dor/src/kvm-guest-drivers-linux

Anthony, you can update your mercurial repository with our changes.

Hrm, I thought we were standardizing on
http://www.kernel.org/pub/scm/virt/kvm/kvm-guest-drivers-linux.git

I'll just kill my mercurial repository.

Regards,

Anthony Liguori

Quoted 14 lines

Cheers,
Dor

Quoted 7 lines

Thanks for the report,
Rusty.
_______________________________________________
Lguest mailing list
[email protected]
https://ozlabs.org/mailman/listinfo/lguest

#9 lore raw
In reply to Dor Laor
Quoted 6 lines · Dor Laor

Seems to work reliably with kvm, should do the same trick for lguest. You can download it from
git://kvm.qumranet.com/home/dor/src/kvm-guest-drivers-linux

Anthony, you can update your mercurial repository with our changes.

Hrm, I thought we were standardizing on
http://www.kernel.org/pub/scm/virt/kvm/kvm-guest-drivers-linux.git

I'll just kill my mercurial repository.

Regards,

Anthony Liguori

Quoted 14 lines

Cheers,
Dor

Quoted 7 lines

Thanks for the report,
Rusty.
_______________________________________________
Lguest mailing list
[email protected]
https://ozlabs.org/mailman/listinfo/lguest

author
#5 lore raw
In reply to Anthony Liguori
Quoted 11 lines · Anthony Liguori
Quoted 6 lines · Dor Laor

Seems to work reliably with kvm, should do the same trick for lguest. You can download it from
git://kvm.qumranet.com/home/dor/src/kvm-guest-drivers-linux

Anthony, you can update your mercurial repository with our changes.

Hrm, I thought we were standardizing on
http://www.kernel.org/pub/scm/virt/kvm/kvm-guest-drivers-linux.git

Better this way, attached 3 patches needed for compilation.

Quoted 20 lines

I'll just kill my mercurial repository.
Regards,

Anthony Liguori

Quoted 14 lines

Cheers,
Dor

Quoted 7 lines

Thanks for the report,
Rusty.
_______________________________________________
Lguest mailing list
[email protected]
https://ozlabs.org/mailman/listinfo/lguest

Quoted 1 line

From 803214241ba3750fc945c271e4a422389b0d8fdb Mon Sep 17 00:00:00 2001

From: Dor Laor <[email protected]>
Date: Mon, 3 Mar 2008 17:28:57 +0200
Subject: [PATCH 1/3] Backward compat to replace napi in *rx_schedule*

---
 hack-module.awk |   28 +++++++++++++++++++++++++++-
 1 files changed, 27 insertions(+), 1 deletions(-)
hack-module.awk +27 -1
index 580090b..bd63fb9 100644
@@ -45,8 +45,8 @@
     print "		return 1;";
     print "	}";
     print "";
-    print "	no_work = vi->rvq->vq_ops->enable_cb(vi->rvq);";
     print "	netif_rx_complete(vi->dev);";
+    print "	no_work = vi->rvq->vq_ops->enable_cb(vi->rvq);";
     print "";
     print "	if (!no_work && netif_rx_reschedule(vi->dev, received)) {";
     print "		skb = NULL;";
@@ -62,6 +62,32 @@
     virtnet_poll = 1
 }
 
+/\tnetif_rx_schedule\(/ {
+    print "#ifdef COMPAT_napi";
+    print "	vi->rvq->vq_ops->enable_cb(vi->rvq);";
+    print "	if (netif_rx_schedule_prep(vi->dev)) {";
+    print "		vi->rvq->vq_ops->disable_cb(vi->rvq);";
+    print "		__netif_rx_schedule(vi->dev);";
+    print "	} else";
+    print "		vi->rvq->vq_ops->enable_cb(vi->rvq);";
+    print "#else";
+    need_endif = 1
+}
+
+/netif_rx_schedule_prep/ {
+    print "#ifdef COMPAT_napi";
+    print "\tif (netif_rx_schedule_prep(vi->dev)) {";
+    print "#else";
+    need_endif = 1
+}
+
+/__netif_rx_schedule/ {
+    print "#ifdef COMPAT_napi";
+    print "\t\t__netif_rx_schedule(vi->dev);";
+    print "#else";
+    need_endif = 1
+}
+
 /dev->stats/ {
     print "#ifndef COMPAT_net_stats";
     need_endif = 1
Signature · 1 line
1.5.4.1
Quoted 1 line

From 22b2b6c7b480bc712f93e48816675d88162b8963 Mon Sep 17 00:00:00 2001

From: Dor Laor <[email protected]>
Date: Wed, 5 Mar 2008 16:40:29 +0200
Subject: [PATCH 2/3] Move COMPAT_csum_offset to kernels < .24 Also add #else for initializing the virtio_net_hdr

---
 external-module-compat.h |    4 ++--
 hack-module.awk          |    5 ++++-
 2 files changed, 6 insertions(+), 3 deletions(-)
external-module-compat.h +2 -2
index 75c4fd0..9c93464 100644
@@ -63,6 +63,8 @@ do {							\
 } while(0)
 #define netif_rx_schedule(dev, napi) netif_rx_schedule(dev)
 
+#define COMPAT_csum_offset
+
 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,23)
 
 #define scsi_cmd_ioctl(filp, rq, gendisk, cmd, data) \
@@ -85,8 +87,6 @@ do {							\
 #define list_first_entry(ptr, type, member) \
 	list_entry((ptr)->next, type, member)
 
-#define COMPAT_csum_offset
-
 static inline void * __must_check krealloc(const void *data, size_t size,
 					   gfp_t gfp)
 {
hack-module.awk +4 -1
index bd63fb9..41ba60d 100644
@@ -106,7 +106,10 @@
 }
 
 /ip_summed == CHECKSUM_PARTIAL\)/ {
-    print "#ifndef COMPAT_csum_offset";
+    print "#ifdef COMPAT_csum_offset";
+    print "\thdr->flags = 0;"
+    print "\thdr->csum_offset = hdr->csum_start = 0;"
+    print "#else"
     need_endif_indent_brace = 1;
 }
 
Signature · 1 line
1.5.4.1
Quoted 1 line

From ef53854dcc94e8bb4257e3da344345e68bc92cef Mon Sep 17 00:00:00 2001

From: Dor Laor <[email protected]>
Date: Wed, 5 Mar 2008 18:27:49 +0200
Subject: [PATCH 3/3] Backport skb_transport_header as a BUG.. Since kvm host side does not support GSO anyway the simplest/fastest thing is to backport the relative new skb_transport_header as BUG.

---
 external-module-compat.h |    1 +
 hack-module.awk          |    7 +++++++
 2 files changed, 8 insertions(+), 0 deletions(-)
external-module-compat.h +1 -0
index 9c93464..ff2f4ca 100644
@@ -79,6 +79,7 @@ do {							\
 #define COMPAT_INIT_WORK
 #define COMPAT_f_dentry
 #define COMPAT_net_stats
+#define COMPAT_transport_header
 
 #define __maybe_unused
 
hack-module.awk +7 -0
index 41ba60d..9e7ef0e 100644
@@ -113,6 +113,13 @@
     need_endif_indent_brace = 1;
 }
 
+/skb_transport_header/ {
+    print "#ifdef COMPAT_transport_header";
+    print "BUG();";
+    print "#else";
+    need_endif = 1;
+}
+
 { sub(/\<pci_dev->revision\>/, "pci_dev_revision(pci_dev)") }
 
 { print }
Signature · 1 line
1.5.4.1

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/

_______________________________________________
kvm-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/kvm-devel

author
#8 lore raw
In reply to Anthony Liguori
Quoted 11 lines · Anthony Liguori
Quoted 6 lines · Dor Laor

Seems to work reliably with kvm, should do the same trick for lguest. You can download it from
git://kvm.qumranet.com/home/dor/src/kvm-guest-drivers-linux

Anthony, you can update your mercurial repository with our changes.

Hrm, I thought we were standardizing on
http://www.kernel.org/pub/scm/virt/kvm/kvm-guest-drivers-linux.git

Better this way, attached 3 patches needed for compilation.

Quoted 20 lines

I'll just kill my mercurial repository.
Regards,

Anthony Liguori

Quoted 14 lines

Cheers,
Dor

Quoted 7 lines

Thanks for the report,
Rusty.
_______________________________________________
Lguest mailing list
[email protected]
https://ozlabs.org/mailman/listinfo/lguest

From 803214241ba3750fc945c271e4a422389b0d8fdb Mon Sep 17 00:00:00 2001
From: Dor Laor <[email protected]>
Date: Mon, 3 Mar 2008 17:28:57 +0200
Subject: [PATCH 1/3] Backward compat to replace napi in *rx_schedule*

---
 hack-module.awk |   28 +++++++++++++++++++++++++++-
 1 files changed, 27 insertions(+), 1 deletions(-)
hack-module.awk +27 -1
index 580090b..bd63fb9 100644
@@ -45,8 +45,8 @@
     print "		return 1;";
     print "	}";
     print "";
-    print "	no_work = vi->rvq->vq_ops->enable_cb(vi->rvq);";
     print "	netif_rx_complete(vi->dev);";
+    print "	no_work = vi->rvq->vq_ops->enable_cb(vi->rvq);";
     print "";
     print "	if (!no_work && netif_rx_reschedule(vi->dev, received)) {";
     print "		skb = NULL;";
@@ -62,6 +62,32 @@
     virtnet_poll = 1
 }
 
+/\tnetif_rx_schedule\(/ {
+    print "#ifdef COMPAT_napi";
+    print "	vi->rvq->vq_ops->enable_cb(vi->rvq);";
+    print "	if (netif_rx_schedule_prep(vi->dev)) {";
+    print "		vi->rvq->vq_ops->disable_cb(vi->rvq);";
+    print "		__netif_rx_schedule(vi->dev);";
+    print "	} else";
+    print "		vi->rvq->vq_ops->enable_cb(vi->rvq);";
+    print "#else";
+    need_endif = 1
+}
+
+/netif_rx_schedule_prep/ {
+    print "#ifdef COMPAT_napi";
+    print "\tif (netif_rx_schedule_prep(vi->dev)) {";
+    print "#else";
+    need_endif = 1
+}
+
+/__netif_rx_schedule/ {
+    print "#ifdef COMPAT_napi";
+    print "\t\t__netif_rx_schedule(vi->dev);";
+    print "#else";
+    need_endif = 1
+}
+
 /dev->stats/ {
     print "#ifndef COMPAT_net_stats";
     need_endif = 1
Signature · 1 line
1.5.4.1

From 22b2b6c7b480bc712f93e48816675d88162b8963 Mon Sep 17 00:00:00 2001
From: Dor Laor <[email protected]>
Date: Wed, 5 Mar 2008 16:40:29 +0200
Subject: [PATCH 2/3] Move COMPAT_csum_offset to kernels < .24 Also add #else for initializing the virtio_net_hdr

---
 external-module-compat.h |    4 ++--
 hack-module.awk          |    5 ++++-
 2 files changed, 6 insertions(+), 3 deletions(-)
external-module-compat.h +2 -2
index 75c4fd0..9c93464 100644
@@ -63,6 +63,8 @@ do {							\
 } while(0)
 #define netif_rx_schedule(dev, napi) netif_rx_schedule(dev)
 
+#define COMPAT_csum_offset
+
 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,23)
 
 #define scsi_cmd_ioctl(filp, rq, gendisk, cmd, data) \
@@ -85,8 +87,6 @@ do {							\
 #define list_first_entry(ptr, type, member) \
 	list_entry((ptr)->next, type, member)
 
-#define COMPAT_csum_offset
-
 static inline void * __must_check krealloc(const void *data, size_t size,
 					   gfp_t gfp)
 {
hack-module.awk +4 -1
index bd63fb9..41ba60d 100644
@@ -106,7 +106,10 @@
 }
 
 /ip_summed == CHECKSUM_PARTIAL\)/ {
-    print "#ifndef COMPAT_csum_offset";
+    print "#ifdef COMPAT_csum_offset";
+    print "\thdr->flags = 0;"
+    print "\thdr->csum_offset = hdr->csum_start = 0;"
+    print "#else"
     need_endif_indent_brace = 1;
 }
 
Signature · 1 line
1.5.4.1

From ef53854dcc94e8bb4257e3da344345e68bc92cef Mon Sep 17 00:00:00 2001
From: Dor Laor <[email protected]>
Date: Wed, 5 Mar 2008 18:27:49 +0200
Subject: [PATCH 3/3] Backport skb_transport_header as a BUG.. Since kvm host side does not support GSO anyway the simplest/fastest thing is to backport the relative new skb_transport_header as BUG.

---
 external-module-compat.h |    1 +
 hack-module.awk          |    7 +++++++
 2 files changed, 8 insertions(+), 0 deletions(-)
external-module-compat.h +1 -0
index 9c93464..ff2f4ca 100644
@@ -79,6 +79,7 @@ do {							\
 #define COMPAT_INIT_WORK
 #define COMPAT_f_dentry
 #define COMPAT_net_stats
+#define COMPAT_transport_header
 
 #define __maybe_unused
 
hack-module.awk +7 -0
index 41ba60d..9e7ef0e 100644
@@ -113,6 +113,13 @@
     need_endif_indent_brace = 1;
 }
 
+/skb_transport_header/ {
+    print "#ifdef COMPAT_transport_header";
+    print "BUG();";
+    print "#else";
+    need_endif = 1;
+}
+
 { sub(/\<pci_dev->revision\>/, "pci_dev_revision(pci_dev)") }
 
 { print }
Signature · 1 line
1.5.4.1

_______________________________________________
Virtualization mailing list
[email protected]
https://lists.linux-foundation.org/mailman/listinfo/virtualization

#6 lore raw
In reply to Dor Laor
Quoted 11 lines · Dor Laor
Quoted 9 lines · Anthony Liguori
Quoted 7 lines · Dor Laor

Seems to work reliably with kvm, should do the same trick for lguest. You can download it from
git://kvm.qumranet.com/home/dor/src/kvm-guest-drivers-linux

Anthony, you can update your mercurial repository with our changes.

Quoted 8 lines
Quoted 4 lines

Hrm, I thought we were standardizing on
http://www.kernel.org/pub/scm/virt/kvm/kvm-guest-drivers-linux.git

Better this way, attached 3 patches needed for compilation.

Applied (as you saw), thanks -- but please, one patch per email next time.

Signature · 7 lines
Do not meddle in the internals of kernels, for they are subtle and quick to panic.


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
#7 lore raw
In reply to Dor Laor
Quoted 11 lines · Dor Laor
Quoted 9 lines · Anthony Liguori
Quoted 7 lines · Dor Laor

Seems to work reliably with kvm, should do the same trick for lguest. You can download it from
git://kvm.qumranet.com/home/dor/src/kvm-guest-drivers-linux

Anthony, you can update your mercurial repository with our changes.

Quoted 8 lines
Quoted 4 lines

Hrm, I thought we were standardizing on
http://www.kernel.org/pub/scm/virt/kvm/kvm-guest-drivers-linux.git

Better this way, attached 3 patches needed for compilation.

Applied (as you saw), thanks -- but please, one patch per email next time.

Signature · 1 line
Do not meddle in the internals of kernels, for they are subtle and quick to panic.