RFR: 8366441: AArch64: Support WFET in OnSpinWait [v2]
Andrew Haley
aph at openjdk.org
Fri Feb 6 09:55:43 UTC 2026
On Thu, 18 Dec 2025 16:31:04 GMT, Ruben <duke at openjdk.org> wrote:
>> Implement OnSpinWait based on WFET - wait for event with timeout:
>> - introduce OnSpinWaitDelay - the OnSpinWait time in nanoseconds;
>> - the OnSpinWaitInstCount is expected to be 1 when WFET is used;
>> - the waiting loop is followed by SB - to ensure following instructions aren't speculated until wait is finished;
>> - the timer register is read via the self-synchronized view CNTVCTSS_EL0 to prevent the read being hoisted out of the loop.
>>
>> The WFET and CNTVCTSS_EL0 read are added to aarch64-asmtest.py as hex values - using the instruction mnemonics would require support of -march=armv9-2.a, and consequently, the binutils 2.36+.
>
> Ruben has updated the pull request incrementally with one additional commit since the last revision:
>
> Fix bsd_aarch64 build
src/hotspot/cpu/aarch64/vm_version_aarch64.cpp line 77:
> 75:
> 76: if (!FLAG_IS_DEFAULT(OnSpinWaitInstCount) && OnSpinWaitInstCount != 1) {
> 77: vm_exit_during_initialization("OnSpinWaitInstCount value other than one cannot be used for OnSpinWaitInst 'wfet'");
Suggestion:
vm_exit_during_initialization("OnSpinWaitInstCount for OnSpinWaitInst 'wfet' must be 1");
Reason: Focus on what should be done rather than what should not. It's easier to understand.
src/hotspot/cpu/aarch64/vm_version_aarch64.cpp line 81:
> 79: } else {
> 80: if (!FLAG_IS_DEFAULT(OnSpinWaitDelay)) {
> 81: vm_exit_during_initialization("OnSpinWaitDelay can only be used with OnSpinWaitInst 'wfet'");
Suggestion:
vm_exit_during_initialization("OnSpinWaitDelay can only be used with -XX:OnSpinWaitInst=wfet");
This can be copy-and-pasted.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/27030#discussion_r2773243388
PR Review Comment: https://git.openjdk.org/jdk/pull/27030#discussion_r2773250806
More information about the hotspot-dev
mailing list