Skip to content

8285699: riscv: Provide information when hitting a HaltNode#8442

Closed
yadongw wants to merge 3 commits intoopenjdk:masterfrom
yadongw:JDK-8285699
Closed

8285699: riscv: Provide information when hitting a HaltNode#8442
yadongw wants to merge 3 commits intoopenjdk:masterfrom
yadongw:JDK-8285699

Conversation

@yadongw
Copy link
Contributor

@yadongw yadongw commented Apr 28, 2022

The code generated in MacroAssembler::stop is indeed grossly bloated with pusha()/popa() and a native call. We would like to follow the implementation in aarch64 port JDK-8245986, and provide a halt reason when hitting a C2 HaltNode on riscv, and implement it by triggering illegal instruction exceptions.

hs_err_pid log BEFORE:

#
# A fatal error has been detected by the Java Runtime Environment:
#
#  SIGILL (0x4) at pc=0x0000003fdd049cd0, pid=2203593, tid=2203614
#
# JRE version: OpenJDK Runtime Environment (19.0) (fastdebug build 19-internal-adhoc.wangyadong.jdk)
# Java VM: OpenJDK 64-Bit Server VM (fastdebug 19-internal-adhoc.wangyadong.jdk, compiled mode, compressed oops, compressed class ptrs, g1 gc, linux-riscv64)
# Problematic frame:
# J 20 c2 compiler.unsafe.TestUnsafeLoadWithZeroAddress.main([Ljava/lang/String;)V (13 bytes) @ 0x0000003fdd049cd0 [0x0000003fdd049c40+0x0000000000000090]
#
# No core dump will be written. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again
#
# If you would like to submit a bug report, please visit:
#   https://bugreport.java.com/bugreport/crash.jsp
#

---------------  S U M M A R Y ------------

Command Line: -Dtest.vm.opts= -Dtest.tool.vm.opts= -Dtest.compiler.opts= -Dtest.java.opts= -Dtest.jdk=/home/wangyadong/openjdk-19-internal-before -Dcompile.jdk=/home/wangyadong/openjdk-19-internal-before -Dtest.timeout.factor=1.0 -Dtest.root=/home/wangyadong/riscv-port/test/hotspot/jtreg -Dtest.name=compiler/unsafe/TestUnsafeLoadWithZeroAddress.java -Dtest.file=/home/wangyadong/riscv-port/test/hotspot/jtreg/compiler/unsafe/TestUnsafeLoadWithZeroAddress.java -Dtest.src=/home/wangyadong/riscv-port/test/hotspot/jtreg/compiler/unsafe -Dtest.src.path=/home/wangyadong/riscv-port/test/hotspot/jtreg/compiler/unsafe -Dtest.classes=/home/wangyadong/riscv-port/JTwork/classes/compiler/unsafe/TestUnsafeLoadWithZeroAddress.d -Dtest.class.path=/home/wangyadong/riscv-port/JTwork/classes/compiler/unsafe/TestUnsafeLoadWithZeroAddress.d -Dtest.modules=java.base/jdk.internal.misc:+open --add-modules=java.base --add-exports=java.base/jdk.internal.misc=ALL-UNNAMED --add-opens=java.base/jdk.internal.misc=ALL-UNNAMED -Xcomp -Xbatch -XX:-TieredCompilation -XX:+AlwaysIncrementalInline -XX:CompileCommand=compileonly,compiler.unsafe.TestUnsafeLoadWithZeroAddress::* com.sun.javatest.regtest.agent.MainWrapper /home/wangyadong/riscv-port/JTwork/compiler/unsafe/TestUnsafeLoadWithZeroAddress.d/main.0.jta

Host: ubuntu, RISCV64, 4 cores, 15G, Ubuntu 21.04
Time: Thu Apr 28 00:00:50 2022 CST elapsed time: 4.374528 seconds (0d 0h 0m 4s)

---------------  T H R E A D  ---------------

Current thread (0x0000003fe8471060):  JavaThread "MainThread" [_thread_in_Java, id=2203614, stack(0x0000003fc47a4000,0x0000003fc49a4000)]

Stack: [0x0000003fc47a4000,0x0000003fc49a4000],  sp=0x0000003fc49a1f00,  free space=2039k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
J 20 c2 compiler.unsafe.TestUnsafeLoadWithZeroAddress.main([Ljava/lang/String;)V (13 bytes) @ 0x0000003fdd049cd0 [0x0000003fdd049c40+0x0000000000000090]
j  java.lang.invoke.LambdaForm$DMH+0x0000000800080800.invokeStatic(Ljava/lang/Object;Ljava/lang/Object;)V+10 java.base@19-internal
j  java.lang.invoke.LambdaForm$MH+0x0000000800081c00.invoke(Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;+33 java.base@19-internal
j  java.lang.invoke.Invokers$Holder.invokeExact_MT(Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;+20 java.base@19-internal
j  jdk.internal.reflect.DirectMethodHandleAccessor.invokeImpl(Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;+55 java.base@19-internal
j  jdk.internal.reflect.DirectMethodHandleAccessor.invoke(Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;+23 java.base@19-internal
j  java.lang.reflect.Method.invoke(Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;+102 java.base@19-internal
j  com.sun.javatest.regtest.agent.MainWrapper$MainThread.run()V+172
j  java.lang.Thread.run()V+11 java.base@19-internal
v  ~StubRoutines::call_stub
V  [libjvm.so+0xa8a0fe]  JavaCalls::call_helper(JavaValue*, methodHandle const&, JavaCallArguments*, JavaThread*)+0x4cc
V  [libjvm.so+0xa8a674]  JavaCalls::call_virtual(JavaValue*, Klass*, Symbol*, Symbol*, JavaCallArguments*, JavaThread*)+0x3e0
V  [libjvm.so+0xa8aa02]  JavaCalls::call_virtual(JavaValue*, Handle, Klass*, Symbol*, Symbol*, JavaThread*)+0x60
V  [libjvm.so+0xbcf9b4]  thread_entry(JavaThread*, JavaThread*)+0x88
V  [libjvm.so+0x1299d94]  JavaThread::thread_main_inner()+0x24e
V  [libjvm.so+0x12a0cd4]  Thread::call_run()+0xd4
V  [libjvm.so+0xf3c52e]  thread_native_entry(Thread*)+0xee
C  [libpthread.so.0+0x7460]  start_thread+0xb4
C  [libc.so.6+0xa7362]

hs_err_pid log AFTER:

#
# A fatal error has been detected by the Java Runtime Environment:
#
#  Internal Error (0xe0000000), pid=2178405, tid=2178428
#  stop: unsafe off-heap access with zero address
#
# JRE version: OpenJDK Runtime Environment (19.0) (fastdebug build 19-internal-adhoc.wangyadong.jdk)
# Java VM: OpenJDK 64-Bit Server VM (fastdebug 19-internal-adhoc.wangyadong.jdk, compiled mode, compressed oops, compressed class ptrs, g1 gc, linux-riscv64)
# Problematic frame:
# J 20 c2 compiler.unsafe.TestUnsafeLoadWithZeroAddress.main([Ljava/lang/String;)V (13 bytes) @ 0x0000003fe0f4c5d0 [0x0000003fe0f4c540+0x0000000000000090]
#
# No core dump will be written. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again
#
# If you would like to submit a bug report, please visit:
#   https://bugreport.java.com/bugreport/crash.jsp
#

---------------  S U M M A R Y ------------

Command Line: -Dtest.vm.opts= -Dtest.tool.vm.opts= -Dtest.compiler.opts= -Dtest.java.opts= -Dtest.jdk=/home/wangyadong/openjdk-19-internal-fastdebug -Dcompile.jdk=/home/wangyadong/openjdk-19-internal-fastdebug -Dtest.timeout.factor=1.0 -Dtest.root=/home/wangyadong/riscv-port/test/hotspot/jtreg -Dtest.name=compiler/unsafe/TestUnsafeLoadWithZeroAddress.java -Dtest.file=/home/wangyadong/riscv-port/test/hotspot/jtreg/compiler/unsafe/TestUnsafeLoadWithZeroAddress.java -Dtest.src=/home/wangyadong/riscv-port/test/hotspot/jtreg/compiler/unsafe -Dtest.src.path=/home/wangyadong/riscv-port/test/hotspot/jtreg/compiler/unsafe -Dtest.classes=/home/wangyadong/riscv-port/JTwork/classes/compiler/unsafe/TestUnsafeLoadWithZeroAddress.d -Dtest.class.path=/home/wangyadong/riscv-port/JTwork/classes/compiler/unsafe/TestUnsafeLoadWithZeroAddress.d -Dtest.modules=java.base/jdk.internal.misc:+open --add-modules=java.base --add-exports=java.base/jdk.internal.misc=ALL-UNNAMED --add-opens=java.base/jdk.internal.misc=ALL-UNNAMED -Xcomp -Xbatch -XX:-TieredCompilation -XX:+AlwaysIncrementalInline -XX:CompileCommand=compileonly,compiler.unsafe.TestUnsafeLoadWithZeroAddress::* com.sun.javatest.regtest.agent.MainWrapper /home/wangyadong/riscv-port/JTwork/compiler/unsafe/TestUnsafeLoadWithZeroAddress.d/main.0.jta

Host: ubuntu, RISCV64, 4 cores, 15G, Ubuntu 21.04
Time: Wed Apr 27 23:41:11 2022 CST elapsed time: 4.469731 seconds (0d 0h 0m 4s)

---------------  T H R E A D  ---------------

Current thread (0x0000003fec45d7a0):  JavaThread "MainThread" [_thread_in_Java, id=2178428, stack(0x0000003fc91fe000,0x0000003fc93fe000)]

Stack: [0x0000003fc91fe000,0x0000003fc93fe000],  sp=0x0000003fc93fbf00,  free space=2039k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
J 20 c2 compiler.unsafe.TestUnsafeLoadWithZeroAddress.main([Ljava/lang/String;)V (13 bytes) @ 0x0000003fe0f4c5d0 [0x0000003fe0f4c540+0x0000000000000090]
j  java.lang.invoke.LambdaForm$DMH+0x00000008000c0000.invokeStatic(Ljava/lang/Object;Ljava/lang/Object;)V+10 java.base@19-internal
j  java.lang.invoke.LambdaForm$MH+0x00000008000c1400.invoke(Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;+33 java.base@19-internal
j  java.lang.invoke.Invokers$Holder.invokeExact_MT(Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;+20 java.base@19-internal
j  jdk.internal.reflect.DirectMethodHandleAccessor.invokeImpl(Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;+55 java.base@19-internal
j  jdk.internal.reflect.DirectMethodHandleAccessor.invoke(Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;+23 java.base@19-internal
j  java.lang.reflect.Method.invoke(Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;+102 java.base@19-internal
j  com.sun.javatest.regtest.agent.MainWrapper$MainThread.run()V+172
j  java.lang.Thread.run()V+11 java.base@19-internal
v  ~StubRoutines::call_stub
V  [libjvm.so+0xa8a0d2]  JavaCalls::call_helper(JavaValue*, methodHandle const&, JavaCallArguments*, JavaThread*)+0x4cc
V  [libjvm.so+0xa8a648]  JavaCalls::call_virtual(JavaValue*, Klass*, Symbol*, Symbol*, JavaCallArguments*, JavaThread*)+0x3e0
V  [libjvm.so+0xa8a9d6]  JavaCalls::call_virtual(JavaValue*, Handle, Klass*, Symbol*, Symbol*, JavaThread*)+0x60
V  [libjvm.so+0xbcf988]  thread_entry(JavaThread*, JavaThread*)+0x88
V  [libjvm.so+0x1299ca6]  JavaThread::thread_main_inner()+0x24e
V  [libjvm.so+0x12a0be6]  Thread::call_run()+0xd4
V  [libjvm.so+0xf3c294]  thread_native_entry(Thread*)+0xee
C  [libpthread.so.0+0x7460]  start_thread+0xb4
C  [libc.so.6+0xa7362]

This patch passes hotspot and jdk tiere1 on unmatched, and all jtreg tests are tested on Qemu without new failures.


Progress

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

Issue

  • JDK-8285699: riscv: Provide information when hitting a HaltNode

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 8442

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

Using diff file

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

@bridgekeeper
Copy link

bridgekeeper bot commented Apr 28, 2022

👋 Welcome back yadongwang! 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 Apr 28, 2022
@openjdk
Copy link

openjdk bot commented Apr 28, 2022

@yadongw The following label will be automatically applied to this pull request:

  • hotspot

When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing list. If you would like to change these labels, use the /label pull request command.

@openjdk openjdk bot added the hotspot hotspot-dev@openjdk.org label Apr 28, 2022
@mlbridge
Copy link

mlbridge bot commented Apr 28, 2022

Webrevs

Copy link
Member

@RealFYang RealFYang left a comment

Choose a reason for hiding this comment

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

Looks good.

@openjdk
Copy link

openjdk bot commented Apr 28, 2022

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

8285699: riscv: Provide information when hitting a HaltNode

Reviewed-by: fyang

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

  • e2e943a: 8285688: Add links to JEPs and JSRs to SourceVersion
  • 80cf59f: 8285610: TreeInfo.pathFor and its uses appear to be dead code
  • 21b62fe: 8195589: T6587786.java failed after JDK-8189997
  • 8190217: 8285496: DocLint does not check for missing @param tags for type parameters on classes and interfaces
  • 64d98ba: 8285094: Test java/awt/Frame/InvisibleOwner/InvisibleOwner.java failing on Linux
  • 573eace: 8285504: Minor cleanup could be done in javax.net
  • bba456a: 8285676: Add missing @param tags for type parameters on classes and interfaces
  • b9d1e85: 8285785: CheckCleanerBound test fails with PasswordCallback object is not released
  • b718578: 8285011: gc/arguments/TestUseCompressedOopsFlagsWithUlimit.java fails after JDK-8280761
  • 2d8d140: 8285690: CloneableReference subtest should not throw CloneNotSupportedException
  • ... and 29 more: https://git.openjdk.java.net/jdk/compare/4714fdcd6a1615b9d357dab0116a579c1cd5bfb5...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.

As you do not have Committer status in this project an existing Committer must agree to sponsor your change. Possible candidates are the reviewers of this PR (@RealFYang) but any other Committer may sponsor as well.

➡️ To flag this PR as ready for integration with the above commit message, type /integrate in a new comment. (Afterwards, your sponsor types /sponsor in a new comment to perform the integration).

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Apr 28, 2022
@yadongw
Copy link
Contributor Author

yadongw commented Apr 29, 2022

/integrate

@RealFYang
Copy link
Member

/sponsor

@openjdk openjdk bot added the sponsor Pull request is ready to be sponsored label Apr 29, 2022
@openjdk
Copy link

openjdk bot commented Apr 29, 2022

@yadongw
Your change (at version 9e2a2d3) is now ready to be sponsored by a Committer.

@openjdk
Copy link

openjdk bot commented Apr 29, 2022

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

  • e2e943a: 8285688: Add links to JEPs and JSRs to SourceVersion
  • 80cf59f: 8285610: TreeInfo.pathFor and its uses appear to be dead code
  • 21b62fe: 8195589: T6587786.java failed after JDK-8189997
  • 8190217: 8285496: DocLint does not check for missing @param tags for type parameters on classes and interfaces
  • 64d98ba: 8285094: Test java/awt/Frame/InvisibleOwner/InvisibleOwner.java failing on Linux
  • 573eace: 8285504: Minor cleanup could be done in javax.net
  • bba456a: 8285676: Add missing @param tags for type parameters on classes and interfaces
  • b9d1e85: 8285785: CheckCleanerBound test fails with PasswordCallback object is not released
  • b718578: 8285011: gc/arguments/TestUseCompressedOopsFlagsWithUlimit.java fails after JDK-8280761
  • 2d8d140: 8285690: CloneableReference subtest should not throw CloneNotSupportedException
  • ... and 29 more: https://git.openjdk.java.net/jdk/compare/4714fdcd6a1615b9d357dab0116a579c1cd5bfb5...master

Your commit was automatically rebased without conflicts.

@openjdk openjdk bot added the integrated Pull request has been integrated label Apr 29, 2022
@openjdk openjdk bot closed this Apr 29, 2022
@openjdk openjdk bot removed ready Pull request is ready to be integrated rfr Pull request is ready for review sponsor Pull request is ready to be sponsored labels Apr 29, 2022
@openjdk
Copy link

openjdk bot commented Apr 29, 2022

@RealFYang @yadongw Pushed as commit 94b533a.

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

Development

Successfully merging this pull request may close these issues.

2 participants