linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: will.deacon@arm.com (Will Deacon)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] ARM: Correct WFE() in asm/spinlock.h for Thumb-2
Date: Wed, 9 Feb 2011 10:20:29 -0000	[thread overview]
Message-ID: <001d01cbc842$fa1aacc0$ee500640$@deacon@arm.com> (raw)
In-Reply-To: <AANLkTi=XfBjite-xtR8z_+5ATxSb4a9XDNAXdLBowWKY@mail.gmail.com>

Hi Dave,

> On Tue, Feb 8, 2011 at 4:40 PM, Russell King - ARM Linux
> <linux@arm.linux.org.uk> wrote:
> > On Tue, Feb 08, 2011 at 03:20:14PM +0000, Dave Martin wrote:
> >> The content for ALT_SMP() in the definition of WFE() expands to 6
> >> bytes (IT cc ; WFEcc.W), which breaks the assumptions of the fixup
> >> code, leading to lockups when the affected code gets run.
> >
> > Why does it?  My understanding is that the .w suffix forces the assembler
> > to use the ARM encoding for the instruction.
> 
> The .w suffix forces a 32-bit encoding of Thumb-2 instructions for
> which a 16-bit encoding is available.  Unfortunately, the 32-bit

[...]

> the WFE into the 4 bytes expected by ALT_SMP().  For safety, I write
> it out explicitly: ALT_SMP("wfene", ...) would work sometimes but
> might not work as expected if the previous instruction has an EQ or NE
> condition, because then the assembler wouldn't need to insert an extra
> IT when it generates its output...

That's really horrible! It might be worth commenting the explicit
IT in your WFE macro to explain why we can't rely on the assembler
to generate it for us.

With that minor change:

Acked-by: Will Deacon <will.deacon@arm.com>

Will

  reply	other threads:[~2011-02-09 10:20 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-08 15:20 [PATCH] ARM: Correct WFE() in asm/spinlock.h for Thumb-2 Dave Martin
2011-02-08 16:40 ` Russell King - ARM Linux
2011-02-08 16:56   ` Dave Martin
2011-02-09 10:20     ` Will Deacon [this message]
2011-02-09 13:04       ` Russell King - ARM Linux
2011-02-09 16:38 ` Nicolas Pitre
2011-02-09 17:00   ` 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='001d01cbc842$fa1aacc0$ee500640$@deacon@arm.com' \
    --to=will.deacon@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;
as well as URLs for NNTP newsgroup(s).