-
Notifications
You must be signed in to change notification settings - Fork 6k
8272480: Remove Mutex::access rank #5256
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
Conversation
👋 Welcome back coleenp! A progress list of the required criteria for merging this PR into |
Webrevs
|
It turns out that ttyLock is held during stack walking for -XX:+PrintDeoptimizationDetails -XX:+UseZGC, so put the lock ranks back. Thanks @kimbarrett and @dholmes-ora |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One query below and some commentary on the problems of the tty lock, but in terms of removing the access rank and adding the SWM rank, these changes seem fine.
Thanks,
David
service = event + 3, | ||
stackwatermark = service + 3, | ||
tty = stackwatermark + 3, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So as we discussed on IM the tty lock is really a problem. The existing ranking means that you cannot use the tty when holding the Service_lock - and I'm very surprised that doesn't actually happen in our code. The tty really should be a leaf lock, but when we have sections of code that explicitly acquire it so that atomic logging output can be generated, then there is a risk of acquiring other locks while the tty lock is held. I'm not sure this can be solved as long as the tty lock is part of the ranking system.
Note this is just a comment as you haven't changed anything in that regard.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, the tty lock is in an unfortunate place in the hierarchy. The tty lock should not be held around the chunks of code it's held around. Or there should be a higher level lock that protects this logging and tty lock only protects the write. I don't know how to fix this right now.
Since changing to UL, we don't tty->print very much except in the compiler code so it's not surprising that nothing asserts for the Service_lock taking out tty lock.
@@ -320,7 +320,7 @@ void mutex_init() { | |||
def(JfrMsg_lock , PaddedMonitor, leaf, true, _safepoint_check_always); | |||
def(JfrBuffer_lock , PaddedMutex , leaf, true, _safepoint_check_never); | |||
def(JfrStream_lock , PaddedMutex , nonleaf + 1, false, _safepoint_check_never); | |||
def(JfrStacktrace_lock , PaddedMutex , tty-2, true, _safepoint_check_never); | |||
def(JfrStacktrace_lock , PaddedMutex , stackwatermark-1, true, _safepoint_check_never); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not clear why this one has to be less than the SWM rather than just remain less than tty?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The reason this was tty-2 was that I assume that this lock is taken when the stackwatermark lock is held, when stackwatermark was tty-1, and not when the tty lock is held, since it's not compiler code.
When I make it the same rank as stackwatermark I get:
failed: Attempting to acquire lock JfrStacktrace_lock/6 out of order with lock StackWatermark_lock/6 -- possible deadlock
So I conclude that's why that lock ordering should be stackwatermark-1
@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:
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 21 new commits pushed to the
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! Good cleanup.
Thanks @dholmes-ora and @fisk for the code reviews! |
Going to push as commit b92214a.
Your commit was automatically rebased without conflicts. |
This change removes the 'access' rank since the last oop access lock has been removed (Shared_DirtyCardQ_lock). It might make sense to have a very low level access lock for oops but it should be added along with locks that might be introduced at that time, so that the rank is in the right place.
With this I moved tty back down in the rank hierarchy and added stackwatermark ranks. The latter is above tty, not below, and other locks like Service_lock are taken while holding the stackwatermark lock. There's one tty-1 ranked lock that is actually taken while the tty lock is held.
I moved MonitorDeflation_lock back to special rank because its low level was just copied from Service_lock, but that's not needed.
With this I removed most of the out-of-date comment above the rank enum. New comment to follow in future RFE.
Tested with tier1-6.
Progress
Issue
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.java.net/jdk pull/5256/head:pull/5256
$ git checkout pull/5256
Update a local copy of the PR:
$ git checkout pull/5256
$ git pull https://git.openjdk.java.net/jdk pull/5256/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 5256
View PR using the GUI difftool:
$ git pr show -t 5256
Using diff file
Download this PR as a diff file:
https://git.openjdk.java.net/jdk/pull/5256.diff