[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-id: <alpine.LFD.2.00.1106201515050.2142@xanadu.home>
Date: Mon, 20 Jun 2011 15:20:44 -0400 (EDT)
From: Nicolas Pitre <nico@...xnic.net>
To: Russell King - ARM Linux <linux@....linux.org.uk>
Cc: Arnd Bergmann <arnd@...db.de>,
Alan Stern <stern@...land.harvard.edu>, gregkh@...e.de,
linux-usb@...r.kernel.org, lkml <linux-kernel@...r.kernel.org>,
Rabin Vincent <rabin@....in>,
Alexander Holler <holler@...oftware.de>,
linux-arm-kernel@...ts.infradead.org
Subject: Re: [PATCH] USB: ehci: use packed,
aligned(4) instead of removing the packed attribute
On Mon, 20 Jun 2011, Russell King - ARM Linux wrote:
> On Mon, Jun 20, 2011 at 06:58:45PM +0200, Arnd Bergmann wrote:
> > A recent change in gcc changed the default behaviour when compiling the
> > ehci driver on ARM, but the behaviour was already nondeterministic
> > because the definition of the readl/writel macros on ARM relies on
> > unspecified behaviour (cast to pointer with larger aligment).
>
> It's unspecified behaviour period. If you pass a pointer to readl/writel
> which is not word aligned, what you get back is anyones guess.
The pointer _is_ aligned. The problem is that it comes from the address
of a structure member, which structure is marked __packed.
Older GCC would see the cast to unsigned int applied to that pointer
within the ARM's readl()/writel() implementation and ignore that the
source of the address is marked __packed, which __packed implies an
alignment of 1. REcent GCC versions would honnor the alignment of 1 and
perform the unsigned int * access using byte sized loads/stores.
Nicolas
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists