Skip to content

8359105: RISC-V: No need for acquire fence in safepoint poll during JNI calls #25709

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

Anjian-Wen
Copy link
Contributor

@Anjian-Wen Anjian-Wen commented Jun 10, 2025

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 in safepoint_poll.

[0] #20420


Progress

  • Change must be properly reviewed (1 review required, with at least 1 Reviewer)
  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue

Issue

  • JDK-8359105: RISC-V: No need for acquire fence in safepoint poll during JNI calls (Enhancement - P4)

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/25709/head:pull/25709
$ git checkout pull/25709

Update a local copy of the PR:
$ git checkout pull/25709
$ git pull https://git.openjdk.org/jdk.git pull/25709/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 25709

View PR using the GUI difftool:
$ git pr show -t 25709

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/25709.diff

Using Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Jun 10, 2025

👋 Welcome back wenanjian! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

@openjdk
Copy link

openjdk bot commented Jun 10, 2025

❗ This change is not yet ready to be integrated.
See the Progress checklist in the description for automated requirements.

@openjdk
Copy link

openjdk bot commented Jun 10, 2025

@Anjian-Wen The following label will be automatically applied to this pull request:

  • hotspot

When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing list. If you would like to change these labels, use the /label pull request command.

@Anjian-Wen
Copy link
Contributor Author

/issue JDK-8359105

@openjdk openjdk bot changed the title RISC-V: No need for acquire fence in safepoint poll during JNI calls 8359105: RISC-V: No need for acquire fence in safepoint poll during JNI calls Jun 10, 2025
@openjdk
Copy link

openjdk bot commented Jun 10, 2025

@Anjian-Wen The primary solved issue for a PR is set through the PR title. Since the current title does not contain an issue reference, it will now be updated.

@Anjian-Wen Anjian-Wen marked this pull request as ready for review June 11, 2025 09:16
@openjdk openjdk bot added the rfr Pull request is ready for review label Jun 11, 2025
@mlbridge
Copy link

mlbridge bot commented Jun 11, 2025

Webrevs

@Anjian-Wen
Copy link
Contributor Author

@robehn Hi, Can you help to review the patch?

@robehn
Copy link
Contributor

robehn commented Jun 11, 2025

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

@dchuyko
Copy link
Member

dchuyko commented Jun 11, 2025

@dchuyko can you open a new issue and look at the acquire in downcall linker for aarch64 ?

Thanks for the reminder, created JDK-8359252. It was intentional to limit the scope of the original change to JNI (due the amount of testing and usages).

@Anjian-Wen
Copy link
Contributor Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hotspot [email protected] rfr Pull request is ready for review
Development

Successfully merging this pull request may close these issues.

3 participants