[BISECTED] Linux 3.2: Networking out of LAN does not work

8 messages, 3 authors, 2012-01-26 · open the first message on its own page

[BISECTED] Linux 3.2: Networking out of LAN does not work

From: Rune Magnussen <hidden>
Date: 2012-01-25 09:35:49

Hi

Networking to and from the outside of my LAN does not work with Linux 
3.2.x.
Linux 3.1.x works. Using ssh from a PC on the LAN also works.
The machine has a VIA C7 CPU and the NIC uses the 8139too-driver.

Another machine with a r8169-NIC and an Atom-CPU (32bit) did not 
show any problems.
It was used very ligtly though.

Bisection led to this:
---
f04565ddf52e401880f8ba51de0dff8ba51c99fd is the first bad commit
commit f04565ddf52e401880f8ba51de0dff8ba51c99fd
Author: Mihai Maruseac [off-list ref]
Date:   Thu Oct 20 20:45:10 2011 +0000

    dev: use name hash for dev_seq_ops
 
    Instead of using the dev->next chain and trying to resync at each call 
to
    dev_seq_start, use the name hash, keeping the bucket and the offset in
    seq->private field.
 
    Tests revealed the following results for ifconfig > /dev/null
       * 1000 interfaces:
          * 0.114s without patch
          * 0.089s with patch
       * 3000 interfaces:
          * 0.489s without patch
          * 0.110s with patch
       * 5000 interfaces:
          * 1.363s without patch
          * 0.250s with patch
       * 128000 interfaces (other setup):
          * ~100s without patch
          * ~30s with patch
 
    Signed-off-by: Mihai Maruseac [off-list ref]
    Signed-off-by: Eric Dumazet [off-list ref]
    Signed-off-by: David S. Miller [off-list ref]

:040000 040000 2e86e1c9ecaf719d312a8b5863ec9e89d92bc4b3 
8b0d09ca105502dd5389bb6281ef059c8bb38667 M   net
---

Simply reverting the commit on top of Linux 3.2.1 resultet in a build 
error.

Used kernel configuration: http://knus.info/kernel/config-3.1.txt

Greetings Rune

Re: [BISECTED] Linux 3.2: Networking out of LAN does not work

From: Eric Dumazet <hidden>
Date: 2012-01-25 09:41:04

Le mercredi 25 janvier 2012 à 10:35 +0100, Rune Magnussen a écrit :
Hi

Networking to and from the outside of my LAN does not work with Linux 
3.2.x.
Linux 3.1.x works. Using ssh from a PC on the LAN also works.
The machine has a VIA C7 CPU and the NIC uses the 8139too-driver.

Another machine with a r8169-NIC and an Atom-CPU (32bit) did not 
show any problems.
It was used very ligtly though.

Bisection led to this:
---
f04565ddf52e401880f8ba51de0dff8ba51c99fd is the first bad commit
commit f04565ddf52e401880f8ba51de0dff8ba51c99fd
Author: Mihai Maruseac [off-list ref]
Date:   Thu Oct 20 20:45:10 2011 +0000

    dev: use name hash for dev_seq_ops
 
    Instead of using the dev->next chain and trying to resync at each call 
to
    dev_seq_start, use the name hash, keeping the bucket and the offset in
    seq->private field.
 
    Tests revealed the following results for ifconfig > /dev/null
       * 1000 interfaces:
          * 0.114s without patch
          * 0.089s with patch
       * 3000 interfaces:
          * 0.489s without patch
          * 0.110s with patch
       * 5000 interfaces:
          * 1.363s without patch
          * 0.250s with patch
       * 128000 interfaces (other setup):
          * ~100s without patch
          * ~30s with patch
 
    Signed-off-by: Mihai Maruseac [off-list ref]
    Signed-off-by: Eric Dumazet [off-list ref]
    Signed-off-by: David S. Miller [off-list ref]

:040000 040000 2e86e1c9ecaf719d312a8b5863ec9e89d92bc4b3 
8b0d09ca105502dd5389bb6281ef059c8bb38667 M   net
---

Simply reverting the commit on top of Linux 3.2.1 resultet in a build 
error.

Used kernel configuration: http://knus.info/kernel/config-3.1.txt

Greetings Rune
It might be a userland error, because order of devices might be
different in :

ip link
cat /proc/net/dev

Re: [BISECTED] Linux 3.2: Networking out of LAN does not work

From: Eric Dumazet <hidden>
Date: 2012-01-25 09:45:34

Le mercredi 25 janvier 2012 à 10:40 +0100, Eric Dumazet a écrit :
Le mercredi 25 janvier 2012 à 10:35 +0100, Rune Magnussen a écrit :
quoted
Hi

Networking to and from the outside of my LAN does not work with Linux 
3.2.x.
Linux 3.1.x works. Using ssh from a PC on the LAN also works.
The machine has a VIA C7 CPU and the NIC uses the 8139too-driver.

Another machine with a r8169-NIC and an Atom-CPU (32bit) did not 
show any problems.
It was used very ligtly though.

Bisection led to this:
---
f04565ddf52e401880f8ba51de0dff8ba51c99fd is the first bad commit
commit f04565ddf52e401880f8ba51de0dff8ba51c99fd
Author: Mihai Maruseac [off-list ref]
Date:   Thu Oct 20 20:45:10 2011 +0000

    dev: use name hash for dev_seq_ops
 
    Instead of using the dev->next chain and trying to resync at each call 
to
    dev_seq_start, use the name hash, keeping the bucket and the offset in
    seq->private field.
 
    Tests revealed the following results for ifconfig > /dev/null
       * 1000 interfaces:
          * 0.114s without patch
          * 0.089s with patch
       * 3000 interfaces:
          * 0.489s without patch
          * 0.110s with patch
       * 5000 interfaces:
          * 1.363s without patch
          * 0.250s with patch
       * 128000 interfaces (other setup):
          * ~100s without patch
          * ~30s with patch
 
    Signed-off-by: Mihai Maruseac [off-list ref]
    Signed-off-by: Eric Dumazet [off-list ref]
    Signed-off-by: David S. Miller [off-list ref]

:040000 040000 2e86e1c9ecaf719d312a8b5863ec9e89d92bc4b3 
8b0d09ca105502dd5389bb6281ef059c8bb38667 M   net
---

Simply reverting the commit on top of Linux 3.2.1 resultet in a build 
error.

Used kernel configuration: http://knus.info/kernel/config-3.1.txt

Greetings Rune
It might be a userland error, because order of devices might be
different in :

ip link
cat /proc/net/dev
Or it also be a bug introduced by this commit and fixed in
5cac98dd06bc43a
(net: Fix corruption in /proc/*/net/dev_mcast)

Re: [BISECTED] Linux 3.2: Networking out of LAN does not work

From: Eric Dumazet <hidden>
Date: 2012-01-25 11:05:37

Le mercredi 25 janvier 2012 à 10:40 +0100, Eric Dumazet a écrit :
Le mercredi 25 janvier 2012 à 10:35 +0100, Rune Magnussen a écrit :
quoted
Hi

Networking to and from the outside of my LAN does not work with Linux 
3.2.x.
Linux 3.1.x works. Using ssh from a PC on the LAN also works.
The machine has a VIA C7 CPU and the NIC uses the 8139too-driver.

Another machine with a r8169-NIC and an Atom-CPU (32bit) did not 
show any problems.
It was used very ligtly though.

Bisection led to this:
---
f04565ddf52e401880f8ba51de0dff8ba51c99fd is the first bad commit
commit f04565ddf52e401880f8ba51de0dff8ba51c99fd
Author: Mihai Maruseac [off-list ref]
Date:   Thu Oct 20 20:45:10 2011 +0000

    dev: use name hash for dev_seq_ops
 
    Instead of using the dev->next chain and trying to resync at each call 
to
    dev_seq_start, use the name hash, keeping the bucket and the offset in
    seq->private field.
 
    Tests revealed the following results for ifconfig > /dev/null
       * 1000 interfaces:
          * 0.114s without patch
          * 0.089s with patch
       * 3000 interfaces:
          * 0.489s without patch
          * 0.110s with patch
       * 5000 interfaces:
          * 1.363s without patch
          * 0.250s with patch
       * 128000 interfaces (other setup):
          * ~100s without patch
          * ~30s with patch
 
    Signed-off-by: Mihai Maruseac [off-list ref]
    Signed-off-by: Eric Dumazet [off-list ref]
    Signed-off-by: David S. Miller [off-list ref]

:040000 040000 2e86e1c9ecaf719d312a8b5863ec9e89d92bc4b3 
8b0d09ca105502dd5389bb6281ef059c8bb38667 M   net
---

Simply reverting the commit on top of Linux 3.2.1 resultet in a build 
error.

Used kernel configuration: http://knus.info/kernel/config-3.1.txt

Greetings Rune
OK please test the following patch.

[PATCH] net: use index hash for /proc/net/dev

Commit f04565ddf52e (dev: use name hash for dev_seq_ops) added a
regression for legacy apps expecting to find devices in a particular
order.

Instead of using name hash, we can use dev_index_head hash, based on
device index, to not change device ordering.

Name hash order is not particularly useful, while index ordering is
meaningful on machines where no more than 256 devices are ever created.

"cat /proc/net/dev" and "ip link" will output devices in same order.

Reported-by: Rune Magnussen <redacted>
Bisected-by: Rune Magnussen [off-list ref]
Cc: Mihai Maruseac <redacted>
Signed-off-by: Eric Dumazet <redacted>
---
 net/core/dev.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/net/core/dev.c b/net/core/dev.c
index 115dee1..c58dba3 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -4052,9 +4052,9 @@ static inline struct net_device *dev_from_same_bucket(struct seq_file *seq)
 
 	bucket = get_bucket(state->pos);
 	offset = get_offset(state->pos);
-	h = &net->dev_name_head[bucket];
+	h = dev_index_hash(net, bucket);
 	count = 0;
-	hlist_for_each_entry_rcu(dev, p, h, name_hlist) {
+	hlist_for_each_entry_rcu(dev, p, h, index_hlist) {
 		if (count++ == offset) {
 			state->pos = set_bucket_offset(bucket, count);
 			return dev;

Re: [BISECTED] Linux 3.2: Networking out of LAN does not work

From: David Miller <davem@davemloft.net>
Date: 2012-01-26 02:42:10

From: Eric Dumazet <redacted>
Date: Wed, 25 Jan 2012 12:05:31 +0100
OK please test the following patch.

[PATCH] net: use index hash for /proc/net/dev
Sorry, we never promised to list devices in any particular order,
any such dependency is a bug and must be fixed instead of papered
around by the kernel.

This same issue came up for routes too once we deleted fib_hash
and fib_trie listed them in a different order.

I'm not applying this.

Re: [BISECTED] Linux 3.2: Networking out of LAN does not work

From: Eric Dumazet <hidden>
Date: 2012-01-26 06:01:18

Le mercredi 25 janvier 2012 à 21:41 -0500, David Miller a écrit :
Sorry, we never promised to list devices in any particular order,
any such dependency is a bug and must be fixed instead of papered
around by the kernel.

This same issue came up for routes too once we deleted fib_hash
and fib_trie listed them in a different order.

I'm not applying this.

I once hit this exact issue with a legacy commercial product using a
licence based on MAC address, and could fix it using a custom
"ifconfig", since last ifconfig versions sort the device list before
output.

I personally dont care, but apparently Rune spent time to bisect the
problem. I presumed it was an issue for him.

Since Rune didnt answer to my mail, I wont argue with you :)

Re: [BISECTED] Linux 3.2: Networking out of LAN does not work

From: Rune Magnussen <hidden>
Date: 2012-01-26 07:14:59

Eric Dumazet [off-list ref] 
Sendt af: netdev-owner@vger.kernel.org
25-01-2012 12:06
58efa841-5316-9749-1633-85629e363385

Til
Rune Magnussen [off-list ref], David Miller [off-list ref]
cc
netdev@vger.kernel.org, Mihai Maruseac [off-list ref]
Emne
Re: [BISECTED] Linux 3.2: Networking out of LAN does not work






OK please test the following patch.
[PATCH] net: use index hash for /proc/net/dev
Commit f04565ddf52e (dev: use name hash for dev_seq_ops) added a
regression for legacy apps expecting to find devices in a particular
order.
Instead of using name hash, we can use dev_index_head hash, based on
device index, to not change device ordering.
Name hash order is not particularly useful, while index ordering is
meaningful on machines where no more than 256 devices are ever created.
"cat /proc/net/dev" and "ip link" will output devices in same order.
quoted hunk
Reported-by: Rune Magnussen <redacted>
Bisected-by: Rune Magnussen [off-list ref]
Cc: Mihai Maruseac <redacted>
Signed-off-by: Eric Dumazet <redacted>
---
net/core/dev.c |    4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/net/core/dev.c b/net/core/dev.c
index 115dee1..c58dba3 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -4052,9 +4052,9 @@ static inline struct net_device 
*dev_from_same_bucket(struct seq_file *seq)
               bucket = get_bucket(state->pos);
               offset = get_offset(state->pos);
-              h = &net->dev_name_head[bucket];
+              h = dev_index_hash(net, bucket);
               count = 0;
-              hlist_for_each_entry_rcu(dev, p, h, name_hlist) {
+              hlist_for_each_entry_rcu(dev, p, h, index_hlist) {
                               if (count++ == offset) {
                                               state->pos = 
set_bucket_offset(bucket, count);
                                               return dev;
The patch works for me. I applied it on top of v3.2.1 and it fixed my 
problem.
I have not tested it on other computers yet.

Greetings Rune

Re: [BISECTED] Linux 3.2: Networking out of LAN does not work

From: Rune Magnussen <hidden>
Date: 2012-01-26 07:55:23

From: Eric Dumazet <redacted>
Date: Wed, 25 Jan 2012 12:05:31 +0100
quoted
OK please test the following patch.

[PATCH] net: use index hash for /proc/net/dev
Sorry, we never promised to list devices in any particular order,
any such dependency is a bug and must be fixed instead of papered
around by the kernel.
OK. I simply asumed it was a kernel issue since it started after an 
upgrade.
Now at lest I have an idea about where to look.

Greetings Rune
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help