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

8276205: Shenandoah: CodeCache_lock should always be held for initializing code cache iteration #6192

Closed

Conversation

zhengyu123
Copy link
Contributor

@zhengyu123 zhengyu123 commented Nov 1, 2021

There are few bugs in current implementation:

  1. No CodeCache_lock is held when initialize code cache iterator at safepoints. This is a problem for concurrent GC, since it can initialize a concurrent code cache iterator while holding CodeCache_lock without safepoint check.

  2. Does not notify waiters upon completion of iteration at safepoints

  3. Unnecessary held CodeCache_lock during concurrent code cache iteration.

Test:

  • hotspot_gc_shenandoah on Linux x86_64
  • hotspot_gc_shenandoah on Linux aarch64

Progress

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

Issue

  • JDK-8276205: Shenandoah: CodeCache_lock should always be held for initializing code cache iteration

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 6192

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

Using diff file

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

@bridgekeeper
Copy link

bridgekeeper bot commented Nov 1, 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 openjdk bot added the rfr Pull request is ready for review label Nov 1, 2021
@openjdk
Copy link

openjdk bot commented Nov 1, 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 hotspot-gc-dev@openjdk.org shenandoah shenandoah-dev@openjdk.org labels Nov 1, 2021
@mlbridge
Copy link

mlbridge bot commented Nov 1, 2021

Webrevs

Copy link
Member

@shipilev shipilev left a comment

Looks okay. Do we miss _codecache_snapshot = NULL; in ~ShenandoahConcurrentRootScanner?

@openjdk
Copy link

openjdk bot commented Nov 1, 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:

8276205: Shenandoah: CodeCache_lock should always be held for initializing code cache iteration

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

  • c8abe35: 8276121: G1: Remove unused and uninitialized _g1h in g1SATBMarkQueueSet.hpp
  • f55e68c: 8275950: Use only _thread_in_vm in ~ThreadBlockInVMPreprocess()
  • 4ac8403: 8276218: JFR: Clean up jdk.jfr.dcmd
  • 89ade1d: 8273416: C2: assert(false) failed: bad AD file after JDK-8252372 with UseSSE={0,1}
  • dbf5100: 8276201: Shenandoah: Race results degenerated GC to enter wrong entry point
  • 5bb1992: 8275868: ciReplay: Inlining fails with "unloaded signature classes" due to wrong protection domains
  • 158831e: 8274320: os::fork_and_exec() should be using posix_spawn
  • bf2e9ee: 8275080: G1CollectedHeap::expand() returns the wrong value
  • b7104ba: 8196017: java/awt/Mouse/GetMousePositionTest/GetMousePositionWithPopup.java fails
  • 6875678: 8273831: PrintServiceLookup spawns 2 threads in the current classloader, getting orphaned
  • ... and 101 more: https://git.openjdk.java.net/jdk/compare/af14650127de47058b958be411503584c0ba6323...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 1, 2021
@zhengyu123
Copy link
Contributor Author

zhengyu123 commented Nov 1, 2021

ShenandoahConcurrentRootScanner

Does it matter?

@shipilev
Copy link
Member

shipilev commented Nov 1, 2021

ShenandoahConcurrentRootScanner

Does it matter?

You tell me, I think it would be full of dangling references after we are done with scanner? The similar reason why we do _table = NULL in a similar method in another iterator. You don't have to change it here, but maybe a simple cleanup for later.

@zhengyu123
Copy link
Contributor Author

zhengyu123 commented Nov 1, 2021

ShenandoahConcurrentRootScanner

Does it matter?

You tell me, I think it would be full of dangling references after we are done with scanner? The similar reason why we do _table = NULL in a similar method in another iterator. You don't have to change it here, but maybe a simple cleanup for later.

Yea, there is inconsistent among these iterators. The code is in destructors, I don't see it matters, cause accessing dangling references in a deallocated object is a fatal bug.

@zhengyu123
Copy link
Contributor Author

zhengyu123 commented Nov 1, 2021

/integrate

@openjdk
Copy link

openjdk bot commented Nov 1, 2021

Going to push as commit 99b7b95.
Since your change was applied there have been 113 commits pushed to the master branch:

  • 9771544: 8260428: Drop support for pre JDK 1.4 DatagramSocketImpl implementations
  • e265f83: 8276107: Preventive collections trigger before maxing out heap
  • c8abe35: 8276121: G1: Remove unused and uninitialized _g1h in g1SATBMarkQueueSet.hpp
  • f55e68c: 8275950: Use only _thread_in_vm in ~ThreadBlockInVMPreprocess()
  • 4ac8403: 8276218: JFR: Clean up jdk.jfr.dcmd
  • 89ade1d: 8273416: C2: assert(false) failed: bad AD file after JDK-8252372 with UseSSE={0,1}
  • dbf5100: 8276201: Shenandoah: Race results degenerated GC to enter wrong entry point
  • 5bb1992: 8275868: ciReplay: Inlining fails with "unloaded signature classes" due to wrong protection domains
  • 158831e: 8274320: os::fork_and_exec() should be using posix_spawn
  • bf2e9ee: 8275080: G1CollectedHeap::expand() returns the wrong value
  • ... and 103 more: https://git.openjdk.java.net/jdk/compare/af14650127de47058b958be411503584c0ba6323...master

Your commit was automatically rebased without conflicts.

@openjdk openjdk bot closed this Nov 1, 2021
@openjdk openjdk bot added integrated Pull request has been integrated and removed ready Pull request is ready to be integrated rfr Pull request is ready for review labels Nov 1, 2021
@openjdk
Copy link

openjdk bot commented Nov 1, 2021

@zhengyu123 Pushed as commit 99b7b95.

💡 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 hotspot-gc-dev@openjdk.org integrated Pull request has been integrated shenandoah shenandoah-dev@openjdk.org
2 participants