All of lore.kernel.org
 help / color / mirror / Atom feed
* 2.6.20 unaligned accesses
@ 2007-02-23 11:55 Andrew Walrond
  2007-02-26 10:12 ` Andrew Walrond
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Andrew Walrond @ 2007-02-23 11:55 UTC (permalink / raw)
  To: sparclinux

On a Sun T1000 running 2.6.20 I'm seeing lots of these:

Kernel unaligned access at TPC[63d47c] Kernel unaligned access at TPC[63d47c] 
Kernel unaligned access at TPC[63d47c] aoenet_rcv+0xa4/0x190
aoenet_rcv+0xa4/0x190
aoenet_rcv+0xa4/0x190
Kernel unaligned access at TPC[63d47c] Kernel unaligned access at TPC[63d47c] 
Kernel unaligned access at TPC[63d47c] aoenet_rcv+0xa4/0x190
aoenet_rcv+0xa4/0x190

Google found similar reports and fixes by David Miller (cc'ed), suggesting 
that more agressive structure packing by gcc 4.1.1 was exposing buggy code, 
so perhaps this is a similar case? (I am also using gcc-4.1.1)

Is this just an 'unaligned accesses are slower' issue, or simething more 
serious?

Let me know if I can do anything to further diagnose or test.

Andrew Walrond

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: 2.6.20 unaligned accesses
  2007-02-23 11:55 2.6.20 unaligned accesses Andrew Walrond
@ 2007-02-26 10:12 ` Andrew Walrond
  2007-02-26 18:33 ` David Miller
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Andrew Walrond @ 2007-02-26 10:12 UTC (permalink / raw)
  To: sparclinux

On Friday 23 February 2007 11:55, Andrew Walrond wrote:
> On a Sun T1000 running 2.6.20 I'm seeing lots of these:
>
> Kernel unaligned access at TPC[63d47c] Kernel unaligned access at
> TPC[63d47c] Kernel unaligned access at TPC[63d47c] aoenet_rcv+0xa4/0x190
> aoenet_rcv+0xa4/0x190
> aoenet_rcv+0xa4/0x190
> Kernel unaligned access at TPC[63d47c] Kernel unaligned access at
> TPC[63d47c] Kernel unaligned access at TPC[63d47c] aoenet_rcv+0xa4/0x190
> aoenet_rcv+0xa4/0x190
>

I have discovered that these only appear when running a kernel with

	CONFIG_CC_OPTIMIZE_FOR_SIZE=y

Nevertheless, I guess it needs fixing.

Andrew Walrond

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: 2.6.20 unaligned accesses
  2007-02-23 11:55 2.6.20 unaligned accesses Andrew Walrond
  2007-02-26 10:12 ` Andrew Walrond
@ 2007-02-26 18:33 ` David Miller
  2007-02-26 23:14 ` Emanuele Rocca
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: David Miller @ 2007-02-26 18:33 UTC (permalink / raw)
  To: sparclinux

From: Andrew Walrond <andrew@walrond.org>
Date: Mon, 26 Feb 2007 10:12:32 +0000

> I have discovered that these only appear when running a kernel with
> 
> 	CONFIG_CC_OPTIMIZE_FOR_SIZE=y
> 
> Nevertheless, I guess it needs fixing.

Let me know if this fixes the bug for you:

diff --git a/drivers/block/aoe/aoecmd.c b/drivers/block/aoe/aoecmd.c
index bb022ed..8d17d8d 100644
--- a/drivers/block/aoe/aoecmd.c
+++ b/drivers/block/aoe/aoecmd.c
@@ -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");
diff --git a/drivers/block/aoe/aoenet.c b/drivers/block/aoe/aoenet.c
index 9626e0f..5b85c0a 100644
--- a/drivers/block/aoe/aoenet.c
+++ b/drivers/block/aoe/aoenet.c
@@ -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;
 	}

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: 2.6.20 unaligned accesses
  2007-02-23 11:55 2.6.20 unaligned accesses Andrew Walrond
  2007-02-26 10:12 ` Andrew Walrond
  2007-02-26 18:33 ` David Miller
@ 2007-02-26 23:14 ` Emanuele Rocca
  2007-02-26 23:16 ` David Miller
  2007-02-26 23:23 ` Emanuele Rocca
  4 siblings, 0 replies; 6+ messages in thread
From: Emanuele Rocca @ 2007-02-26 23:14 UTC (permalink / raw)
  To: sparclinux

[-- Attachment #1: Type: text/plain, Size: 1216 bytes --]

Hello,

* Andrew Walrond <andrew@walrond.org>, [2007-02-23 11:55 +0000]:
>  On a Sun T1000 running 2.6.20 I'm seeing lots of these:
>  
>  Kernel unaligned access at TPC[63d47c] Kernel unaligned access at TPC[63d47c] 
>  Kernel unaligned access at TPC[63d47c] aoenet_rcv+0xa4/0x190
[...]

On a Sun Blade 2000 I got this one every time I load eth1394:
Kernel unaligned access at TPC[101880c8] ether1394_reset_priv+0x2c/0xb8 [eth1394]

I got rid of the message with the following patch:

--- drivers/ieee1394/eth1394.c.old      2007-02-26 23:07:21.000000000 +0100
+++ drivers/ieee1394/eth1394.c  2007-02-26 23:58:57.000000000 +0100
@@ -65,6 +65,7 @@
 #include <asm/uaccess.h>
 #include <asm/delay.h>
 #include <asm/semaphore.h>
+#include <asm/unaligned.h>
 #include <net/arp.h>

 #include "csr1212.h"
@@ -491,7 +492,7 @@
        int i;
        struct eth1394_priv *priv = netdev_priv(dev);
        struct hpsb_host *host = priv->host;
-       u64 guid = *((u64*)&(host->csr.rom->bus_info_data[3]));
+       u64 guid = get_unaligned(&(host->csr.rom->bus_info_data[3]));
        u16 maxpayload = 1 << (host->csr.max_rec + 1);
        int max_speed = IEEE1394_SPEED_MAX;

ciao,
    ema

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: 2.6.20 unaligned accesses
  2007-02-23 11:55 2.6.20 unaligned accesses Andrew Walrond
                   ` (2 preceding siblings ...)
  2007-02-26 23:14 ` Emanuele Rocca
@ 2007-02-26 23:16 ` David Miller
  2007-02-26 23:23 ` Emanuele Rocca
  4 siblings, 0 replies; 6+ messages in thread
From: David Miller @ 2007-02-26 23:16 UTC (permalink / raw)
  To: sparclinux

From: Emanuele Rocca <ema@debian.org>
Date: Tue, 27 Feb 2007 00:14:49 +0100

> Hello,
> 
> * Andrew Walrond <andrew@walrond.org>, [2007-02-23 11:55 +0000]:
> >  On a Sun T1000 running 2.6.20 I'm seeing lots of these:
> >  
> >  Kernel unaligned access at TPC[63d47c] Kernel unaligned access at TPC[63d47c] 
> >  Kernel unaligned access at TPC[63d47c] aoenet_rcv+0xa4/0x190
> [...]
> 
> On a Sun Blade 2000 I got this one every time I load eth1394:
> Kernel unaligned access at TPC[101880c8] ether1394_reset_priv+0x2c/0xb8 [eth1394]
> 
> I got rid of the message with the following patch:

That is a different bug, and the current 2.6.x tree already has
that fix applied so you shouldn't need to apply that patch to
the vanilla tree.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re:  2.6.20 unaligned accesses
  2007-02-23 11:55 2.6.20 unaligned accesses Andrew Walrond
                   ` (3 preceding siblings ...)
  2007-02-26 23:16 ` David Miller
@ 2007-02-26 23:23 ` Emanuele Rocca
  4 siblings, 0 replies; 6+ messages in thread
From: Emanuele Rocca @ 2007-02-26 23:23 UTC (permalink / raw)
  To: sparclinux

[-- Attachment #1: Type: text/plain, Size: 636 bytes --]

* David Miller <davem@davemloft.net>, [2007-02-26 15:16 -0800]:
>  From: Emanuele Rocca <ema@debian.org>

>  > On a Sun Blade 2000 I got this one every time I load eth1394:
>  > Kernel unaligned access at TPC[101880c8] ether1394_reset_priv+0x2c/0xb8 [eth1394]
>  > 
>  > I got rid of the message with the following patch:
>  
>  That is a different bug, and the current 2.6.x tree already has
>  that fix applied so you shouldn't need to apply that patch to
>  the vanilla tree.

Ah, nice. linux-source 2.6.18.dfsg.1-11 (Debian unstable) is affected by
the bug, so maybe we could add the patch?

Thanks.
ciao,
    ema

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2007-02-26 23:23 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-02-23 11:55 2.6.20 unaligned accesses Andrew Walrond
2007-02-26 10:12 ` Andrew Walrond
2007-02-26 18:33 ` David Miller
2007-02-26 23:14 ` Emanuele Rocca
2007-02-26 23:16 ` David Miller
2007-02-26 23:23 ` Emanuele Rocca

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.