From: catalin.marinas@arm.com (Catalin Marinas)
To: linux-arm-kernel@lists.infradead.org
Subject: Android and compatibility with deprecated armv7 instructions
Date: Fri, 4 Jul 2014 09:57:45 +0100 [thread overview]
Message-ID: <20140704085745.GB16404@arm.com> (raw)
In-Reply-To: <20140703183055.GC32514@n2100.arm.linux.org.uk>
On Thu, Jul 03, 2014 at 07:30:55PM +0100, Russell King - ARM Linux wrote:
> On Thu, Jul 03, 2014 at 08:15:32PM +0200, Arnd Bergmann wrote:
> > The default answer is "as long as anybody is using it". I had the
> > same idea with making it gradually slower but in reality that isn't
> > going to help. I think the best option is to make it easy to find
> > and debug any application that is using deprecated instructions so
> > people stop relying on them, and encourage distros to turn the emulation
> > code off as soon as they are ready.
>
> Yes, SWP is deprecated in ARMv6 and ARMv7. However, it is required to
> implement atomics in ARMv5 - there is _no_ other way.
>
> So, let's say that you want to build an application which will run on
> Android from ARMv5 through to ARMv8.
>
> You may need to make the decision about when to use SWP and when to
> use the new exclusives. One possible way is to hook SIGILL, and
> try executing a LDREX. If it succeeds, great, they can be used.
>
> Now, consider this. You build your application for ARMv5. The toolchain
> in this instance will *not* warn you that SWP is deprecated. You've been
> running it on Android platforms from ARMv5 upwards. You have never had
> a report of failure.
With EABI, we tried to address the differences between architectures by
providing the kuser helpers. Most EABI distros moved to using them and
no longer executing SWP in user space (remember glibc having a cmpxchg
implementation based on SWP that "mostly" worked). Over the years the
hope was that it would completely disappear but I agree that we failed
to address this properly at the kernel level (e.g. more aggressive
warnings, remove HWCAP_SWP).
On arm64 we took a radical stance - SIGILL (and if you are still
worried, emulate it in user space).
> An ARMv8 Android device comes to market, and you now start getting lots
> of bug reports...
We should have started addressing these in ARMv7 but unfortunately we
didn't have a good plan for getting rid of emulated instructions.
> Even with SWP_EMULATE enabled and with the debug problem fixed... does
> it help warn people? Only if you're running on a CPU with virtualisation
> extensions, because it silently continues to work on CPUs without.
Some clarification here. The virtualisation extensions made SWP
_optional_ (i.e. it may not be present at all). The ARMv7
multiprocessing extensions introduced the possibility to disable/trap
SWP via the SCTLR.SW bit because it was no longer atomic. So basically
native SWP only works (as expected, atomically) on ARMv7 UP and earlier.
--
Catalin
next prev parent reply other threads:[~2014-07-04 8:57 UTC|newest]
Thread overview: 76+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-07-01 23:06 Android and compatibility with deprecated armv7 instructions Colin Cross
2014-07-01 23:42 ` Olof Johansson
2014-07-01 23:48 ` Mark Brown
2014-07-02 10:01 ` Will Deacon
2014-07-02 15:48 ` Colin Cross
2014-07-02 16:16 ` Will Deacon
2014-07-02 18:03 ` Christopher Covington
2014-07-02 18:25 ` Will Deacon
2014-07-02 19:47 ` Mark Brown
2014-07-05 21:26 ` Rob Herring
2014-07-02 16:39 ` Mark Brown
2014-07-02 17:01 ` Will Deacon
2014-07-02 17:33 ` Mark Brown
2014-07-02 22:14 ` Grant Likely
2014-07-03 10:41 ` Catalin Marinas
2014-07-03 14:28 ` Arnd Bergmann
2014-07-03 15:00 ` Russell King - ARM Linux
2014-07-03 15:40 ` Grant Likely
2014-07-03 17:13 ` Catalin Marinas
2014-07-03 17:48 ` Russell King - ARM Linux
2014-07-03 18:15 ` Arnd Bergmann
2014-07-03 18:30 ` Russell King - ARM Linux
2014-07-03 18:37 ` Will Deacon
2014-07-03 18:52 ` Russell King - ARM Linux
2014-07-03 19:00 ` Will Deacon
2014-07-04 8:57 ` Catalin Marinas [this message]
2014-07-04 9:25 ` Russell King - ARM Linux
2014-07-04 10:12 ` Arnd Bergmann
2014-07-04 14:09 ` Dr. David Alan Gilbert
2014-07-04 12:56 ` Grant Likely
2014-07-04 13:31 ` Russell King - ARM Linux
2014-07-03 18:46 ` Will Deacon
2014-07-03 18:53 ` Arnd Bergmann
2014-07-03 19:07 ` Russell King - ARM Linux
2014-07-03 19:40 ` Arnd Bergmann
2014-07-04 13:25 ` Grant Likely
2014-07-03 16:22 ` Grant Likely
2014-07-03 17:05 ` Russell King - ARM Linux
2014-07-03 17:32 ` Will Deacon
2014-07-03 18:23 ` Arnd Bergmann
2014-07-03 18:38 ` Peter Maydell
2014-07-03 18:40 ` Will Deacon
2014-07-03 18:32 ` Mark Brown
2014-07-03 22:16 ` Måns Rullgård
2014-07-03 22:47 ` Russell King - ARM Linux
2014-07-04 7:08 ` Ard Biesheuvel
2014-07-04 8:24 ` Catalin Marinas
2014-07-04 8:33 ` Ard Biesheuvel
2014-07-04 9:21 ` Måns Rullgård
2014-07-04 9:34 ` Russell King - ARM Linux
2014-07-04 10:21 ` Måns Rullgård
2014-07-04 10:33 ` Russell King - ARM Linux
2014-07-04 11:00 ` Ard Biesheuvel
2014-07-04 17:28 ` Nicolas Pitre
2014-07-03 17:43 ` Catalin Marinas
2014-07-04 13:22 ` Grant Likely
2014-07-04 19:24 ` Mark Brown
2014-07-04 19:33 ` Arnd Bergmann
2014-07-04 22:06 ` Måns Rullgård
2014-07-04 22:08 ` Mark Brown
2014-07-05 11:14 ` Catalin Marinas
2014-07-05 11:25 ` Russell King - ARM Linux
2014-07-05 16:43 ` Mark Brown
2014-07-05 17:06 ` Catalin Marinas
2014-07-05 18:43 ` Arnd Bergmann
2014-07-05 21:19 ` Catalin Marinas
2014-07-06 15:39 ` Arnd Bergmann
2014-07-07 13:59 ` Janne Grunau
2014-07-07 14:52 ` Catalin Marinas
2014-07-07 17:52 ` Janne Grunau
2014-07-07 15:43 ` Peter Maydell
2014-07-08 5:28 ` Måns Rullgård
2014-07-07 14:35 ` Catalin Marinas
2014-07-07 21:26 ` Arnd Bergmann
2014-07-07 12:28 ` Grant Likely
2014-07-07 18:35 ` Colin Cross
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=20140704085745.GB16404@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.