linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: catalin.marinas@arm.com (Catalin Marinas)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 4/4] ARM: hwcap: disable HWCAP_SWP if the CPU advertises it has exclusives
Date: Mon, 7 Jul 2014 18:50:58 +0100	[thread overview]
Message-ID: <20140707175058.GM32276@arm.com> (raw)
In-Reply-To: <20140707163143.GE21766@n2100.arm.linux.org.uk>

On Mon, Jul 07, 2014 at 05:31:43PM +0100, Russell King - ARM Linux wrote:
> On Mon, Jul 07, 2014 at 04:59:42PM +0100, Catalin Marinas wrote:
> > Going on topic again, LDREXB is present in ARM1136 r1 but your changes
> > would not detect it (and it's a different ID_ISAR3 format anyway). If we
> > care about this case, you could either pretend that ARM1136 r1 is ARMv6K
> > and link those decisions to v6K+ tests or check for individual features
> > which for ARM1136 would require a different check from standard CPUID.
> 
> Ever since ARMv6 was first added, HWCAP_SWP has been indicated for all
> ARMv6 CPUs and their derivatives.  Indeed, the SWP instruction is
> supported in hardware.
> 
> Hence, indicating HWCAP_SWP on ARMv6 whether or not there is LDREXB
> support is /not/ incorrect in any way.
> 
> ARM1136 r1 added LDREXB as part of the ARMv6K adoption, but it kept
> the SWP instruction (which can't be disabled.)  So, indicating
> HWCAP_SWP also is /not/ incorrect.

Fine be me.

> However, when it comes to SMP, we would _prefer_ userspace to use
> the exclusives instructions, though it seems that the SWP behaviour
> on an ARMv6K SMP system with respect to other CPUs is not documented.
> All things being equal, we would prefer SWP not be used there because
> we don't know whether it's safe.  Unfortunately, we can't turn the
> instruction off, so we can't emulate it.

IIRC, ARM11MPCore is fine. Certain ARMv7 MP implementations have issues
with SWP, though not all AFAIK.

> However, we know that some userspace running there may well contain
> SWP instructions.  So, as there aren't any bug reports, it's probably
> safe to assume that SWP is safe on ARMv6K SMP systems.
> 
> 
> So, the upshot of this is:
> * SWP on all ARMv6 is fine.
> * Advertising HWCAP_SWP on all ARMv6 is fine too.
> * We would prefer not to advertise HWCAP_SWP on ARMv6 with support
>   for the exclusives, and we can do that trivially where we can
>   check the CPUID values.
> * ARM1136 is either ARMv6 or ARMv6K depending on its revision -
>   and thus may have LDREXB, but LDREXB is not trivially detectable.
> 
> 
> I believe what I'm doing in this patch is architecturally correct, I
> also believe it to be safe for the troublesome ARM1136 by way of
> defaulting to advertising HWCAP_SWP.

I agree. With the above assumptions, feel free to add my ack for the
whole series.

Acked-by: Catalin Marinas <catalin.marinas@arm.com>

  reply	other threads:[~2014-07-07 17:50 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-04 19:51 [PATCH 0/4] ABI updates Russell King - ARM Linux
2014-07-04 19:52 ` [PATCH 1/4] ARM: alignment: save last kernel aligned fault location Russell King
2014-07-04 19:52 ` [PATCH 2/4] ARM: SWP emulation: always enable when SMP is enabled Russell King
2014-07-04 19:52 ` [PATCH 3/4] ARM: SWP emulation: only initialise on ARMv7 CPUs Russell King
2014-07-04 19:52 ` [PATCH 4/4] ARM: hwcap: disable HWCAP_SWP if the CPU advertises it has exclusives Russell King
2014-07-04 20:11   ` Arnd Bergmann
2014-07-04 20:51     ` Russell King - ARM Linux
2014-07-04 20:58       ` Arnd Bergmann
2014-07-04 21:48         ` Russell King - ARM Linux
2014-07-05 18:46           ` Arnd Bergmann
2014-07-07 11:02         ` Catalin Marinas
2014-07-07 11:17           ` Russell King - ARM Linux
2014-07-07 12:05             ` Catalin Marinas
2014-07-07 13:13               ` Russell King - ARM Linux
2014-07-07 13:46                 ` Catalin Marinas
2014-07-07 15:31                   ` Russell King - ARM Linux
2014-07-07 15:59                     ` Catalin Marinas
2014-07-07 16:31                       ` Russell King - ARM Linux
2014-07-07 17:50                         ` Catalin Marinas [this message]
2014-07-07  9:34       ` Will Deacon
2014-07-07  9:41         ` Russell King - ARM Linux
2014-07-07  9:51           ` Will Deacon
2014-07-04 20:12 ` [PATCH 0/4] ABI updates Arnd Bergmann
2014-07-07 11:19 ` Tony Lindgren
2014-07-07 11:23   ` Russell King - ARM Linux
2014-07-07 13:23     ` Tony Lindgren
2014-07-07 13:52 ` 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=20140707175058.GM32276@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;
as well as URLs for NNTP newsgroup(s).