Skip to contentSkip to conversation

Unaligned accesses in ip_rcv and ip_fast_csum

DISCUSSION Jurij Smakov 5 participants 10 messages Feb 25, 2007 – Feb 28, 2007

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

Hi,

We have a report (Debian bug #409313 [0]) of the following unaligned accesses, occuring every 5-6 seconds on Netra X1 and SunFire v100 with kernel 2.6.18 and newer:

Kernel unaligned access at TPC[5e4420] ip_rcv+0xd0/0x58c Kernel unaligned access at TPC[517f84] ip_fast_csum+0xc/0x80 Kernel unaligned access at TPC[517f88] ip_fast_csum+0x10/0x80 Kernel unaligned access at TPC[517f8c] ip_fast_csum+0x14/0x80 Kernel unaligned access at TPC[517f94] ip_fast_csum+0x1c/0x80

I was hoping to debug it myself, but due to time constraints was not able to get too far.

[0] http://bugs.debian.org/409313

Best regards,

Signature · 2 lines
Jurij Smakov                                           [email protected]
Key: http://www.wooyd.org/pgpkey/                      KeyID: C99E03CC
#1 lore raw
Quoted 3 lines

We have a report (Debian bug #409313 [0]) of the following unaligned accesses, occuring every 5-6 seconds on Netra X1 and SunFire v100 with kernel 2.6.18 and newer:

This took me a little longer to track down than it should have. I started looking at the wrong end of the issue but on the plus side I now have a better understanding sparcv9 asm and the networking stack.

drivers/net/tulip/tulip_core.c +1 -1
index 5a35354..e3774a5 100644
@@ -67,7 +67,7 @@ const char * const medianame[32] = {
 
 /* Set the copy breakpoint for the copy-only-tiny-buffer Rx structure. */
 #if defined(__alpha__) || defined(__arm__) || defined(__hppa__) \
-	|| defined(__sparc_) || defined(__ia64__) \
+	|| defined(__sparc__) || defined(__ia64__) \
 	|| defined(__sh__) || defined(__mips__)
 static int rx_copybreak = 1518;
 #else
#2 lore raw
In reply to Jurij Smakov
Quoted 3 lines

We have a report (Debian bug #409313 [0]) of the following unaligned accesses, occuring every 5-6 seconds on Netra X1 and SunFire v100 with kernel 2.6.18 and newer:

A quick grep shows this issue is also in de2104x module in case somebody is using that.

drivers/net/tulip/de2104x.c +0 -0
index 9d67f11..dacea4f 100644
@@ -63,7 +63,7 @@ MODULE_PARM_DESC (debug, "de2104x bitmapped message enable

number");

/* Set the copy breakpoint for the copy-only-tiny-buffer Rx structure. */ #if defined(__alpha__) || defined(__arm__) || defined(__hppa__) \

-        || defined(__sparc_) || defined(__ia64__) \
+        || defined(__sparc__) || defined(__ia64__) \
         || defined(__sh__) || defined(__mips__)

static int rx_copybreak = 1518;
#else

maintainer
#3 lore raw
In reply to Jurij Smakov

From: "Doug Nazar" <[email protected]>
Date: Tue, 27 Feb 2007 14:43:23 -0500

Quoted 6 lines
Quoted 3 lines

We have a report (Debian bug #409313 [0]) of the following unaligned accesses, occuring every 5-6 seconds on Netra X1 and SunFire v100 with kernel 2.6.18 and newer:

A quick grep shows this issue is also in de2104x module in case somebody is using that.

I've forwarded both of your patches to the netdev lists and Jeff Garzik, the network drivers maintainer.

Thanks.

#4 lore raw
In reply to Jurij Smakov
Quoted 6 lines · David Miller

From: "Doug Nazar" <[email protected]>
Date: Tue, 27 Feb 2007 14:43:23 -0500

Quoted 3 lines
Quoted 3 lines

We have a report (Debian bug #409313 [0]) of the following unaligned accesses, occuring every 5-6 seconds on Netra X1 and SunFire v100 with kernel 2.6.18 and newer:

This also occurs on netra t1 105 TI UltraSparc IIe (Hummingbird)

[93548.504961] Kernel unaligned access at TPC[6aa660]

aoenet_rcv+0xa8/0x1a0

Quoted 12 lines
Quoted 3 lines

A quick grep shows this issue is also in de2104x module in case somebody is using that.

I've forwarded both of your patches to the netdev lists and Jeff Garzik, the network drivers maintainer.

Thanks.
-
To unsubscribe from this list: send the line "unsubscribe sparclinux" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

Signature · 4 lines
 .''`.
 : :' :      Daniel J. Priem
 `. `'       http://flexserv.de
   `-        
maintainer
#5 lore raw
In reply to Jurij Smakov

From: "Daniel J. Priem" <[email protected]>
Date: Tue, 27 Feb 2007 21:22:00 +0100

Quoted 5 lines
Quoted 3 lines · David Miller

From: "Doug Nazar" <[email protected]>
Date: Tue, 27 Feb 2007 14:43:23 -0500

Quoted 8 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

We have a report (Debian bug #409313 [0]) of the following unaligned accesses, occuring every 5-6 seconds on Netra X1 and SunFire v100 with kernel 2.6.18 and newer:

This also occurs on netra t1 105 TI UltraSparc IIe (Hummingbird)

[93548.504961] Kernel unaligned access at TPC[6aa660]

aoenet_rcv+0xa8/0x1a0

This is a different problem, it's totally unrelated.

I fixed that particular issue in a seperate patch to the AOE driver which I posted yesterday, please test it out.

#6 lore raw
In reply to Jurij Smakov
Quoted 14 lines · David Miller

From: "Daniel J. Priem" <[email protected]>
Date: Tue, 27 Feb 2007 21:22:00 +0100

Quoted 11 lines
Quoted 6 lines · David Miller

From: "Doug Nazar" <[email protected]>
Date: Tue, 27 Feb 2007 14:43:23 -0500

Quoted 3 lines
Quoted 3 lines

We have a report (Debian bug #409313 [0]) of the following unaligned accesses, occuring every 5-6 seconds on Netra X1 and SunFire v100 with kernel 2.6.18 and newer:

This also occurs on netra t1 105 TI UltraSparc IIe (Hummingbird)

Quoted 7 lines
Quoted 2 lines
[93548.504961] Kernel unaligned access at TPC[6aa660]

aoenet_rcv+0xa8/0x1a0

This is a different problem, it's totally unrelated.

I fixed that particular issue in a seperate patch to the AOE driver which I posted yesterday, please test it out.

Can you please send me both patches?

Thanks
Daniel

Quoted 4 lines

-
To unsubscribe from this list: send the line "unsubscribe sparclinux" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

Signature · 4 lines
 .''`.
 : :' :      Daniel J. Priem
 `. `'       http://flexserv.de
   `-        
maintainer
#7 lore raw
In reply to Jurij Smakov

From: "Daniel J. Priem" <[email protected]>
Date: Tue, 27 Feb 2007 22:07:41 +0100

Quoted 1 line

Can you please send me both patches?

You're replying to a thread that has the Tulip driver patch, and here is the one for the AOE driver:

From 2b274ebbdd2ea9b7d1ddfa4ca6f2e173bec830e9 Mon Sep 17 00:00:00 2001
From: David S. Miller <[email protected]>
Date: Mon, 26 Feb 2007 10:38:26 -0800
Subject: [PATCH] [AOE]: Add get_unaligned() calls where needed.

Based upon a report by Andrew Walrond.

---
 drivers/block/aoe/aoecmd.c |   12 ++++++------
 drivers/block/aoe/aoenet.c |    5 +++--
 2 files changed, 9 insertions(+), 8 deletions(-)
drivers/block/aoe/aoecmd.c +6 -6
index bb022ed..8d17d8d 100644
@@ -530,7 +530,7 @@ aoecmd_ata_rsp(struct sk_buff *skb)
 	u16 aoemajor;
 
 	hin = (struct aoe_hdr *) skb->mac.raw;
-	aoemajor = be16_to_cpu(hin->major);
+	aoemajor = be16_to_cpu(get_unaligned(&hin->major));
 	d = aoedev_by_aoeaddr(aoemajor, hin->minor);
 	if (d = NULL) {
 		snprintf(ebuf, sizeof ebuf, "aoecmd_ata_rsp: ata response "
@@ -542,7 +542,7 @@ aoecmd_ata_rsp(struct sk_buff *skb)
 
 	spin_lock_irqsave(&d->lock, flags);
 
-	n = be32_to_cpu(hin->tag);
+	n = be32_to_cpu(get_unaligned(&hin->tag));
 	f = getframe(d, n);
 	if (f = NULL) {
 		calc_rttavg(d, -tsince(n));
@@ -550,9 +550,9 @@ aoecmd_ata_rsp(struct sk_buff *skb)
 		snprintf(ebuf, sizeof ebuf,
 			"%15s e%d.%d    tag=%08x@%08lx\n",
 			"unexpected rsp",
-			be16_to_cpu(hin->major),
+			be16_to_cpu(get_unaligned(&hin->major)),
 			hin->minor,
-			be32_to_cpu(hin->tag),
+			be32_to_cpu(get_unaligned(&hin->tag)),
 			jiffies);
 		aoechr_error(ebuf);
 		return;
@@ -631,7 +631,7 @@ aoecmd_ata_rsp(struct sk_buff *skb)
 			printk(KERN_INFO
 				"aoe: unrecognized ata command %2.2Xh for %d.%d\n",
 				ahout->cmdstat,
-				be16_to_cpu(hin->major),
+				be16_to_cpu(get_unaligned(&hin->major)),
 				hin->minor);
 		}
 	}
@@ -733,7 +733,7 @@ aoecmd_cfg_rsp(struct sk_buff *skb)
 	 * Enough people have their dip switches set backwards to
 	 * warrant a loud message for this special case.
 	 */
-	aoemajor = be16_to_cpu(h->major);
+	aoemajor = be16_to_cpu(get_unaligned(&h->major));
 	if (aoemajor = 0xfff) {
 		printk(KERN_ERR "aoe: Warning: shelf address is all ones.  "
 			"Check shelf dip switches.\n");
drivers/block/aoe/aoenet.c +3 -2
index 9626e0f..5b85c0a 100644
@@ -8,6 +8,7 @@
 #include <linux/blkdev.h>
 #include <linux/netdevice.h>
 #include <linux/moduleparam.h>
+#include <asm/unaligned.h>
 #include "aoe.h"
 
 #define NECODES 5
@@ -123,7 +124,7 @@ aoenet_rcv(struct sk_buff *skb, struct net_device *ifp, struct packet_type *pt,
 	skb_push(skb, ETH_HLEN);	/* (1) */
 
 	h = (struct aoe_hdr *) skb->mac.raw;
-	n = be32_to_cpu(h->tag);
+	n = be32_to_cpu(get_unaligned(&h->tag));
 	if ((h->verfl & AOEFL_RSP) = 0 || (n & 1<<31))
 		goto exit;
 
@@ -133,7 +134,7 @@ aoenet_rcv(struct sk_buff *skb, struct net_device *ifp, struct packet_type *pt,
 			n = 0;
 		if (net_ratelimit())
 			printk(KERN_ERR "aoe: error packet from %d.%d; ecode=%d '%s'\n",
-			       be16_to_cpu(h->major), h->minor, 
+			       be16_to_cpu(get_unaligned(&h->major)), h->minor, 
 			       h->err, aoe_errlist[n]);
 		goto exit;
 	}
Signature · 1 line
1.5.0
#8 lore raw
In reply to Jurij Smakov
Quoted 14 lines · David Miller

From: "Daniel J. Priem" <[email protected]>
Date: Tue, 27 Feb 2007 21:22:00 +0100

Quoted 11 lines
Quoted 6 lines · David Miller

From: "Doug Nazar" <[email protected]>
Date: Tue, 27 Feb 2007 14:43:23 -0500

Quoted 3 lines
Quoted 3 lines

We have a report (Debian bug #409313 [0]) of the following unaligned accesses, occuring every 5-6 seconds on Netra X1 and SunFire v100 with kernel 2.6.18 and newer:

This also occurs on netra t1 105 TI UltraSparc IIe (Hummingbird)

Quoted 7 lines
Quoted 2 lines
[93548.504961] Kernel unaligned access at TPC[6aa660]

aoenet_rcv+0xa8/0x1a0

This is a different problem, it's totally unrelated.

I fixed that particular issue in a seperate patch to the AOE driver which I posted yesterday, please test it out.

Yes it works perfect.
Thanks!

Signature · 4 lines
 .''`.
 : :' :      Daniel J. Priem
 `. `'       http://flexserv.de
   `-        
#9 lore raw
In reply to Jurij Smakov

Excellent. I haven't had chance to compile a new kernel yet but I tried changing rx_copybreak at modprobe time and can confirm that the issue goes away.

rmmod tulip
modprobe tulip rx_copybreak18

Thanks

Richard

Quoted 43 lines

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Doug Nazar
Sent: 27 February 2007 18:52
To: 'Jurij Smakov'
Cc: [email protected]
Subject: RE: Unaligned accesses in ip_rcv and ip_fast_csum

Quoted 2 lines

We have a report (Debian bug #409313 [0]) of the following unaligned accesses, occuring every 5-6 seconds on Netra X1 and

SunFire v100 with

Quoted 1 line

kernel 2.6.18 and newer:

This took me a little longer to track down than it should have. I started
looking at the wrong end of the issue but on the plus side I now have a
better understanding sparcv9 asm and the networking stack.

drivers/net/tulip/tulip_core.c +0 -0
index 5a35354..e3774a5 100644
@@ -67,7 +67,7 @@ const char * const medianame[32] = {
 
 /* Set the copy breakpoint for the copy-only-tiny-buffer Rx 

structure. */
#if defined(__alpha__) || defined(__arm__) || defined(__hppa__) \

drivers/net/tulip/tulip_core.c +1 -2
-	|| defined(__sparc_) || defined(__ia64__) \
+	|| defined(__sparc__) || defined(__ia64__) \
 	|| defined(__sh__) || defined(__mips__)
 static int rx_copybreak = 1518;
 #else
 
 
-

To unsubscribe from this list: send the line "unsubscribe sparclinux" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html