RFR: 8322535: Change default AArch64 SpinPause instruction
Andrew Haley
aph at openjdk.org
Tue Jan 30 09:01:42 UTC 2024
On Mon, 15 Jan 2024 16:25:08 GMT, Fredrik Bredberg <fbredberg at openjdk.org> wrote:
> The Java options OnSpinWaitInst lets you choose which AArch64 instruction should be used in `SpinPause()`. Valid values are "none", "nop", "isb" and "yield". Today the default value for OnSpinWaitInst is unfortunately "none".
>
> However some CPUs changes the default SpinPause instruction to something better if the user hasn't used the OnSpinWaitInst option. For instance if you run a Neoverse N1, N2, V1 or V2, the default SpinPause instruction will be changed to "isb". After doing some measurements on Apple's M1-M3 CPUs it also seems like "isb" is the best yielding instruction on on those CPUs.
>
> This PR changes the default SpinPause instruction to "yield" on all AArch64 platforms except on Apple's M1, M2 and M3 CPUs on which the default value will be "isb".
>
> Tested tier1-tier7 successfully on linux-aarch64 and macosx-aarch64.
> > Arm tell us that 'yield' is basically implemented as a nop.
>
> It is not doing much in their current designs, indeed. That's their (questionable?) implementation choice. New AmpereOne chips do however implement yield.
>
> Since the ISA interface gives us a yield instruction dedicated for this and at least one new chip implements it, it makes sense to me that it is the _default_ instruction, rather than none, going forward.
>
> Then we can continue to recognize chips that didn't implement yield and try to figure out how to deal with that awkwardness separately, and hope that vendors (indeed including ARM), start implementing the ISA, instead of having us doubling down on horrible hacks that try to quack like a yield instruction.
This does have the appeal of sweet reasonableness, I agree. However, the vast majority of non-Apple parts are Arm's designs.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/17430#issuecomment-1916360990
More information about the hotspot-dev
mailing list