8378985: serviceability/sa/TestJhsdbJstackMixedWithXComp.java failed if sender frame is return barrier of Continuation#30107
8378985: serviceability/sa/TestJhsdbJstackMixedWithXComp.java failed if sender frame is return barrier of Continuation#30107YaSuenag wants to merge 10 commits intoopenjdk:masterfrom
Conversation
|
👋 Welcome back ysuenaga! A progress list of the required criteria for merging this PR into |
|
@YaSuenag 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 271 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 |
|
@YaSuenag The following labels will be automatically applied to this pull request:
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. |
Webrevs
|
|
Could someone can help for testing on RISC-V and PPC64? This PR includes changes for them. It affects serviceability/sa tests especially TestJhsdbJstackWithVirtualThread.java. I tested both AMD64 and AArch64 Linux, but I cannot test RISC-V and PPC64 because I do not have them. |
plummercj
left a comment
There was a problem hiding this comment.
Overall this looks good and passes my testing. I can only test that it builds on riscv64. I can't run tests on that platform, and can't do builds or testing on s390 or PPC.
| public abstract Address getFP(); | ||
|
|
||
| public void setSP(Address newSP) { | ||
| throw new UnsupportedPlatformException("Continuation is not yet implemented."); |
There was a problem hiding this comment.
Although I understand that this method is not overridden on platforms that don't support continuations (s390), the relationship between a method with a generic name like "setSP" and a specific error messages about continuations is not obvious. If setSP() only only useful in the context of continuations, I'd suggest naming it something like setContinuationSP(), or you can leave it as setSP() but get rid of the reference to continuations in the error message.
There was a problem hiding this comment.
We can make it to abstract method, so I did it in new commit.
| public static boolean isSPInContinuation(ContinuationEntry entry, Address sp) { | ||
| return entry.getEntrySP().greaterThan(sp); | ||
| } |
There was a problem hiding this comment.
This could be made private.
There was a problem hiding this comment.
It is public member in HotSpot, so I aligned with it. However it does not need to be public in SA.
Should we it to be private?
There was a problem hiding this comment.
It's ok to keep public then.
| return entry.getEntrySP().greaterThan(sp); | ||
| } | ||
|
|
||
| public static ContinuationEntry getContinuationEntryForSP(JavaThread thread, Address sp) { |
There was a problem hiding this comment.
This also could be made private.
There was a problem hiding this comment.
It is public member in HotSpot, so I aligned with it. However it does not need to be public in SA.
Should we it to be private?
There was a problem hiding this comment.
It's ok to keep public then.
| // HotSpot has following code in frame::sender_raw() at frame_x86.inline.hpp, however | ||
| // in_cont() should be false. | ||
| // | ||
| // if (map->in_cont()) { // already in an h-stack | ||
| // return map->stack_chunk()->sender(*this, map); | ||
| // } | ||
| // | ||
| // in_cont() returns true if _chunk() is not null. | ||
| // | ||
| // frame::next_frame() creates RegisterMap instance with 4 arguments. | ||
| // It sets RegisterMap::WalkContinuation::skip to final argument (walk_count), | ||
| // then _chunk would not be initialized following code in c'tor of RegisterMap. | ||
| // | ||
| // if (walk_cont == WalkContinuation::include && thread != nullptr && thread->last_continuation() != nullptr) { | ||
| // _chunk = stackChunkHandle(Thread::current()->handle_area()->allocate_null_handle(), true /* dummy */); | ||
| // } | ||
|
|
There was a problem hiding this comment.
I don't understand how this comment is relevant to the code below. Why is this here?
There was a problem hiding this comment.
SA should follow HotSpot implementation, so that code should be included basically. However it is not needed in this case. Thus I left comment the reason.
There was a problem hiding this comment.
I still don't follow. Are you saying that map->in_cont() will always return true so you don't need the walk_cont related code?
There was a problem hiding this comment.
I just want to say we don't need to copy return map->stack_chunk()->sender(*this, map) to SA from HotSpot because map->in_cont() should be false in use case of SA.
in_cont() returns true if _chunk is not NULL, but it would not happen in the use case of SA because RegisterMap would not be initialized with WalkContinuation::include.
We do not need to consider s390 because SA does not have s390 implementation. |
| return senderForUpcallStub(map, (UpcallStub)cb); | ||
| } else if (cb.isContinuationStub()) { | ||
| return senderForContinuationStub(map, cb); | ||
| } else { |
There was a problem hiding this comment.
Hi,
I tried this on linux-riscv64 platform and I witnessed test failure when running serviceability/sa/TestJhsdbJstackWithVirtualThread.java:
java.lang.RuntimeException: 'must have non-zero frame size' found in stdout
at jdk.test.lib.process.OutputAnalyzer.shouldNotContain(OutputAnalyzer.java:299)
at TestJhsdbJstackWithVirtualThread.runJstack(TestJhsdbJstackWithVirtualThread.java:63)
at TestJhsdbJstackWithVirtualThread.main(TestJhsdbJstackWithVirtualThread.java:74)
at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104)
at java.base/java.lang.reflect.Method.invoke(Method.java:565)
at com.sun.javatest.regtest.agent.MainActionHelper$AgentVMRunnable.run(MainActionHelper.java:335)
at java.base/java.lang.Thread.run(Thread.java:1527)
JavaTest Message: Test threw exception: java.lang.RuntimeException
JavaTest Message: shutting down test
I guess you might want to add following add-on change. I see aarch64 and amd64 has a similar frame size check before invoking senderForCompiledFrame method.
diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/riscv64/RISCV64Frame.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/riscv64/RISCV64Frame.java
index 67b4314a3c7..a35c0735979 100644
--- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/riscv64/RISCV64Frame.java
+++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/riscv64/RISCV64Frame.java
@@ -269,7 +269,7 @@ public Frame sender(RegisterMap regMap, CodeBlob cb) {
if (cb != null) {
if (cb.isUpcallStub()) {
return senderForUpcallStub(map, (UpcallStub)cb);
- } else {
+ } else if (cb.getFrameSize() > 0) {
return senderForCompiledFrame(map, cb);
}
}
There was a problem hiding this comment.
Thanks a lot! You are right.
I applied that change to both RISC-V and PPC64. Could you check again?
There was a problem hiding this comment.
My local hotspot_serviceability and jdk_svc tests on linux-riscv64 are passing using the latest version. Thanks for the update.
|
Just a drive-by comment, but if this is being fixed in mainline then the |
|
Fixed title both this PR and JBS.
Yes, however mainline has potential bug, so I want to fix mainline first. |
Tier1-4 have passed on PPC64. Thanks for implementing it for all SA platforms! |
…d64/AMD64Frame.java Co-authored-by: Chris Plummer <chris.plummer@oracle.com>
…d64/AMD64Frame.java Co-authored-by: Chris Plummer <chris.plummer@oracle.com>
|
PING: Can I get Reviewers? This PR has passed SA tests on all of supported platforms. |
TheRealMDoerr
left a comment
There was a problem hiding this comment.
PPC64 code looks correct to me. Thanks!
| // We assume WalkContinuation is "WalkContinuation::skip". | ||
| // It is same with c'tor arguments of RegisterMap in frame::next_frame(). | ||
| // | ||
| // HotSpot code in cpu/riscv/frame_riscv.inline.hpp: |
There was a problem hiding this comment.
Should better refer to cpu/ppc/frame_ppc.inline.hpp
There was a problem hiding this comment.
Thanks! Fixed it in new commit.
|
|
||
| @Override | ||
| public Frame toFrame() { | ||
| return new AARCH64Frame(getEntrySP(), getEntrySP(), getEntryFP(), getEntryPC()); |
There was a problem hiding this comment.
Do we need the same code replicated for all platforms? (May make senes. Not sure.)
There was a problem hiding this comment.
This structure comes from HotSpot.
to_frame() is defined in continuationEntry_<arch>.inline.hpp. So I think it is better to follow it because most of source file in SA follows HotSpot manner.
TheRealMDoerr
left a comment
There was a problem hiding this comment.
PPC64 parts looks good. Only a partial review. Thanks!
RealFYang
left a comment
There was a problem hiding this comment.
The RISC-V part of the change looks fine. hotspot_serviceability and jdk_svc still test good on this platform.
|
/integrate |
|
Going to push as commit 69deec2.
Your commit was automatically rebased without conflicts. |
We saw the failure in serviceability/sa/TestJhsdbJstackMixedWithXComp.java on Valhalla repo.
jhsdb jstack --mixedcould not unwind continuation call frames as following:I found that
frame::sender_for_compiled_frame()in frame_x86.inline.hpp has a special case if sender PC has return barrier entry, but SA does not handle it.This is not only a problem on Valhalla. Same problem exists on JDK. So I want to fix on JDK.
This PR passed serviceability/sa tests on Linux, and also TestJhsdbJstackMixedWithXComp.java on Valhalla passed 100 times.
This PR is assembled by following commits:
Progress
Issue
Reviewers
Reviewing
Using
gitCheckout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/30107/head:pull/30107$ git checkout pull/30107Update a local copy of the PR:
$ git checkout pull/30107$ git pull https://git.openjdk.org/jdk.git pull/30107/headUsing Skara CLI tools
Checkout this PR locally:
$ git pr checkout 30107View PR using the GUI difftool:
$ git pr show -t 30107Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/30107.diff
Using Webrev
Link to Webrev Comment