The yield(-equivalent) instruction on ARMv6, and the Android Cronet bot

334 views
Skip to first unread message

Chris Palmer

unread,
Nov 21, 2016, 5:12:57 PM11/21/16
to Chromium-dev
Hi all,

My change was reverted because it broke a bot that is not on the CQ:

https://codereview.chromium.org/2484803003

{standard input}: Assembler messages:
{standard input}:72: Error: selected processor does not support ARM mode `yield'

I have 2 questions:

1. Can we get that bot on the CQ, so that we can save some time (i.e. avoid having to revert and re-land)?

2. Any clues and/or preferences as to how I should proceed? I wonder if it's just a build configuration issue for Android Cronet? This code has presumably been compiling and running on Blink for ARM all along, right? The only change was that the code was in base instead of in WebKit (where the Cronet builder never saw it).

It seems like I could just add a sources += [ ... ] if !android_cronet (or sources -= [ ... ] in components/cronet/android/BUILD.gn)? But I wonder if that would be avoiding the root problem.

Thanks!

Dirk Pranke

unread,
Nov 21, 2016, 5:25:15 PM11/21/16
to pal...@chromium.org, Chromium-dev, John Budorick, Mike Stipicevic
If I recall correctly, cronet needs to be able to run on ARMv6, so I suspect that the compile failure is real (i.e., the builder is correctly configured). It is true that there are things that compile base that don't compile blink.

It doesn't look like there is a matching trybot for this builder. At the very least, there should be, so can you file a bug asking for that so we can make sure we add them? In the meantime, you can either test this config locally or you can modify the MB config for one of the existing trybots to test it (if you need help with this you can follow up in said bug or with me or one of the android folks off-thread).

As to fixing it, modifying //base/BUILD.gn to not include those files when arm_version=6 is what I'd do.

-- Dirk

--
--
Chromium Developers mailing list: chromi...@chromium.org
View archives, change email options, or unsubscribe:
http://groups.google.com/a/chromium.org/group/chromium-dev

Chris Palmer

unread,
Nov 21, 2016, 5:35:57 PM11/21/16
to Dirk Pranke, Chromium-dev, John Budorick, Mike Stipicevic
On Mon, Nov 21, 2016 at 2:23 PM, Dirk Pranke <dpr...@chromium.org> wrote:

It doesn't look like there is a matching trybot for this builder. At the very least, there should be, so can you file a bug asking for that so we can make sure we add them?

 
In the meantime, you can either test this config locally or you can modify the MB config for one of the existing trybots to test it (if you need help with this you can follow up in said bug or with me or one of the android folks off-thread).

As to fixing it, modifying //base/BUILD.gn to not include those files when arm_version=6 is what I'd do.

Awesome, thanks Dirk!

Torne (Richard Coles)

unread,
Nov 22, 2016, 11:33:31 AM11/22/16
to pal...@chromium.org, Dirk Pranke, Chromium-dev, John Budorick, Mike Stipicevic
YIELD was added in ARMv6k, which was a minor revision bump of ARMv6 that includes *almost* all ARMv6 processors that actually exist - pretty much the only genuine v6 processor (rather than v6k) is the original ARM1136r0, and even the r1 version of this same core implements v6k.

I don't know if there are actually CPUs that Cronet needs to support which really are genuinely ARMv6 and not v6k. It's possible that there aren't, and we could just interpret arm_version=6 as meaning v6k instead, and allow the use of the yield instruction.

As an aside: it's *really* unclear from ARM documentation whether YIELD actually does anything or not. There's a lot of docs mentioning specific CPUs on which it is a NOP, but I can't find any documentation mentioning any specific CPU where it does anything, and if so, what it actually does (presumably it must do something like generating an undefined instruction trap so that the kernel can inspect the instruction, see that it's YIELD, and trigger preemption, since the CPU can't cause thread preemption directly). If anyone knows how it actually works or where I can find docs explaining it, that'd be neat to know just for my own curiosity :)

--

Chris Palmer

unread,
Nov 22, 2016, 2:33:35 PM11/22/16
to Torne (Richard Coles), Dirk Pranke, Chromium-dev, John Budorick, Mike Stipicevic
Thanks, Torne. I got annoyed by this last night, and so looked up some documentation. I found something that claims to be the ARMv6-M Architecture
Reference Manual (https://imagecraft.com/pub/ARM/DDI0419C.pdf), which in section A6.7.77 makes vague hand waving about YIELD.

I suspect that, if YIELD does anything, it does the kernel trap dance you describe.

I don't know how ARMv6k relates to ARMv6-M; maybe M is a more recent revision than K? Maybe I'm reading the wrong manual anyway. :)

Anyway, I've managed to work around the problem in the build config thanks to Dirk. If we can indeed support YIELD, or if we are sure we don't need to support YIELDless ARMs, that'd be great and I'd fire up a patch to the build config once we know for sure.

Torne (Richard Coles)

unread,
Nov 22, 2016, 4:15:35 PM11/22/16
to Chris Palmer, Dirk Pranke, Chromium-dev, John Budorick, Mike Stipicevic

You are indeed reading the wrong documentation. -M refers to the microcontroller variants of the ARM architecture and has nothing to do with any CPU that can run Android. :)
The "application processor" architecture is the relevant one, which is suffixed -A if it has a suffix at all (it is often not included as this is the "classic" ARM architecture and used to be the only one that existed). For some arcane reason the -A docs are mostly not publicly available on the internet; I think ARM want you to buy the manual. The -M docs are free and so people often find these by mistake :)
However, the architecture docs probably don't explain it at all, because it's probably implementation dependent (since many implementations implement it as a NOP).

Reply all
Reply to author
Forward
0 new messages