diff mbox

[net-next-2.6] Revert "net: Allow no-cache copy from user on transmit"

Message ID BANLkTim5Yv2Ekg1yXQy-8KZfS=hF0i2+2Q@mail.gmail.com
State Rejected, archived
Delegated to: David Miller
Headers show

Commit Message

Sedat Dilek April 7, 2011, 10:49 a.m. UTC
[ The long CC list I got via ./scripts/get_maintainer.pl ]

Hi,

with yesterday's linux-next (next-20110406) I discovered first time
network problems.
Today's next-20110407 shows the same symptoms.
In my IRC client the connection via SSL-encryption to freenode and
oftc are not established.
Also, I saw "stalls" on websites in firefox.

Luckily, next-20110405 was OK, so I started to look at the
net-next-2.6 merge and its commits.
( Furthermore, I tested a 2.6.39-rc2 vanilla kernel to ensure the
problem comes from linux-next patch. )

By reverting all 10 commits my system worked as expected, here the list:

0001-Revert-net-Allow-no-cache-copy-from-user-on-transmit.patch
0002-Revert-bridge-range-check-STP-parameters.patch
0003-Revert-bridge-allow-creating-bridge-devices-with-net.patch
0004-Revert-bridge-allow-creating-deleting-fdb-entries-vi.patch
0005-Revert-bridge-add-netlink-notification-on-forward-en.patch
0006-Revert-bridge-split-rcu-and-no-rcu-cases-of-fdb-look.patch
0007-Revert-bridge-track-last-used-time-in-forwarding-tab.patch
0008-Revert-bridge-change-arguments-to-fdb_create.patch
0009-Revert-pkt_sched-QFQ-quick-fair-queue-scheduler.patch
0010-Revert-xen-netfront-assume-all-hw-features-are-avail.patch

In a next run, I started with only
"0001-Revert-net-Allow-no-cache-copy-from-user-on-transmit.patch".
It turned out that this is the culprit commit.
( I have not played with the new ethtool option tx-nocache-copy in
"BROKEN" kernel. )

My wificard is an Atheros ath5k.
I attached my kernel-config and the revert-patch which makes the
system stable again.

Can you have a look at it?

I you want me to help with debugging, please give me precise instructions.

Regards,
- Sedat -

Comments

Sedat Dilek April 7, 2011, 11:03 a.m. UTC | #1
...will try the patch from [1]:

- Sedat -

[1] http://marc.info/?l=linux-netdev&m=130215119417648&w=2

On Thu, Apr 7, 2011 at 12:49 PM, Sedat Dilek <sedat.dilek@googlemail.com> wrote:
> [ The long CC list I got via ./scripts/get_maintainer.pl ]
>
> Hi,
>
> with yesterday's linux-next (next-20110406) I discovered first time
> network problems.
> Today's next-20110407 shows the same symptoms.
> In my IRC client the connection via SSL-encryption to freenode and
> oftc are not established.
> Also, I saw "stalls" on websites in firefox.
>
> Luckily, next-20110405 was OK, so I started to look at the
> net-next-2.6 merge and its commits.
> ( Furthermore, I tested a 2.6.39-rc2 vanilla kernel to ensure the
> problem comes from linux-next patch. )
>
> By reverting all 10 commits my system worked as expected, here the list:
>
> 0001-Revert-net-Allow-no-cache-copy-from-user-on-transmit.patch
> 0002-Revert-bridge-range-check-STP-parameters.patch
> 0003-Revert-bridge-allow-creating-bridge-devices-with-net.patch
> 0004-Revert-bridge-allow-creating-deleting-fdb-entries-vi.patch
> 0005-Revert-bridge-add-netlink-notification-on-forward-en.patch
> 0006-Revert-bridge-split-rcu-and-no-rcu-cases-of-fdb-look.patch
> 0007-Revert-bridge-track-last-used-time-in-forwarding-tab.patch
> 0008-Revert-bridge-change-arguments-to-fdb_create.patch
> 0009-Revert-pkt_sched-QFQ-quick-fair-queue-scheduler.patch
> 0010-Revert-xen-netfront-assume-all-hw-features-are-avail.patch
>
> In a next run, I started with only
> "0001-Revert-net-Allow-no-cache-copy-from-user-on-transmit.patch".
> It turned out that this is the culprit commit.
> ( I have not played with the new ethtool option tx-nocache-copy in
> "BROKEN" kernel. )
>
> My wificard is an Atheros ath5k.
> I attached my kernel-config and the revert-patch which makes the
> system stable again.
>
> Can you have a look at it?
>
> I you want me to help with debugging, please give me precise instructions.
>
> Regards,
> - Sedat -
>
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Sedat Dilek April 7, 2011, 12:07 p.m. UTC | #2
On Thu, Apr 7, 2011 at 1:03 PM, Sedat Dilek <sedat.dilek@googlemail.com> wrote:
> ...will try the patch from [1]:
>
> - Sedat -
>
> [1] http://marc.info/?l=linux-netdev&m=130215119417648&w=2
>

The patch from above fixes my network problems.
Thanks.

- Sedat -

> On Thu, Apr 7, 2011 at 12:49 PM, Sedat Dilek <sedat.dilek@googlemail.com> wrote:
>> [ The long CC list I got via ./scripts/get_maintainer.pl ]
>>
>> Hi,
>>
>> with yesterday's linux-next (next-20110406) I discovered first time
>> network problems.
>> Today's next-20110407 shows the same symptoms.
>> In my IRC client the connection via SSL-encryption to freenode and
>> oftc are not established.
>> Also, I saw "stalls" on websites in firefox.
>>
>> Luckily, next-20110405 was OK, so I started to look at the
>> net-next-2.6 merge and its commits.
>> ( Furthermore, I tested a 2.6.39-rc2 vanilla kernel to ensure the
>> problem comes from linux-next patch. )
>>
>> By reverting all 10 commits my system worked as expected, here the list:
>>
>> 0001-Revert-net-Allow-no-cache-copy-from-user-on-transmit.patch
>> 0002-Revert-bridge-range-check-STP-parameters.patch
>> 0003-Revert-bridge-allow-creating-bridge-devices-with-net.patch
>> 0004-Revert-bridge-allow-creating-deleting-fdb-entries-vi.patch
>> 0005-Revert-bridge-add-netlink-notification-on-forward-en.patch
>> 0006-Revert-bridge-split-rcu-and-no-rcu-cases-of-fdb-look.patch
>> 0007-Revert-bridge-track-last-used-time-in-forwarding-tab.patch
>> 0008-Revert-bridge-change-arguments-to-fdb_create.patch
>> 0009-Revert-pkt_sched-QFQ-quick-fair-queue-scheduler.patch
>> 0010-Revert-xen-netfront-assume-all-hw-features-are-avail.patch
>>
>> In a next run, I started with only
>> "0001-Revert-net-Allow-no-cache-copy-from-user-on-transmit.patch".
>> It turned out that this is the culprit commit.
>> ( I have not played with the new ethtool option tx-nocache-copy in
>> "BROKEN" kernel. )
>>
>> My wificard is an Atheros ath5k.
>> I attached my kernel-config and the revert-patch which makes the
>> system stable again.
>>
>> Can you have a look at it?
>>
>> I you want me to help with debugging, please give me precise instructions.
>>
>> Regards,
>> - Sedat -
>>
>
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

From 4d5767a1c0037f9acf051eb1d52a111308de8208 Mon Sep 17 00:00:00 2001
From: Sedat Dilek <sedat.dilek@gmail.com>
Date: Thu, 7 Apr 2011 10:07:05 +0200
Subject: [PATCH 01/10] Revert "net: Allow no-cache copy from user on transmit"

This reverts commit c6e1a0d12ca7b4f22c58e55a16beacfb7d3d8462.
---
 drivers/net/bonding/bond_main.c |    2 +-
 include/linux/netdevice.h       |    3 +-
 include/net/sock.h              |   53 ---------------------------------------
 net/core/dev.c                  |   12 ---------
 net/core/ethtool.c              |    2 +-
 net/ipv4/tcp.c                  |    7 ++---
 6 files changed, 6 insertions(+), 73 deletions(-)

diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index b51e021..16d6fe9 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -1407,7 +1407,7 @@  static int bond_compute_features(struct bonding *bond)
 	int i;
 
 	features &= ~(NETIF_F_ALL_CSUM | BOND_VLAN_FEATURES);
-	features |=  NETIF_F_GSO_MASK | NETIF_F_NO_CSUM | NETIF_F_NOCACHE_COPY;
+	features |=  NETIF_F_GSO_MASK | NETIF_F_NO_CSUM;
 
 	if (!bond->first_slave)
 		goto done;
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 09d2624..a4664cc 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -1066,7 +1066,6 @@  struct net_device {
 #define NETIF_F_NTUPLE		(1 << 27) /* N-tuple filters supported */
 #define NETIF_F_RXHASH		(1 << 28) /* Receive hashing offload */
 #define NETIF_F_RXCSUM		(1 << 29) /* Receive checksumming offload */
-#define NETIF_F_NOCACHE_COPY	(1 << 30) /* Use no-cache copyfromuser */
 
 	/* Segmentation offload features */
 #define NETIF_F_GSO_SHIFT	16
@@ -1082,7 +1081,7 @@  struct net_device {
 	/* = all defined minus driver/device-class-related */
 #define NETIF_F_NEVER_CHANGE	(NETIF_F_HIGHDMA | NETIF_F_VLAN_CHALLENGED | \
 				  NETIF_F_LLTX | NETIF_F_NETNS_LOCAL)
-#define NETIF_F_ETHTOOL_BITS	(0x7f3fffff & ~NETIF_F_NEVER_CHANGE)
+#define NETIF_F_ETHTOOL_BITS	(0x3f3fffff & ~NETIF_F_NEVER_CHANGE)
 
 	/* List of features with software fallbacks. */
 #define NETIF_F_GSO_SOFTWARE	(NETIF_F_TSO | NETIF_F_TSO_ECN | \
diff --git a/include/net/sock.h b/include/net/sock.h
index 43bd515..da0534d 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -52,7 +52,6 @@ 
 #include <linux/mm.h>
 #include <linux/security.h>
 #include <linux/slab.h>
-#include <linux/uaccess.h>
 
 #include <linux/filter.h>
 #include <linux/rculist_nulls.h>
@@ -1390,58 +1389,6 @@  static inline void sk_nocaps_add(struct sock *sk, int flags)
 	sk->sk_route_caps &= ~flags;
 }
 
-static inline int skb_do_copy_data_nocache(struct sock *sk, struct sk_buff *skb,
-					   char __user *from, char *to,
-					   int copy)
-{
-	if (skb->ip_summed == CHECKSUM_NONE) {
-		int err = 0;
-		__wsum csum = csum_and_copy_from_user(from, to, copy, 0, &err);
-		if (err)
-			return err;
-		skb->csum = csum_block_add(skb->csum, csum, skb->len);
-	} else if (sk->sk_route_caps & NETIF_F_NOCACHE_COPY) {
-		if (!access_ok(VERIFY_READ, from, copy) ||
-		    __copy_from_user_nocache(to, from, copy))
-			return -EFAULT;
-	} else if (copy_from_user(to, from, copy))
-		return -EFAULT;
-
-	return 0;
-}
-
-static inline int skb_add_data_nocache(struct sock *sk, struct sk_buff *skb,
-				       char __user *from, int copy)
-{
-	int err;
-
-	err = skb_do_copy_data_nocache(sk, skb, from, skb_put(skb, copy), copy);
-	if (err)
-		__skb_trim(skb, skb->len);
-
-	return err;
-}
-
-static inline int skb_copy_to_page_nocache(struct sock *sk, char __user *from,
-					   struct sk_buff *skb,
-					   struct page *page,
-					   int off, int copy)
-{
-	int err;
-
-	err = skb_do_copy_data_nocache(sk, skb, from,
-				       page_address(page) + off, copy);
-	if (err)
-		return err;
-
-	skb->len	     += copy;
-	skb->data_len	     += copy;
-	skb->truesize	     += copy;
-	sk->sk_wmem_queued   += copy;
-	sk_mem_charge(sk, copy);
-	return 0;
-}
-
 static inline int skb_copy_to_page(struct sock *sk, char __user *from,
 				   struct sk_buff *skb, struct page *page,
 				   int off, int copy)
diff --git a/net/core/dev.c b/net/core/dev.c
index 5d0b4f6..02f5637 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -5425,14 +5425,6 @@  int register_netdevice(struct net_device *dev)
 		dev->features &= ~NETIF_F_GSO;
 	}
 
-	/* Turn on no cache copy if HW is doing checksum */
-	dev->hw_features |= NETIF_F_NOCACHE_COPY;
-	if ((dev->features & NETIF_F_ALL_CSUM) &&
-	    !(dev->features & NETIF_F_NO_CSUM)) {
-		dev->wanted_features |= NETIF_F_NOCACHE_COPY;
-		dev->features |= NETIF_F_NOCACHE_COPY;
-	}
-
 	/* Enable GRO and NETIF_F_HIGHDMA for vlans by default,
 	 * vlan_dev_init() will do the dev->features check, so these features
 	 * are enabled only if supported by underlying device.
@@ -6190,10 +6182,6 @@  u32 netdev_increment_features(u32 all, u32 one, u32 mask)
 		}
 	}
 
-	/* If device can't no cache copy, don't do for all */
-	if (!(one & NETIF_F_NOCACHE_COPY))
-		all &= ~NETIF_F_NOCACHE_COPY;
-
 	one |= NETIF_F_ALL_CSUM;
 
 	one |= all & NETIF_F_ONE_FOR_ALL;
diff --git a/net/core/ethtool.c b/net/core/ethtool.c
index 719670a..439e4b0 100644
--- a/net/core/ethtool.c
+++ b/net/core/ethtool.c
@@ -359,7 +359,7 @@  static const char netdev_features_strings[ETHTOOL_DEV_FEATURE_WORDS * 32][ETH_GS
 	/* NETIF_F_NTUPLE */          "rx-ntuple-filter",
 	/* NETIF_F_RXHASH */          "rx-hashing",
 	/* NETIF_F_RXCSUM */          "rx-checksum",
-	/* NETIF_F_NOCACHE_COPY */    "tx-nocache-copy"
+	"",
 	"",
 };
 
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
index 054a59d..b22d450 100644
--- a/net/ipv4/tcp.c
+++ b/net/ipv4/tcp.c
@@ -999,8 +999,7 @@  new_segment:
 				/* We have some space in skb head. Superb! */
 				if (copy > skb_tailroom(skb))
 					copy = skb_tailroom(skb);
-				err = skb_add_data_nocache(sk, skb, from, copy);
-				if (err)
+				if ((err = skb_add_data(skb, from, copy)) != 0)
 					goto do_fault;
 			} else {
 				int merge = 0;
@@ -1043,8 +1042,8 @@  new_segment:
 
 				/* Time to copy data. We are close to
 				 * the end! */
-				err = skb_copy_to_page_nocache(sk, from, skb,
-							       page, off, copy);
+				err = skb_copy_to_page(sk, from, skb, page,
+						       off, copy);
 				if (err) {
 					/* If this page was new, give it to the
 					 * socket so it does not get leaked.
-- 
1.7.4.3