public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
From: catalin.marinas@arm.com (Catalin Marinas)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] ARM: alignment: setup alignment handler earlier
Date: Wed, 7 Sep 2011 18:24:45 +0100	[thread overview]
Message-ID: <20110907172445.GD1696@e102109-lin.cambridge.arm.com> (raw)
In-Reply-To: <20110907170452.GC2327@n2100.arm.linux.org.uk>

On Wed, Sep 07, 2011 at 06:04:52PM +0100, Russell King - ARM Linux wrote:
> On Wed, Sep 07, 2011 at 05:42:19PM +0100, M?ns Rullg?rd wrote:
> > There are such instructions (ldrd, ldm), but gcc will not emit those
> > unless the address is known to be aligned.  For ARMv6 and later, gcc 4.6
> > *will* emit potentially unaligned ldr and ldrh since these very clearly
> > allow an unaligned address and are faster than the alternatives in all
> > implementations to date.  This is unless strict alignment checking is
> > explicitly enabled, which unfortunately the Linux kernel does for no
> > apparent reason at all.
> 
> "no apparant reason at all" heh.  The reason is to keep the code
> simple and free from bugs.  To do otherwise means that each of the
> CPU files needs to be littered with ifdefs to deal with the alignment
> fault configuration, of which there are 16 of them (ignoring v6 and v7.)
> 
> If you think code maintanence of the same thing in 16 places is efficient
> then I guess there is "no apparant reason".  I beg to differ, being one
> of those folk who have had to edit 18 different places several times.
> 
> So no, I do not intend to move this:
> 
> #ifdef CONFIG_ALIGNMENT_TRAP
>         orr     r0, r0, #CR_A
> #else
>         bic     r0, r0, #CR_A
> #endif
> 
> into 16 separate places in the kernel.

What about something like this (untested):

#if defined(CONFIG_ALIGNMENT_TRAP) && __LINUX_ARM_ARCH__ < 6
	orr	r0, r0, #CR_A
#else
	bic	r0, r0, #CR_A
#endif

-- 
Catalin

  reply	other threads:[~2011-09-07 17:24 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-09-07 13:35 [PATCH] ARM: alignment: setup alignment handler earlier John Ogness
2011-09-07 13:54 ` Måns Rullgård
2011-09-07 14:28   ` Catalin Marinas
2011-09-07 14:40 ` Catalin Marinas
2011-09-07 16:28   ` Russell King - ARM Linux
2011-09-07 16:42     ` Måns Rullgård
2011-09-07 17:04       ` Russell King - ARM Linux
2011-09-07 17:24         ` Catalin Marinas [this message]
2011-09-07 17:40         ` Måns Rullgård
2011-09-07 16:43     ` Catalin Marinas

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20110907172445.GD1696@e102109-lin.cambridge.arm.com \
    --to=catalin.marinas@arm.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox