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

8276801: gc/stress/CriticalNativeStress.java fails intermittently with Shenandoah #6316

Closed
wants to merge 7 commits into from

Conversation

zhengyu123
Copy link
Contributor

@zhengyu123 zhengyu123 commented Nov 9, 2021

JDK-8276205 fixed a bug that prevents concurrent code cache iteration, without holding CodeCache_lock. That causes register_nmethod() calls can go through during concurrent code cache iteration.

This is no a problem for new nmethod, cause it is not in cache cache snapshot for concurrent code cache iteration, but nmethod patching is. We can not allow nmethod patching during concurrent code cache iteration, should block it until iteration is completed.

Test:

  • hotspot_gc_shenandoah
  • Stress test on gc/stress/CriticalNativeStress.java

Progress

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

Issue

  • JDK-8276801: gc/stress/CriticalNativeStress.java fails intermittently with Shenandoah

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.java.net/jdk pull/6316/head:pull/6316
$ git checkout pull/6316

Update a local copy of the PR:
$ git checkout pull/6316
$ git pull https://git.openjdk.java.net/jdk pull/6316/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 6316

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

Using diff file

Download this PR as a diff file:
https://git.openjdk.java.net/jdk/pull/6316.diff

@bridgekeeper
Copy link

@bridgekeeper bridgekeeper bot commented Nov 9, 2021

👋 Welcome back zgu! 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 openjdk bot commented Nov 9, 2021

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

  • hotspot-gc
  • shenandoah

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 hotspot-gc shenandoah labels Nov 9, 2021
@zhengyu123 zhengyu123 marked this pull request as ready for review Nov 9, 2021
@openjdk openjdk bot added the rfr label Nov 9, 2021
@mlbridge
Copy link

@mlbridge mlbridge bot commented Nov 9, 2021

Webrevs

data->update();
} else {
// For a new nmethod, we can safely append it to the list, cause
Copy link
Contributor

@shipilev shipilev Nov 9, 2021

Choose a reason for hiding this comment

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

Suggested change
// For a new nmethod, we can safely append it to the list, cause
// For a new nmethod, we can safely append it to the list, because

Copy link
Contributor Author

@zhengyu123 zhengyu123 Nov 9, 2021

Choose a reason for hiding this comment

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

Fixed

src/hotspot/share/gc/shenandoah/shenandoahCodeRoots.cpp Outdated Show resolved Hide resolved
Copy link
Contributor

@shipilev shipilev left a comment

I still do not understand about ShenandoahCodeRoots::unregister_nmethod here. You seem to have restored the assert in the nmethod-table (0248f1e), but surely the assert ShenandoahCodeRoots::unregister_nmethod can also be called at safepoint without CodeCache_lock held?

@zhengyu123
Copy link
Contributor Author

@zhengyu123 zhengyu123 commented Nov 10, 2021

I still do not understand about ShenandoahCodeRoots::unregister_nmethod here. You seem to have restored the assert in the nmethod-table (0248f1e), but surely the assert ShenandoahCodeRoots::unregister_nmethod can also be called at safepoint without CodeCache_lock held?

It seems possible during STW unloading

I will take a further look in separate CR see if we can cleanup a bit.

@shipilev
Copy link
Contributor

@shipilev shipilev commented Nov 10, 2021

I still do not understand about ShenandoahCodeRoots::unregister_nmethod here. You seem to have restored the assert in the nmethod-table (0248f1e), but surely the assert ShenandoahCodeRoots::unregister_nmethod can also be called at safepoint without CodeCache_lock held?

It seems possible during STW unloading

I will take a further look in separate CR see if we can cleanup a bit.

Why further CR, though? I think current code is guaranteed to fail that new assert during STW unloading? If so, we need to keep assert_locked_or_safepoint intact.

@zhengyu123
Copy link
Contributor Author

@zhengyu123 zhengyu123 commented Nov 10, 2021

I still do not understand about ShenandoahCodeRoots::unregister_nmethod here. You seem to have restored the assert in the nmethod-table (0248f1e), but surely the assert ShenandoahCodeRoots::unregister_nmethod can also be called at safepoint without CodeCache_lock held?

It seems possible during STW unloading
I will take a further look in separate CR see if we can cleanup a bit.

Why further CR, though? I think current code is guaranteed to fail that new assert during STW unloading? If so, we need to keep assert_locked_or_safepoint intact.

Oops, misread you comments. Previous reversion of the assertion was incomplete. Updated.

Copy link
Contributor

@shipilev shipilev left a comment

Looks fine.

@openjdk
Copy link

@openjdk openjdk bot commented Nov 10, 2021

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

8276801: gc/stress/CriticalNativeStress.java fails intermittently with Shenandoah

Reviewed-by: shade

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

  • ce3ed65: 8273154: Provide a JavadocTester method for non-overlapping, unordered output matching
  • f561d3c: 8276864: Update boot JDKs to 17.0.1 in GHA
  • 38ec3a1: 8276672: Cannot build hsdis on WSL
  • 55b36c6: 8276825: hotspot/runtime/SelectionResolution test errors
  • 0f23c6a: 8276926: Use String.valueOf() when initializing File.separator and File.pathSeparator
  • a0b8445: 8276846: JDK-8273416 is incomplete for UseSSE=1
  • a3f710e: 8276215: Intrinsics matchers should handle native method flags better
  • 0f463a7: 8276845: (fs) java/nio/file/spi/SetDefaultProvider.java fails on x86_32
  • e01d6d0: 8276679: Malformed Javadoc inline tags in JDK source in javax/swing
  • fd0a25e: 8276805: java/awt/print/PrinterJob/CheckPrivilege.java fails due to disabled SecurityManager
  • ... and 36 more: https://git.openjdk.java.net/jdk/compare/ff6863c98dbd15c4f3920402eb0991727d1a380c...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 label Nov 10, 2021
@zhengyu123
Copy link
Contributor Author

@zhengyu123 zhengyu123 commented Nov 11, 2021

/integrate

@openjdk
Copy link

@openjdk openjdk bot commented Nov 11, 2021

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

  • bce35ac: 8276775: ZonedDateTime/OffsetDateTime.toString return invalid ISO-8601 for years <= 1893
  • 0c409ca: 8276186: Require getAvailableLocales() methods to include Locale.ROOT
  • df02daa: 8269986: Remove +3 from Symbol::identity_hash()
  • 2374abd: 8276678: Malformed Javadoc inline tags in JDK source in com/sun/beans/decoder/DocumentHandler.java
  • 67c2714: 8276889: Improve compatibility discussion in instanceKlass.cpp
  • a5c160c: 8267108: Alternate Subject.getSubject and doAs APIs that do not depend on Security Manager APIs
  • ce3ed65: 8273154: Provide a JavadocTester method for non-overlapping, unordered output matching
  • f561d3c: 8276864: Update boot JDKs to 17.0.1 in GHA
  • 38ec3a1: 8276672: Cannot build hsdis on WSL
  • 55b36c6: 8276825: hotspot/runtime/SelectionResolution test errors
  • ... and 42 more: https://git.openjdk.java.net/jdk/compare/ff6863c98dbd15c4f3920402eb0991727d1a380c...master

Your commit was automatically rebased without conflicts.

@openjdk openjdk bot closed this Nov 11, 2021
@openjdk openjdk bot added integrated and removed ready rfr labels Nov 11, 2021
@openjdk
Copy link

@openjdk openjdk bot commented Nov 11, 2021

@zhengyu123 Pushed as commit 73e6d7d.

💡 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
hotspot-gc integrated shenandoah
2 participants