RFR: 8322535: Change default AArch64 SpinPause instruction [v2]

Fredrik Bredberg fbredberg at openjdk.org
Tue Feb 6 12:49:56 UTC 2024


On Mon, 5 Feb 2024 15:29:36 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.
>
> Fredrik Bredberg has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains four additional commits since the last revision:
> 
>  - Removed isb as default SpinPause instruction for Apple silicon
>  - Merge branch 'master' into 8322535_default_spinpause_inst
>  - Merge branch 'master' into 8322535_default_spinpause_inst
>  - 8322535: Change default AArch64 SpinPause instruction

Thank you guys for review comments. If anyone wants to continue to evaluate different `SpinPause()` instructions I've attached a file (`spin_pause.c`) to [JDK-8322535](https://bugs.openjdk.org/browse/JDK-8322535)  which can be used to measure the execution time for different instructions that are more or less suitable for use in `SpinPause()`, e.g. `nop`, `pause`, `yield` and `isb`.

If no one else has anything to add, I'll integrate (as soon as I can convince a sponsor).

-------------

PR Comment: https://git.openjdk.org/jdk/pull/17430#issuecomment-1929456497


More information about the hotspot-dev mailing list