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

8274004: Change 'nonleaf' rank name #5845

Closed
wants to merge 3 commits into from
Closed

Conversation

coleenp
Copy link
Contributor

@coleenp coleenp commented Oct 6, 2021

Also fixes: 8273956: Add checking for rank values

This change does 3 things. I could separate them but this has all been tested together and most of the change is mechanical. The first is a simple rename of nonleaf => safepoint. The second change is to add the enum class Rank which only allows subtraction from a base rank, and some additional type checking so that rank arithmetic doesn't overlap with a different rank. Ie if you say nosafepoint-n, that doesn't overlap with oopstorage. The third change is to remove the _safepoint_check_always/never flag. That is now intrinsic in the ranking, as all nosafepoint ranks are lower than all safepoint ranks.

Future changes could add rank names in the middle of nosafepoint and safepoint, like handshake. As of now, the rank subtractions are not unmanageable. There are actually not many nested Mutex.

This is the last of the planned subtasks for Mutex ranking cleanup. If you have other ideas or suggestions, please let me know.

Tested with tier1-8 at one point in time and just retested with tier1-6.


Progress

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

Issues

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 5845

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

Using diff file

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

8273956: Add checking for rank values
@bridgekeeper
Copy link

bridgekeeper bot commented Oct 6, 2021

👋 Welcome back coleenp! 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 Oct 6, 2021
@openjdk
Copy link

openjdk bot commented Oct 6, 2021

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

  • hotspot
  • serviceability
  • 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 serviceability serviceability-dev@openjdk.org hotspot hotspot-dev@openjdk.org shenandoah shenandoah-dev@openjdk.org labels Oct 6, 2021
@mlbridge
Copy link

mlbridge bot commented Oct 6, 2021

Webrevs

@dcubed-ojdk
Copy link
Member

The PR description mentions:
8273956: Add checking for rank values
but the PR synopsis is:
8274004: Change 'nonleaf' rank name

@mlbridge
Copy link

mlbridge bot commented Oct 6, 2021

Mailing list message from coleen.phillimore at oracle.com on hotspot-dev:

On 10/6/21 7:45 PM, Daniel D.Daugherty wrote:

On Wed, 6 Oct 2021 23:27:17 GMT, Coleen Phillimore <coleenp at openjdk.org> wrote:

8273956: Add checking for rank values

This change does 3 things. I could separate them but this has all been tested together and most of the change is mechanical. The first is a simple rename of nonleaf => safepoint. The second change is to add the enum class Rank which only allows subtraction from a base rank, and some additional type checking so that rank arithmetic doesn't overlap with a different rank. Ie if you say nosafepoint-n, that doesn't overlap with oopstorage. The third change is to remove the _safepoint_check_always/never flag. That is now intrinsic in the ranking, as all nosafepoint ranks are lower than all safepoint ranks.

Future changes could add rank names in the middle of nosafepoint and safepoint, like handshake. As of now, the rank subtractions isn't unmanageable. There are actually not many nested Mutex.

This is the last of the planned subtasks for Mutex ranking cleanup. If you have other ideas or suggestions, please let me know.

Tested with tier1-8 at one point in time and just retested with tier1-6.
The PR description mentions:
`8273956: Add checking for rank values`
but the PR synopsis is:
`8274004: Change 'nonleaf' rank name`

It's actually both.? But I should close the 8273956 as a duplicate of
the first and remove that line in the description.
thanks,
Coleen

@dcubed-ojdk
Copy link
Member

dcubed-ojdk commented Oct 6, 2021

Just do

/issue JDK-8274004
/issue JDK-8273956

and this PR will cover both.

@openjdk
Copy link

openjdk bot commented Oct 6, 2021

@dcubed-ojdk Only the author (@coleenp) is allowed to issue the /issue command.

@openjdk
Copy link

openjdk bot commented Oct 6, 2021

@dcubed-ojdk Only the author (@coleenp) is allowed to issue the /issue command.

@coleenp
Copy link
Contributor Author

coleenp commented Oct 7, 2021

/issue JDK-8274004
/issue JDK-8273956

Thank you @dcubed-ojdk!

@openjdk
Copy link

openjdk bot commented Oct 7, 2021

@coleenp This issue is referenced in the PR title - it will now be updated.

@openjdk
Copy link

openjdk bot commented Oct 7, 2021

@coleenp
Adding additional issue to issue list: 8273956: Add checking for rank values.

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.

Hi Coleen,

Overall this looks good! But shouldn't the test:

test/hotspot/gtest/runtime/test_safepoint_locks.cpp

be replaced by one that checks we lock with/without a safepoint check for a safepoint/nonsafepoint lock respectively? (Or does that test already exist elsewhere?).

Also should there not be a gtest to verify your Rank overlap checking?

Thanks,
David

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.

LGTM!

Thanks,
Patricio

@coleenp
Copy link
Contributor Author

coleenp commented Oct 7, 2021

Thanks for the review @pchilano and offline discussion about check_for_overlap.

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.

Hi Coleen,

A couple of comments on tests, but otherwise okay.

Thanks,
David

Comment on lines 291 to 292
monitor_rank_broken->lock_without_safepoint_check();
monitor_rank_broken->unlock();
Copy link
Member

Choose a reason for hiding this comment

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

This is dead code right - the assertion failure will stop us getting here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, it is dead code. I'll remove it and retest to make sure nothing surprising happens.

Comment on lines 301 to 302
monitor_rank_broken->lock_without_safepoint_check();
monitor_rank_broken->unlock();
Copy link
Member

Choose a reason for hiding this comment

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

Ditto - dead code

Copy link
Contributor Author

Choose a reason for hiding this comment

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

removed.

JavaThread* THREAD = JavaThread::current();
ThreadInVMfromNative invm(THREAD);

Monitor* monitor_rank_broken = new Monitor(Mutex::safepoint-1, "monitor_rank_broken");
Copy link
Member

Choose a reason for hiding this comment

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

This rank is not actually broken is it - otherwise we won't get to the next line.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

right. It's not broken. I'll rename it to 'monitor_rank_ok'.

Comment on lines 312 to 313
monitor_rank_also_broken->lock_without_safepoint_check();
monitor_rank_also_broken->unlock();
Copy link
Member

Choose a reason for hiding this comment

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

Dead code

Copy link
Contributor Author

Choose a reason for hiding this comment

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

removed.

@openjdk
Copy link

openjdk bot commented Oct 8, 2021

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

8274004: Change 'nonleaf' rank name
8273956: Add checking for rank values

Reviewed-by: dholmes, pchilanomate

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

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 Oct 8, 2021
Copy link
Contributor Author

@coleenp coleenp left a comment

Choose a reason for hiding this comment

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

I removed the dead test code and retested.

Comment on lines 291 to 292
monitor_rank_broken->lock_without_safepoint_check();
monitor_rank_broken->unlock();
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, it is dead code. I'll remove it and retest to make sure nothing surprising happens.

Comment on lines 301 to 302
monitor_rank_broken->lock_without_safepoint_check();
monitor_rank_broken->unlock();
Copy link
Contributor Author

Choose a reason for hiding this comment

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

removed.

JavaThread* THREAD = JavaThread::current();
ThreadInVMfromNative invm(THREAD);

Monitor* monitor_rank_broken = new Monitor(Mutex::safepoint-1, "monitor_rank_broken");
Copy link
Contributor Author

Choose a reason for hiding this comment

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

right. It's not broken. I'll rename it to 'monitor_rank_ok'.

Comment on lines 312 to 313
monitor_rank_also_broken->lock_without_safepoint_check();
monitor_rank_also_broken->unlock();
Copy link
Contributor Author

Choose a reason for hiding this comment

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

removed.

@coleenp
Copy link
Contributor Author

coleenp commented Oct 8, 2021

Thanks for the code review David, and all the discussions leading to this change.

@coleenp
Copy link
Contributor Author

coleenp commented Oct 8, 2021

/integrate

@openjdk
Copy link

openjdk bot commented Oct 8, 2021

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

Your commit was automatically rebased without conflicts.

@openjdk openjdk bot closed this Oct 8, 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 Oct 8, 2021
@openjdk
Copy link

openjdk bot commented Oct 8, 2021

@coleenp Pushed as commit 6364719.

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

@coleenp coleenp deleted the rank branch October 8, 2021 12:23
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 shenandoah shenandoah-dev@openjdk.org
4 participants