Skip to content

Conversation

@tkrodriguez
Copy link
Contributor

@tkrodriguez tkrodriguez commented Feb 4, 2025

This ensures that collectFailedSpeculations sees the initialization of the recently allocated failedSpeculationsAddress memory.


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-8349374: [JVMCI] concurrent use of HotSpotSpeculationLog can crash (Bug - P4)

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 23444

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

Using diff file

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

Using Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Feb 4, 2025

👋 Welcome back never! 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 Feb 4, 2025

@tkrodriguez 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:

8349374: [JVMCI] concurrent use of HotSpotSpeculationLog can crash

Reviewed-by: kvn, dnsimon

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 17 new commits pushed to the master branch:

  • 379c3f9: 8347836: Disabled PopupMenu shows shortcuts on Mac
  • 82bc0a7: 8344316: security/auth/callback/TextCallbackHandler/Password.java make runnable with JTReg and add the UI
  • 2f2f7cf: 8349084: Update vectors used in several PQC benchmarks
  • b9b62a0: 8346792: serviceability/jvmti/vthread/GetThreadState/GetThreadState.java testObjectWaitMillis failed
  • 6b994cd: 8333697: C2: Hit MemLimit in PhaseCFG::global_code_motion
  • 2ff8440: 8349344: Clarify documentation of Arena.ofConfined
  • 19399d2: 8348572: C2 compilation asserts due to unexpected irreducible loop
  • 6146588: 8348190: Framework for tracing makefile inclusion and parsing
  • 66a3898: 8348659: AArch64: IR rule failure with compiler/loopopts/superword/TestSplitPacks.java
  • 40603a5: 8349214: Improve size optimization flags for MSVC builds
  • ... and 7 more: https://git.openjdk.org/jdk/compare/b985347c2383a7a637ffa9a4a8687f7f7cde1369...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 rfr Pull request is ready for review label Feb 4, 2025
@openjdk
Copy link

openjdk bot commented Feb 4, 2025

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

  • graal
  • hotspot-compiler

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 graal graal-dev@openjdk.org hotspot-compiler hotspot-compiler-dev@openjdk.org labels Feb 4, 2025
@mlbridge
Copy link

mlbridge bot commented Feb 4, 2025

Webrevs

return;
}

if (UnsafeAccess.UNSAFE.getLong(getFailedSpeculationsAddress()) != 0) {
Copy link
Member

@dougxc dougxc Feb 4, 2025

Choose a reason for hiding this comment

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

It's still possible for getFailedSpeculationsAddress() to return 0 (i.e. when managesFailedSpeculations is false). So I think this should be:

diff --git a/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/hotspot/HotSpotSpeculationLog.java b/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/hotspot/HotSpotSpeculationLog.java
index fd46e281c3b..a861c00d77d 100644
--- a/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/hotspot/HotSpotSpeculationLog.java
+++ b/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/hotspot/HotSpotSpeculationLog.java
@@ -171,8 +171,9 @@ public String toString() {

     @Override
     public void collectFailedSpeculations() {
-        if (failedSpeculationsAddress != 0 && UnsafeAccess.UNSAFE.getLong(failedSpeculationsAddress) != 0) {
-            failedSpeculations = compilerToVM().getFailedSpeculations(failedSpeculationsAddress, failedSpeculations);
+        long address = getFailedSpeculationsAddress();
+        if (address != 0 && UnsafeAccess.UNSAFE.getLong(address) != 0) {
+            failedSpeculations = compilerToVM().getFailedSpeculations(address, failedSpeculations);
             assert failedSpeculations.getClass() == byte[][].class;
         }
     }

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm filtering out 0 above this line and getFailedSpeculationsAddress() can't return 0 if failedSpeculationsAddress is already non-zero.

failedSpeculationsAddress also can't be 0 if managesFailedSpeculations is false since we throw IllegalArgumentException in that case.

Copy link
Member

Choose a reason for hiding this comment

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

failedSpeculationsAddress also can't be 0 if managesFailedSpeculations is false since we throw IllegalArgumentException in that case.

Ok, I'd forgotten about that invariant. Might be worth reminding the reader of it with a comment in collectFailedSpeculations.

Copy link
Contributor Author

@tkrodriguez tkrodriguez Feb 4, 2025

Choose a reason for hiding this comment

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

I've updated the javadoc for getFailedSpeculationsAddress to specify that it always returns non-zero. I also expanded the comments in collectFailedSpeculations and call getFailedSpeculationsAddress() to get the value. I think it's clearer what's going on now.

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Feb 4, 2025
@openjdk openjdk bot removed the ready Pull request is ready to be integrated label Feb 4, 2025
Copy link
Contributor

@vnkozlov vnkozlov left a comment

Choose a reason for hiding this comment

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

Seems fine.

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Feb 5, 2025
@tkrodriguez
Copy link
Contributor Author

Thanks!

/integrate

@openjdk
Copy link

openjdk bot commented Feb 7, 2025

Going to push as commit 7f6c687.
Since your change was applied there have been 52 commits pushed to the master branch:

  • bd9b24c: 8349512: Duplicate PermittedSubclasses entries with doclint enabled
  • b40f8ee: 8337251: C1: Improve Class.isInstance intrinsic
  • 88a8483: 8349121: SSLParameters.setApplicationProtocols() ALPN example could be clarified
  • fb847bb: 8349493: Replace sun.util.locale.ParseStatus usage with java.text.ParsePosition
  • 7cd5cb2: 8349532: Refactor ./util/Pem/encoding.sh to run in java
  • 86cec4e: 8343782: G1: Use one G1CardSet instance for multiple old gen regions
  • 006ed5c: 8349375: Cleanup AIX special file build settings
  • 3989a19: 8344925: translet-name ignored when package-name is also set
  • 1eb54e4: 8346049: jdk/test/lib/security/timestamp/TsaServer.java warnings
  • a0c7f66: 8349508: runtime/cds/appcds/TestParallelGCWithCDS.java should not check for specific output
  • ... and 42 more: https://git.openjdk.org/jdk/compare/b985347c2383a7a637ffa9a4a8687f7f7cde1369...master

Your commit was automatically rebased without conflicts.

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

openjdk bot commented Feb 7, 2025

@tkrodriguez Pushed as commit 7f6c687.

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

graal graal-dev@openjdk.org hotspot-compiler hotspot-compiler-dev@openjdk.org integrated Pull request has been integrated

Development

Successfully merging this pull request may close these issues.

3 participants