linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: dave.martin@linaro.org (Dave Martin)
To: linux-arm-kernel@lists.infradead.org
Subject: Bad traps for unaligned access in STM instruction
Date: Tue, 18 Sep 2012 16:25:02 +0100	[thread overview]
Message-ID: <20120918152502.GB2110@linaro.org> (raw)
In-Reply-To: <20120915105151.GZ1943@vicerveza.homeunix.net>

On Sat, Sep 15, 2012 at 12:51:51PM +0200, Llu?s Batlle i Rossell wrote:
> On Sat, Sep 15, 2012 at 12:46:02PM +0200, Llu?s Batlle i Rossell wrote:
> > I'll start looking at the arm traps for unaligned accesses, but maybe someone
> > here can give a quick answer.
> 
> Ah stupid me, here goes the quick answer. I had mode 'warn', and not
> 'fixup+warn'. With 'fixup' enabled, all works fine.
> 
> I was used to mips, where I think there isn't a 'warn' that doesn't 'fixup'.

What source are you actually trying to build/run here?  The "fixup" alignment
mode is primarily a workaround for incorrect code, because the legacy rotated
unaligned access behaviour would cause really weird things to happen silently
in the offending code.  (Although misaligned LDM/STM was never permitted by
the architecture anyway, and normally indicates badly-written code.)

Pure C code should never trigger alignment faults fixups unless it
violates the C language specification.

Assembler should not trigger faults at all, because it's arch-specific
and so you can and should fix it not to cause faults.  Optimising code
in assembler becomes pointless if you write or use it in a way which
triggers unnecessary faults into the kernel.

If you are getting faults in compiled code and the source code follows
the C standard with regard to alignment requirements, this suggests a
bug in the compiler.

Either way, it needs investigating.

Cheers
---Dave

  reply	other threads:[~2012-09-18 15:25 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-15 10:46 Bad traps for unaligned access in STM instruction Lluís Batlle i Rossell
2012-09-15 10:51 ` Lluís Batlle i Rossell
2012-09-18 15:25   ` Dave Martin [this message]
2012-09-18 15:31     ` Lluís Batlle i Rossell
2012-09-18 15:44       ` Nicolas Pitre
2012-09-18 15:46         ` Lluís Batlle i Rossell
2012-09-18 19:07       ` Dave Martin

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=20120918152502.GB2110@linaro.org \
    --to=dave.martin@linaro.org \
    --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;
as well as URLs for NNTP newsgroup(s).