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
8223312: Utilize handshakes instead of is_thread_fully_suspended #729
8223312: Utilize handshakes instead of is_thread_fully_suspended #729
Conversation
👋 Welcome back rehn! A progress list of the required criteria for merging this PR into |
223c6f9
to
7e77a04
Compare
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.
Hi Robbin,
IIUC the "waiting" part of wait_for_ext_suspend_completion
is now implicitly handled in the handshake - correct?
Overall this seems like a great simplification.
A few minor comments below.
Thanks,
David
@robehn 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 2 new commits pushed to the
Please see this link for an up-to-date comparison between the source branch of this pull request and the ➡️ To integrate this PR with the above commit message to the |
Mailing list message from David Holmes on serviceability-dev: On 20/10/2020 4:18 pm, Robbin Ehn wrote:
Go for it! :) Davids |
Hi David, thanks for having a look.
A suspended Java thread may never transition back to java, never execute any more bytecodes. So the answer is we wait until we are allowed to execute those operations (thread handshake safe), which is not identical with fully suspended. But fully suspended is an implementation detail, the agent only knows about suspended.
|
Mailing list message from David Holmes on serviceability-dev: On 20/10/2020 5:20 pm, Robbin Ehn wrote:
Not clear to me this is so generic that it applies to Handshake::execute David |
We only have two other cases (other than JVM TI where we always do this).
And biased locking revoke where we don't do this, because it makes no sense revoking a lock if you have the bias :) |
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.
Still looks good.
Hi, this is a good change, because it is a simplification and it it makes the stack walks safe by doing them as part of a handshake. The change conflicts with #119 though. This one is ready to be pushed since last week but was delayed due to other interferences. Would you mind me integrating #119 first? After integration it would be needed to pull 2 EscapeBarriers out of handshakes. Of course I would help do that. Thanks, Richard. |
Hey Richard, go ahead and integrate your 119 first, I'll hold off and do the merge once you integrated. |
Thanks Robbin! |
…hread_fully_suspended
Hi Robbin, for merging master after integration of #119 I'd suggest to resolve the I successfully tested
which also covers PopFrame and ForceEarlyReturn. More tests are running. For night tests of our team it is unfortunately too late. Thanks, Richard. |
Thanks, I'm exploring what we need to execute the EB inside the handshake.
|
I want to experiment with object reallocation without referencing a frame. I think a should be possible to reallocate objects given only the corresponding compiled pc. If so, then a handshake/vm operation can fail with the request to reallocate objects at a pc. This can be done concurrently and then the handshake/vm operation can be restarted. |
I pushed the merge. (I manage to pick up bad state in first merge, so I did a second merge to get the fixes for that) Still running test, but there were some interest in this change-set (it seem to fix an unrelated bug also) so I published it. |
No issues in testing. There is a bug fix which goes on top of this which people want to push. If specially @reinrich can just look at the merge at least it would be good. |
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 change is good.
I've only added a few comments (nothing important really).
Thanks, also for giving precedence to me ;)
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.
I don't think I have any "must fix" comments here.
I'm going to assume that my confusion about why there
is code from @reinrich's EscapeBarrier work here is
because of the merging of conflicts...
That's correct. #119 got integrated and this pr needs to resolve a few locations because it moves code that has EscapeBarriers into handshakes. EBs cannot be executed in a handshake as they can safepoint doing heap allocations so they are moved before the handshake. |
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.
Incremental updates seem fine to me.
@robehn this pull request can not be integrated into git checkout 8223312-Utilize-handshakes-instead-of-is_thread_fully_suspended
git fetch https://git.openjdk.java.net/jdk master
git merge FETCH_HEAD
# resolve conflicts and follow the instructions given by git merge
git commit -m "Merge master"
git push |
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.
Just wondering why the escape barrier for force early return uses a stack depth is 0. Either that is wrong, or the escape barrier is not needed in the first place here. I think.
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. Awesome fix IMO.
Passes my local testing: open/test/jdk/com/sun/jdi/EATests.java, nsk_jvmti, nsk_jdi, jdk_jdi, jck:vm. I will be integrating later today, so the ZGC/EscapeBarrier issue can be resolved (which is semi-dependent on this). Thanks @dholmes-ora, @dcubed-ojdk, @reinrich, @fisk ! |
T1-5 looked good. /integrate |
@robehn Since your change was applied there have been 2 commits pushed to the
Your commit was automatically rebased without conflicts. Pushed as commit 4634dbe. 💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored. |
The main point of this change-set is to make it easier to implement S/R on top of handshakes.
Which is a prerequisite for removing _suspend_flag (which duplicates the handshake functionality).
But we also remove some complicated S/R methods.
We basically just put in everything in the handshake closure, so the diff just looks much worse than what it is.
TraceSuspendDebugBits have an ifdef, but in both cases it now just returns.
But I was unsure if I should remove now or when is_ext_suspend_completed() is removed.
Passes multiple t1-5 runs, locally it passes many jck:vm/nsk_jvmti/nsk_jdi/jdk-jdi runs.
Progress
Testing
Failed test task
Issue
Reviewers
Download
$ git fetch https://git.openjdk.java.net/jdk pull/729/head:pull/729
$ git checkout pull/729