> From: Michael Hope <michael.h...@linaro.org> > Date: Wed, 13 Jun 2012 00:43:47 +0200
> On 13 June 2012 02:32, Hans-Peter Nilsson <hans-peter.nils...@axis.com> wrote: > >> From: Hans-Peter Nilsson <h...@axis.com> > >> Date: Mon, 11 Jun 2012 00:59:57 +0200 > >> > > user-space code". Maybe the kernel too, I can't say; there was > >> > > IIRC no sign of it. > > But (at least) after removing some local changed defaults, > > there's at boot-time a lot of: > > > > [ 0.950000] Unhandled fault: alignment exception (0x801) at 0xc821ddee > > That's a kernel address. Yes I know, there's no mystery there. My point was that misalignment traps for this configuration happen at boot time too, not just from userspace, hence correcting my earlier statement. > For reference, the message comes from > arch/arm/mm/alignment.c:alignment_init() from the default trap > handler. No news there. > The lines just before this disable the unaligned trap for > usermode: > > if (cpu_is_v6_unaligned()) { > cr_alignment &= ~CR_A; > cr_no_alignment &= ~CR_A; > set_cr(cr_alignment); > ai_usermode = safe_usermode(ai_usermode, false); > } > > Support was added by Russell King in 2008-12 and updated by Dave > Martin on 2011-07. I see it, for example in stock 2.6.35.9. > Out of interest, does your CPU report support for unaligned access via > CP15 CR1? It's bit 22 and shows during boot. My board shows: > > CPU: ARMv7 Processor [411fc092] revision 2 (ARMv7), cr=50c5387d The log that my colleague sent me contains: [ 0.000000] CPU: ARMv6-compatible processor [4117b365] revision 5 (ARMv6TEJ), cr=00c5387f Bit 22 all set... > This compiles into a five byte unaligned memcpy: Yes, that was the point. :) > Linaro's stock configuration is -march=armv7-a -mtune=cortex-a9 > -mthumb. Ubuntu is the same. I can't reproduce the fault on a > PandaBoard with omapzoom 2.6.35, Ubuntu 3.2.14, Ubuntu Precise 4.6.3 > GCC, or plain gcc-4.7.1-RC-20120606. Looking at arch/arm/mm/alignment.c:alignment_init(), I see we have local patches always forcing a warning. Bah. Is your point that having an OS kernel that traps for unaligned accesses for ARMv6 rare enough that there's no reason whatsoever for a release note that gcc-4.7 now emits such accesses "by itself"? Even though this was caused by non-stock Linux, I think there's reason enough for a caveat entry in gcc-4.7/changes.html (just as worded; the caveat wasn't directed just at Linux, mind you), but I retract my suggestion to change back the default. Maybe we should add a line to the suggested entry mentioning the first stock Linux version that automatically adjusts this, so stock Linux-users can be calmed. ;-P Do you agree? Something like "Linux/ARM in official releases has automatically and unconditionally supported unaligned accesses as emitted by GCC due to this option being active since Linux version 2.X.Y". I guess X is 6. What is Y? brgds, H-P