RFR: 8366441: AArch64: Support WFET in OnSpinWait [v2]

Andrew Haley aph at openjdk.org
Fri Feb 6 09:49:11 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/share/runtime/flags/jvmFlagConstraintsRuntime.cpp line 165:

> 163:                           "must be enabled via -XX:+UnlockExperimentalVMOptions\n");
> 164:       return JVMFlag::VIOLATES_CONSTRAINT;
> 165:     }

Suggestion:

      JVMFlag::printError(verbose,
                          "'wfet' value for OnSpinWaitInst is experimental and "
                          "must be enabled via -XX:+UnlockExperimentalVMOptions\n"
                          "Error: The unlock option must precede 'OnSpinWaitInst'.\n");
      return JVMFlag::VIOLATES_CONSTRAINT;
    }

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

PR Review Comment: https://git.openjdk.org/jdk/pull/27030#discussion_r2773213881


More information about the hotspot-dev mailing list