Skip to content
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

8319244: implement JVMTI handshakes support for virtual threads #16460

Closed
wants to merge 11 commits into from

Conversation

sspitsyn
Copy link
Contributor

@sspitsyn sspitsyn commented Nov 1, 2023

The handshakes support for virtual threads is needed to simplify the JVMTI implementation for virtual threads. There is a significant duplication in the JVMTI code to differentiate code intended to support platform, virtual threads or both. The handshakes are unified, so it is enough to define just one handshake for both platform and virtual thread.
At the low level, the JVMTI code supporting platform and virtual threads still can be different.
This implementation is based on the JvmtiVTMSTransitionDisabler class.

The internal API includes two new classes:

  • JvmtiHandshake and JvmtiUnifiedHandshakeClosure

The JvmtiUnifiedHandshakeClosure defines two different callback functions: do_thread() and do_vthread().

The first JVMTI functions are picked first to be converted to use the JvmtiHandshake:

  • GetStackTrace, GetFrameCount, GetFrameLocation, NotifyFramePop

To get the test results clean, the update also fixes the test issue:
8318631: GetStackTraceSuspendedStressTest.java failed with "check_jvmti_status: JVMTI function returned error: JVMTI_ERROR_THREAD_NOT_ALIVE (15)"

Testing:

  • the mach5 tiers 1-6 are all passed

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-8319244: implement JVMTI handshakes support for virtual threads (Enhancement - P4)

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 16460

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

Using diff file

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

Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Nov 1, 2023

👋 Welcome back sspitsyn! 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 openjdk bot added the rfr Pull request is ready for review label Nov 1, 2023
@openjdk
Copy link

openjdk bot commented Nov 1, 2023

@sspitsyn The following labels will be automatically applied to this pull request:

  • hotspot
  • serviceability

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

@openjdk openjdk bot added serviceability serviceability-dev@openjdk.org hotspot hotspot-dev@openjdk.org labels Nov 1, 2023
@mlbridge
Copy link

mlbridge bot commented Nov 1, 2023

@sspitsyn
Copy link
Contributor Author

sspitsyn commented Nov 6, 2023

I've pushed an update which removes newly introduced VM_op and its use: VM_HandshakeUnmountedVirtualThread.
Patricio convinced me that it has to be handshake-safe to execute a HanshakeClosure callback on the current (handshake requesting) thread when target thread is an unmounted virtual threads. At an earlier development stage I saw various intermittent crashes and concluded it is not handshake-safe. It is why there was a decision to use the VM_HandshakeUnmountedVirtualThread. I do not see these crashes anymore after a full testing cycle.

Copy link
Contributor

@pchilano pchilano left a comment

Choose a reason for hiding this comment

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

Hi Serguei,


Looks good to me, nice code consolidation.

src/hotspot/share/prims/jvmtiEnvBase.cpp Show resolved Hide resolved
src/hotspot/share/prims/jvmtiEnvBase.cpp Outdated Show resolved Hide resolved
src/hotspot/share/prims/jvmtiEnvBase.hpp Outdated Show resolved Hide resolved
src/hotspot/share/prims/jvmtiEnvBase.cpp Show resolved Hide resolved
@sspitsyn
Copy link
Contributor Author

sspitsyn commented Nov 8, 2023

Hi Serguei,

Looks good to me, nice code consolidation.

Hi Patricio, thank you a lot for reviewing this!

@openjdk
Copy link

openjdk bot commented Nov 18, 2023

⚠️ @sspitsyn The .jcheck/conf in the target branch of this pull request is invalid. Until that is resolved, this pull request cannot be processed. Please notify the repository owner.

Copy link
Contributor

@pchilano pchilano left a comment

Choose a reason for hiding this comment

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

Thanks Serguei, changes look good to me.

@openjdk
Copy link

openjdk bot commented Nov 20, 2023

@sspitsyn This change now passes all automated pre-integration checks.

ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details.

After integration, the commit message for the final commit will be:

8319244: implement JVMTI handshakes support for virtual threads

Reviewed-by: pchilanomate, amenkov

You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed.

At the time when this comment was updated there had been 49 new commits pushed to the master branch:

  • fcb4df2: 8320192: SHAKE256 does not work correctly if n >= 137
  • 2b4e991: 8320208: Update Public Suffix List to b5bf572
  • 6b96bb6: 8319777: Zero: Support 8-byte cmpxchg
  • 020c900: 8320052: Zero: Use __atomic built-ins for atomic RMW operations
  • 30d8953: 8275889: Search dialog has redundant scrollbars
  • cee54de: 8319988: Wrong heading for inherited nested classes
  • 32098ce: 8320348: test/jdk/java/io/File/GetAbsolutePath.windowsDriveRelative fails if working directory is not on drive C
  • a2c0fa6: 8320372: test/jdk/sun/security/x509/DNSName/LeadingPeriod.java validity check failed
  • 3aefd1c: 8320234: Merge doclint.Env.AccessKind with tool.AccessKind
  • d6d7bdc: 8319817: Charset constructor should make defensive copy of aliases
  • ... and 39 more: https://git.openjdk.org/jdk/compare/faeea07fe5d27e0c18c26f99705cc552e5ab9bdc...master

As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details.

➡️ 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 Nov 20, 2023
@sspitsyn
Copy link
Contributor Author

Patricio and Alex, thank you a lot for review!

@sspitsyn
Copy link
Contributor Author

/integrate

@openjdk
Copy link

openjdk bot commented Nov 21, 2023

Going to push as commit 839dd65.
Since your change was applied there have been 53 commits pushed to the master branch:

Your commit was automatically rebased without conflicts.

@openjdk openjdk bot added the integrated Pull request has been integrated label Nov 21, 2023
@openjdk openjdk bot closed this Nov 21, 2023
@openjdk openjdk bot removed ready Pull request is ready to be integrated rfr Pull request is ready for review labels Nov 21, 2023
@openjdk
Copy link

openjdk bot commented Nov 21, 2023

@sspitsyn Pushed as commit 839dd65.

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

@sspitsyn sspitsyn deleted the b8 branch January 23, 2024 01:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hotspot hotspot-dev@openjdk.org integrated Pull request has been integrated serviceability serviceability-dev@openjdk.org
3 participants