Skip to content

8253241: Update comment on java_suspend_self_with_safepoint_check() #225

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

Closed
wants to merge 2 commits into from
Closed

8253241: Update comment on java_suspend_self_with_safepoint_check() #225

wants to merge 2 commits into from

Conversation

reinrich
Copy link
Member

@reinrich reinrich commented Sep 17, 2020

After JDK-8252414 the safepoint/handshake code does not take _suspend_flags into accout anymore in its assessment if a thread is safepoint/handshake safe. This change updates the comment on JavaThread::java_suspend_self_with_safepoint_check().

I have (not yet) fixed the line breaks (fill-paragraph in emacs lingo) for a clearer diff.

Also I could inline the (*) footnote.


Progress

  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue
  • Change must be properly reviewed

Issue

  • JDK-8253241: Update comment on java_suspend_self_with_safepoint_check()

Reviewers

Download

$ git fetch https://git.openjdk.java.net/jdk pull/225/head:pull/225
$ git checkout pull/225

@bridgekeeper
Copy link

bridgekeeper bot commented Sep 17, 2020

👋 Welcome back rrich! 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 Sep 17, 2020

@reinrich The following label will be automatically applied to this pull request: hotspot-runtime.

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 (add|remove) "label" command.

@openjdk openjdk bot added the hotspot-runtime hotspot-runtime-dev@openjdk.org label Sep 17, 2020
@reinrich reinrich marked this pull request as ready for review September 17, 2020 14:01
@openjdk openjdk bot added the rfr Pull request is ready for review label Sep 17, 2020
@mlbridge
Copy link

mlbridge bot commented Sep 17, 2020

Webrevs

Copy link
Member

@dcubed-ojdk dcubed-ojdk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The updated wording in the comment looks good to me.

I still get a headache when thinking about the associated
suspend/resume races, but that's my problem and not yours.

@openjdk
Copy link

openjdk bot commented Sep 18, 2020

@reinrich This change now passes all automated pre-integration checks. In addition to the automated checks, the change must also fulfill all project specific requirements

After integration, the commit message will be:

8253241: Update comment on java_suspend_self_with_safepoint_check()

Reviewed-by: dcubed, dholmes
  • If you would like to add a summary, use the /summary command.
  • To credit additional contributors, use the /contributor command.
  • To add additional solved issues, use the /issue command.

Since the source branch of this PR was last updated there have been 79 commits pushed to the master branch:

  • bd67975: 8253349: Remove unimplemented SharedRuntime::native_method_throw_unsupported_operation_exception_entry
  • bddb822: 8253240: No javadoc for DecimalFormatSymbols.hashCode()
  • c68a31d: 8253499: Problem list runtime/cds/DeterministicDump.java
  • 93a2018: 8252195: AWT Accessibility API nested classes rely on default constructors
  • 426c904: 8253392: remove PhaseCCP_DCE declaration
  • 65af837: 8253496: [BACKOUT] JDK-8253208 Move CDS related code to a separate class
  • 581f0f2: 8253493: Shenandoah: Remove ShenandoahSerialRoot definition
  • 7b86012: 8253492: Miss comma after second copyright year in FDBigInteger.java
  • 0f26ab1: 8252518: cache result of CompilerToVM.getComponentType
  • c1df13b: 8253208: Move CDS related code to a separate class
  • ... and 69 more: https://git.openjdk.java.net/jdk/compare/ce93cbce77e1f4baa52676826c8ae27d474360b6...master

As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid automatic rebasing, please merge master into your branch, and then specify the current head hash when integrating, like this: /integrate bd6797543f6812d0b1cc5d45d40aec82674040e8.

➡️ To integrate this PR with the above commit message to the master branch, type /integrate in a new comment.

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Sep 18, 2020
@dcubed-ojdk
Copy link
Member

Please wait for @dholmes-ora to review this change.

@reinrich
Copy link
Member Author

The updated wording in the comment looks good to me.

Thanks for looking over it.

I still get a headache when thinking about the associated
suspend/resume races, but that's my problem and not yours.

I'd think the suspend/resume implementation could be simplified if the suspender would always direct handshake the suspendee. JavaThread::is_ext_suspend_completed() could be removed then. Likewise the suspend equivalent optimization. And I would not expect an impact on performance by doing it.

@reinrich
Copy link
Member Author

Please wait for @dholmes-ora to review this change.

Sure.

// The correct thread state of a suspended thread is _thread_blocked. With that state
// safepoint/handshake code will count it as safepoint/handshake safe. Also it allows
// another thread to continue if it is waiting in is_ext_suspend_completed() for this
// thread to change state from _thread_in_native_trans to the target state.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The revised wording doesn't really convey the situation to me. We have to set the thread-state to _thread_blocked so that a thread waiting in _is_ext_suspend_completed can proceed (there is no generic "target" state - it must be _thread_blocked). I would simplify and rephrase as follows:

"We have to set the thread state directly to _thread_blocked so that it will be seen to be safepoint/handshake safe whilst suspended. This is also necessary to allow a thread in is_ext_suspend_completed, that observed the _thread_in_native_trans state, to proceed."

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, I will use your version.

Copy link
Member

@dholmes-ora dholmes-ora left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! :) Thanks

@reinrich
Copy link
Member Author

Thanks :)
I'll integrate this after another 24h.

@reinrich
Copy link
Member Author

/integrate

@openjdk openjdk bot closed this Sep 23, 2020
@openjdk openjdk bot added integrated Pull request has been integrated and removed ready Pull request is ready to be integrated labels Sep 23, 2020
@openjdk
Copy link

openjdk bot commented Sep 23, 2020

@reinrich Since your change was applied there have been 79 commits pushed to the master branch:

  • bd67975: 8253349: Remove unimplemented SharedRuntime::native_method_throw_unsupported_operation_exception_entry
  • bddb822: 8253240: No javadoc for DecimalFormatSymbols.hashCode()
  • c68a31d: 8253499: Problem list runtime/cds/DeterministicDump.java
  • 93a2018: 8252195: AWT Accessibility API nested classes rely on default constructors
  • 426c904: 8253392: remove PhaseCCP_DCE declaration
  • 65af837: 8253496: [BACKOUT] JDK-8253208 Move CDS related code to a separate class
  • 581f0f2: 8253493: Shenandoah: Remove ShenandoahSerialRoot definition
  • 7b86012: 8253492: Miss comma after second copyright year in FDBigInteger.java
  • 0f26ab1: 8252518: cache result of CompilerToVM.getComponentType
  • c1df13b: 8253208: Move CDS related code to a separate class
  • ... and 69 more: https://git.openjdk.java.net/jdk/compare/ce93cbce77e1f4baa52676826c8ae27d474360b6...master

Your commit was automatically rebased without conflicts.

Pushed as commit 226faa5.

💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored.

@openjdk openjdk bot removed the rfr Pull request is ready for review label Sep 23, 2020
@reinrich reinrich deleted the JDK-8253241 branch September 23, 2020 07:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hotspot-runtime hotspot-runtime-dev@openjdk.org integrated Pull request has been integrated
Development

Successfully merging this pull request may close these issues.

3 participants