[lkml]   [2011]   [May]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [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:
> 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.

 \ /
  Last update: 2011-05-26 23:05    [W:0.101 / U:9.260 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site