[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-id: <alpine.LFD.2.00.1105261650330.3207@xanadu.home>
Date: Thu, 26 May 2011 17:03:39 -0400 (EDT)
From: Nicolas Pitre <nico@...xnic.net>
To: Will Deacon <will.deacon@....com>
Cc: Catalin Marinas <catalin.marinas@....com>,
Måns Rullgård <mans@...sr.com>,
linux-arm-kernel@...ts.infradead.org,
lkml <linux-kernel@...r.kernel.org>,
Andrew Morton <akpm@...ux-foundation.org>, sam@...nborg.org,
ak@...ux.intel.com
Subject: Re: [PATCH] ARM: Do not allow unaligned accesses when
CONFIG_ALIGNMENT_TRAP
On Thu, 26 May 2011, Will Deacon wrote:
> This issue seems to be caused by passing -fconserve-stack to GCC. This
> was added in 8f7f5c9f ("kbuild: set -fconserve-stack option for gcc
> 4.5") and as you can see from the archive:
>
> http://lkml.org/lkml/2009/9/20/39
>
> it was thought to only have an impact on inlining decisions. Looking at
> the documentation for GCC 4.6:
>
> -fconserve-stack
> Attempt to minimize stack usage. The compiler will attempt to
> use less stack space, even if that makes the program slower. This option
> implies setting the ‘large-stack-frame’ parameter to 100 and the
> ‘large-stack-frame-growth’ parameter to 400.
>
> So it sounds like we might not want to enable this blindly across all
> architectures. Indeed, on ARM, it encourages the compiler to pack
> variables on the stack which leads to the weird and wonderful alignment
> situation that has been encountered in this thread.
>
> Can we remove -fconserve-stack from the top-level Makefile (or at least
> make it conditional by architecture)?
I think this is an orthogonal issue.
My opinion is that we should use -mno-unaligned-access by default on
ARM. The reason is that we've been expecting the compiler not to cause
unaligned accesses for ages, and letting the compiler, for whatever
reasons including things like -fconserve-stack, produce unaligned
accesses behind our back is a change in behavior we might not always be
prepared for. Unaligned accesses in the kernel should be rare anyway,
and allowing the compiler to generate them can be allowed for selected
files when proven beneficial.
It is possible that -fconserve-stack is still valuable on ARM given that
it is also used with -mno-unaligned-access for other things than
structure packing on the stack, and therefore its merits can be debated
independently from the alignment issue at hand.
Nicolas
Powered by blists - more mailing lists