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

Andrew Haley aph at openjdk.org
Mon Mar 2 10:30:05 UTC 2026


On Fri, 27 Feb 2026 23:32:45 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 with a new target base due to a merge or a rebase. The pull request now contains 11 commits:
> 
>  - Fix handling platform-specific default values of OnSpinWaitInstCount
>  - Set default OnSpinWaitDelay to 40 and clarify it is the minimal delay
>  - Merge from mainline
>  - Set default OnSpinWaitDelay to 100
>  - Address review comments
>  - Apply PR review "Suggested changes" from @theRealAph
>  - Merge from mainline
>  - Fix bsd_aarch64 build
>  - Update
>    
>    - Address review comments
>    - Fix test
>    - Mark the support experimental
>    - Remove changes in src/hotspot/os_cpu/bsd_aarch64
>  - Merge from mainline
>  - ... and 1 more: https://git.openjdk.org/jdk/compare/4e15a4ad...da95b197

With that small change, we're good to go.

src/hotspot/cpu/aarch64/globals_aarch64.hpp line 127:

> 125:           range(1, 99)                                                  \
> 126:   product(uint, OnSpinWaitDelay, 40, EXPERIMENTAL,                      \
> 127:           "The minimal delay (in nanoseconds) of the OnSpinWait loop."  \

Suggestion:

          "The minimum delay (in nanoseconds) of the OnSpinWait loop."  \

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

PR Review: https://git.openjdk.org/jdk/pull/27030#pullrequestreview-3875278792
PR Review Comment: https://git.openjdk.org/jdk/pull/27030#discussion_r2871617770


More information about the hotspot-dev mailing list