RFR: 8322535: Change default AArch64 SpinPause instruction
Andrew Haley
aph at openjdk.org
Wed Jan 17 16:44:53 UTC 2024
On Wed, 17 Jan 2024 15:02:46 GMT, Evgeny Astigeevich <eastigeevich at openjdk.org> wrote:
> > Maybe the most reasonable way forward is to only change the default value of OnSpinWaitInst from "none" to "yield" and NOT change it to "isb" for Apple CPUs.
>
> Do we have anyone from Apple who can suggest a spin pause implementation? As no real cases for Apple CPUs exists, just microbenchmarks, choosing `isb` might be premature. IMO, even without real cases I would have chosen `isb` if it had a similar latency as the Intel `pause`.
It'd be nice if we knew what that latency was.
> > We could execute a bunch of UDIV instructions with a loop-carried dependency, or cycle an xor-shift generator. That could be made to delay for any number of clock cycles, so we can delay without the side effects of an ISB.
>
> This approach is not power efficient.
Huh? The only real use for SpinPause is to prevent bus contention when trying to acquire a lock. Chances are we only really have to spin for a few dozen cycles before retrying. It's not long enough to affect power consumption much. Are you thinking of a longer pause?
> In case of Neoverse `isb` have shown to use less power than any instruction executing on the CPU back-end. If Apple CPUs have the similar `isb` behaviour, it would be a reason to use `isb`.
OK, so now I'm really curious, given that ISB has a lot of work to do because it has to flush and restart a bunch of on-the-fly instructions. Can you provide any links for where it's been shown to use less power?
-------------
PR Comment: https://git.openjdk.org/jdk/pull/17430#issuecomment-1896192808
More information about the hotspot-dev
mailing list