RFR: 8359105: RISC-V: No need for acquire fence in safepoint poll during JNI calls
Anjian Wen
wenanjian at openjdk.org
Thu Jun 12 03:22:10 UTC 2025
On Tue, 10 Jun 2025 06:33:34 GMT, Anjian Wen <wenanjian at openjdk.org> wrote:
> Acquire fence removal in safepoint poll
>
> At least in jdk11, when comes to safepoint::end, it will invoke SafepointMechanism::disarm_local_poll to change the polling_word_offset, which may cause a race when thread come to visit polling_word_offset in native_trans state, so we used to use acquire fence.
>
> Since the disarm_local_poll has been removed from SafepointSynchronize::end, Thread disarm itself in
> JavaThread::check_special_condition_for_native_trans when trans from native. it seems that there is no need for acquire fence.
>
> [0] https://github.com/openjdk/jdk/pull/20420
Thanks for your review!! I have changed the description.
About the safepoint_poll, I think it makes sence that there is no need to keep "bool acquire" argument when we change the last 'true' in downcallLinker_riscv.cpp, and I have updated the patch.
> Hey, sure.
>
> The description says "backport of", as you are changing master I think that description is wrong.
>
> The downcallLinker_riscv.cpp is the same case as the native transition. So I don't see why you would keep that acquire ?
>
> AFIACT no one should use acquire, thus this should then mean that we can remove "bool acquire" argument from safepoint_poll().
>
> That arm still have acquire in their downlinker seems like an oversight? 8337657 only have one reviewer, I think it should have been cought there. (please note https://wiki.openjdk.org/display/HotSpot/Pushing+a+HotSpot+change, two reviewers required) @dchuyko can you open a new issue and look at the acquire in downcall linker for aarch64 ?
>
> Thanks, Robbin
-------------
PR Comment: https://git.openjdk.org/jdk/pull/25709#issuecomment-2964941725
More information about the hotspot-dev
mailing list