[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <yw1x626hp20o.fsf@unicorn.mansr.com>
Date: Thu, 11 Oct 2012 14:32:55 +0100
From: Måns Rullgård <mans@...sr.com>
To: Rob Herring <robherring2@...il.com>
Cc: Eric Dumazet <eric.dumazet@...il.com>,
Arnd Bergmann <arnd@...db.de>,
linux-arm-kernel@...ts.infradead.org,
Russell King - ARM Linux <linux@....linux.org.uk>,
Jon Masters <jonathan@...masters.org>, netdev@...r.kernel.org,
Måns Rullgård <mans@...sr.com>,
David Laight <David.Laight@...lab.com>
Subject: Re: alignment faults in 3.6
Rob Herring <robherring2@...il.com> writes:
> On 10/11/2012 07:40 AM, Eric Dumazet wrote:
>> On Thu, 2012-10-11 at 12:28 +0000, Arnd Bergmann wrote:
>>
>>>
>>> Rob Herring as the original reporter has dropped off the Cc list, adding
>>> him back.
>>>
>>> I assume that the calxeda xgmac driver is the culprit then. It uses
>>> netdev_alloc_skb() rather than netdev_alloc_skb_ip_align() in
>>> xgmac_rx_refill but it is not clear whether it does so intentionally
>>> or by accident.
>
> This in fact does work and eliminates the unaligned traps. However, not
> all h/w can do IP aligned DMA (i.MX FEC for example), so I still think
> this is a questionable optimization by the compiler. We're saving 1 load
> instruction here for data that is likely already in the cache. It may be
> legal per the ABI, but the downside of this optimization is much greater
> than the upside.
The compiler is working *exactly* as it should. Merging the loads saves
cycles *and* code size. Many of these added up can make a real difference.
When writing code, you must follow all the rules, whether you like them
or not. Without rules, the compiler would be very limited in the
optimisations it could perform.
Unfortunately, new optimisations occasionally uncover broken code
violating some constraint or other. When this happens, the correct
course of action is to fix the code, not cripple the compiler.
--
Måns Rullgård
mans@...sr.com
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists