JDK-8230552 : Provide information when hitting a HaltNode for architectures other than x86
  • Type: Enhancement
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: 14,15
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2019-09-04
  • Updated: 2024-10-10
  • Resolved: 2020-06-01
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 15
15 b26Fixed
Related Reports
Relates :  
Relates :  
Relates :  
Relates :  
Relates :  
Description
As a follow-up to JDK-8225653, the new additional information about the purpose of a HaltNode should also be provided for architectures other than x86 when a HaltNode is hit. The only change required is to use MacroAssembler::stop with the new halt information string in the ad files as done in x86.ad in the change for JDK-8225653.

Comments
URL: https://hg.openjdk.java.net/jdk/jdk/rev/319e0bb80a04 User: aph Date: 2020-06-01 12:53:11 +0000
01-06-2020

Here is what the new crash report of PPC64 looks like. # # A fatal error has been detected by the Java Runtime Environment: # # Internal Error (0xe0000000), pid=29300, tid=29301 # stop: unsafe off-heap access with zero address # # JRE version: OpenJDK Runtime Environment (15.0) (fastdebug build 15-internal+0-adhoc.xxinliu.jdk) # Java VM: OpenJDK 64-Bit Server VM (fastdebug 15-internal+0-adhoc.xxinliu.jdk, compiled mode, compressed oops, g1 gc, linux-ppc64le) # Problematic frame: # J 31 c2 compiler.unsafe.TestUnsafeLoadWithZeroAddress.main([Ljava/lang/String;)V (17 bytes) @ 0x00003fff8911ad8c [0x00003fff8911ad00+0x000000000000008c] # # Core dump will be written. Default location: Core dumps may be processed with "/usr/share/apport/apport %p %s %c %d %P %E" (or dumping to /home/xxinliu/jdk/core.29300) # # 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: --add-exports=java.base/jdk.internal.misc=ALL-UNNAMED --add-opens=java.base/jdk.internal.misc=ALL-UNNAMED -XX:+PrintOptoAssembly -Xcomp -XX:CompileCommand=compileonly,compiler.unsafe.TestUnsafeLoadWithZeroAddress::* -XX:+AlwaysIncrementalInline -XX:SuppressErrorAt=/cfgnode.hpp:179 -XX:SuppressErrorAt=/cfgnode.hpp:174 -XX:-TieredCompilation compiler.unsafe.TestUnsafeLoadWithZeroAddress Host: openjdkpower-le, POWER8 (architected), altivec supported, 8 cores, 15G, Ubuntu 16.04.6 LTS Time: Fri May 29 21:43:06 2020 UTC elapsed time: 2.001566 seconds (0d 0h 0m 2s) --------------- T H R E A D --------------- Current thread (0x00003fff8c0330d0): JavaThread "main" [_thread_in_Java, id=29301, stack(0x00003fff93070000,0x00003fff93270000)] Stack: [0x00003fff93070000,0x00003fff93270000], sp=0x00003fff9326df80, free space=2039k Native frames: (J=compiled Java code, A=aot compiled Java code, j=interpreted, Vv=VM code, C=native code) J 31 c2 compiler.unsafe.TestUnsafeLoadWithZeroAddress.main([Ljava/lang/String;)V (17 bytes) @ 0x00003fff8911ad8c [0x00003fff8911ad00+0x000000000000008c] v ~StubRoutines::call_stub V [libjvm.so+0xdbade8] JavaCalls::call_helper(JavaValue*, methodHandle const&, JavaCallArguments*, Thread*)+0x7b8 V [libjvm.so+0x144199c] os::os_exception_wrapper(void (*)(JavaValue*, methodHandle const&, JavaCallArguments*, Thread*), JavaValue*, methodHandle const&, JavaCallArguments*, Thread*)+0x3c V [libjvm.so+0xdb8d60] JavaCalls::call(JavaValue*, methodHandle const&, JavaCallArguments*, Thread*)+0xb0 V [libjvm.so+0xf3b644] jni_invoke_static(JNIEnv_*, JavaValue*, _jobject*, JNICallType, _jmethodID*, JNI_ArgumentPusher*, Thread*) [clone .isra.106] [clone .constprop.233]+0x284 V [libjvm.so+0xf411c4] jni_CallStaticVoidMethod+0x224 C [libjli.so+0x5ce8] JavaMain+0xe78 C [libjli.so+0x9078] ThreadJavaMain+0x18 C [libpthread.so.0+0x8040] start_thread+0xf0
29-05-2020

Thanks for waiting. I appreciate pushing it after JDK-8022574 and JDK-8244949. Should be ready, soon.
22-05-2020

I think Martin's JDK-8244949 is the prerequisite of this, isn't it?
19-05-2020

awaiting review? - http://mail.openjdk.java.net/pipermail/hotspot-compiler-dev/2020-April/038064.html
19-05-2020

Sounds good, thanks!
30-04-2020

got it. thanks. I have sent webrev which includes all other architectures. let's see if I can draw attention of maintainers. If I can't, I will proceed to a subtask of aarch64.
30-04-2020

[~xliu] You can create a sub-task of this task for AArch64 and leave this one open (as it might be referenced from reviews etc.). If you already have some code for other architectures you can also put them in a comment here as a starting point for others that want to pick this RFE up for the remaining architectures.
30-04-2020

[~ chagedorn] I also made changes for other architectures, but they are beyond my ability. May I reduce the scope of this task to 'aarch64-only'? It's easy to move forward for me.
29-04-2020

Thank you. Both of your approaches work! I modified aarch64.ad. diff -r 14592d2b2795 src/hotspot/cpu/aarch64/aarch64.ad --- a/src/hotspot/cpu/aarch64/aarch64.ad Wed Apr 29 08:38:28 2020 +0100 +++ b/src/hotspot/cpu/aarch64/aarch64.ad Wed Apr 29 17:56:31 2020 +0000 @@ -15333,9 +15333,7 @@ format %{ "ShouldNotReachHere" %} ins_encode %{ - // +1 so NativeInstruction::is_sigill_zombie_not_entrant() doesn't - // return true - __ dpcs1(0xdead + 1); + __ stop(_halt_reason); %} aarch64 hotspot crash report looks same as x86 now. BEFORE CHANGE: # A fatal error has been detected by the Java Runtime Environment: # # SIGILL (0x4) at pc=0x0000ffff9c898d24, pid=33415, tid=33416 # # JRE version: OpenJDK Runtime Environment (15.0) (slowdebug build 15-internal+0-adhoc.ubuntu.jdk) # Java VM: OpenJDK 64-Bit Server VM (slowdebug 15-internal+0-adhoc.ubuntu.jdk, compiled mode, compressed oops, g1 gc, linux-aarch64) # Problematic frame: # J 31 c2 compiler.unsafe.TestUnsafeLoadWithZeroAddress.main([Ljava/lang/String;)V (17 bytes) @ 0x0000ffff9c898d24 [0x0000ffff9c898cc0+0x0000000000000064] # # Core dump will be written. Default location: Core dumps may be processed with "/usr/share/apport/apport %p %s %c %d %P" (or dumping to /home/ubuntu/build/jdk/core.33415) # # 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: --add-exports=java.base/jdk.internal.misc=ALL-UNNAMED --add-opens=java.base/jdk.internal.misc=ALL-UNNAMED -XX:+PrintOptoAssembly -Xcomp -XX:CompileCommand=compileonly,compiler.unsafe.TestUnsafeLoadWithZeroAddress::* -XX:+AlwaysIncrementalInline -XX:SuppressErrorAt=/cfgnode.hpp:179 -XX:SuppressErrorAt=/cfgnode.hpp:174 -XX:-TieredCompilation compiler.unsafe.TestUnsafeLoadWithZeroAddress Host: ip-172-31-84-186, AArch64, 64 cores, 246G, Ubuntu 18.04.3 LTS Time: Wed Apr 29 09:16:08 2020 UTC elapsed time: 1.493788 seconds (0d 0h 0m 1s) --------------- T H R E A D --------------- Current thread (0x0000ffff98034800): JavaThread "main" [_thread_in_Java, id=33416, stack(0x0000ffff9f8d6000,0x0000ffff9fad6000)] Stack: [0x0000ffff9f8d6000,0x0000ffff9fad6000], sp=0x0000ffff9fad4330, free space=2040k Native frames: (J=compiled Java code, A=aot compiled Java code, j=interpreted, Vv=VM code, C=native code) J 31 c2 compiler.unsafe.TestUnsafeLoadWithZeroAddress.main([Ljava/lang/String;)V (17 bytes) @ 0x0000ffff9c898d24 [0x0000ffff9c898cc0+0x0000000000000064] v ~StubRoutines::call_stub V [libjvm.so+0x9d8008] JavaCalls::call_helper(JavaValue*, methodHandle const&, JavaCallArguments*, Thread*)+0x518 V [libjvm.so+0xe8d834] os::os_exception_wrapper(void (*)(JavaValue*, methodHandle const&, JavaCallArguments*, Thread*), JavaValue*, methodHandle const&, JavaCallArguments*, Thread*)+0x34 V [libjvm.so+0x9d7ae4] JavaCalls::call(JavaValue*, methodHandle const&, JavaCallArguments*, Thread*)+0xa0 V [libjvm.so+0xa917c8] jni_invoke_static(JNIEnv_*, JavaValue*, _jobject*, JNICallType, _jmethodID*, JNI_ArgumentPusher*, Thread*)+0x130 V [libjvm.so+0xaa7fb8] jni_CallStaticVoidMethod+0x37c C [libjli.so+0x503c] JavaMain+0xb60 C [libjli.so+0xc84c] ThreadJavaMain+0x28 C [libpthread.so.0+0x7088] start_thread+0xb0 AFTER CHANGE: # # A fatal error has been detected by the Java Runtime Environment: # # Internal Error (/home/ubuntu/build/jdk/src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp:2613), pid=48065, tid=48066 # fatal error: DEBUG MESSAGE: unsafe off-heap access with zero address # # JRE version: OpenJDK Runtime Environment (15.0) (slowdebug build 15-internal+0-adhoc.ubuntu.jdk) # Java VM: OpenJDK 64-Bit Server VM (slowdebug 15-internal+0-adhoc.ubuntu.jdk, compiled mode, compressed oops, g1 gc, linux-aarch64) # Core dump will be written. Default location: Core dumps may be processed with "/usr/share/apport/apport %p %s %c %d %P" (or dumping to /home/ubuntu/build/jdk/core.48065) # # 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: --add-exports=java.base/jdk.internal.misc=ALL-UNNAMED --add-opens=java.base/jdk.internal.misc=ALL-UNNAMED -XX:+PrintOptoAssembly -Xcomp -XX:CompileCommand=compileonly,compiler.unsafe.TestUnsafeLoadWithZeroAddress::* -XX:+AlwaysIncrementalInline -XX:SuppressErrorAt=/cfgnode.hpp:179 -XX:SuppressErrorAt=/cfgnode.hpp:174 -XX:-TieredCompilation compiler.unsafe.TestUnsafeLoadWithZeroAddress Host: ip-172-31-84-186, AArch64, 64 cores, 246G, Ubuntu 18.04.3 LTS Time: Wed Apr 29 17:48:48 2020 UTC elapsed time: 1.516579 seconds (0d 0h 0m 1s) --------------- T H R E A D --------------- Current thread (0x0000ffff7c034800): JavaThread "main" [_thread_in_Java, id=48066, stack(0x0000ffff838e3000,0x0000ffff83ae3000)] Stack: [0x0000ffff838e3000,0x0000ffff83ae3000], sp=0x0000ffff83ae0e10, free space=2039k Native frames: (J=compiled Java code, A=aot compiled Java code, j=interpreted, Vv=VM code, C=native code) V [libjvm.so+0x11a4598] VMError::report_and_die(int, char const*, char const*, std::__va_list, Thread*, unsigned char*, void*, void*, char const*, int, unsigned long)+0x810 V [libjvm.so+0x11a3cd8] VMError::report_and_die(Thread*, void*, char const*, int, char const*, char const*, std::__va_list)+0x80 V [libjvm.so+0x70c4b4] report_fatal(char const*, int, char const*, ...)+0x154 V [libjvm.so+0xd5186c] MacroAssembler::debug64(char*, long, long*)+0x718
29-04-2020

[~xliu] you can use the test "test/hotspot/jtreg/compiler/unsafe/TestUnsafeLoadWithZeroAddress.java" which was introduced with JDK-8224658 to provoke the generation of a HaltNode. Just insert the following line into the test's main method: static public void main(String[] args) { test1(); test2(); + f = true; test3(); test4(); } compile it with: javac --add-exports java.base/jdk.internal.misc=ALL-UNNAMED -d /tmp test/hotspot/jtreg/compiler/unsafe/TestUnsafeLoadWithZeroAddress.java and run it with: java --add-exports java.base/jdk.internal.misc=ALL-UNNAMED --add-opens java.base/jdk.internal.misc=ALL-UNNAMED -XX:+PrintOptoAssembly -Xcomp -XX:CompileCommand=compileonly,compiler.unsafe.TestUnsafeLoadWithZeroAddress::* -XX:+AlwaysIncrementalInline -XX:SuppressErrorAt=/cfgnode.hpp:179 -XX:SuppressErrorAt=/cfgnode.hpp:174 -XX:-TieredCompilation -cp /tmp compiler.unsafe.TestUnsafeLoadWithZeroAddress This will generate a HaltNode in compiler.unsafe.TestUnsafeLoadWithZeroAddress.main(): 05c B5: # out( N1 ) <- in( B4 B1 B3 ) Freq: 0,99996 nop # 4 bytes pad for loops and calls 060 ud2 # ShouldNotReachHere and will instantly crash with: ... # Internal Error (/OpenJDK/jdk/src/hotspot/cpu/x86/macroAssembler_x86.cpp:880), pid=22141, tid=22142 # fatal error: DEBUG MESSAGE: unsafe off-heap access with zero address ... Notice that you'll have to run this with a debug build because "-XX:+AlwaysIncrementalInline" is not a product flag and you may have to adapt the line numbers for the "-XX:SuppressErrorAt=" options depending on your exact jdk version otherwise you may already crash during the C2 compilation because of assertions.
27-04-2020

Hi [~xliu], you could, for example, add an artificial HaltNode to the very end of DirectCallGeneratore::generate(JVMState* jvms) before returning like that: kit.push_node(method()->return_type()->basic_type(), ret); + HaltNode* halt = new HaltNode(kit.control(), kit.frameptr(), "some reason"); + kit.gvn().set_type_bottom(halt); + kit.root()->add_req(halt); + kit.set_control(halt); return kit.transfer_exceptions_into_jvms(); Then you can hit this halt node with a program like: public class Test { public static void main(String[] args) { test(2); } public static int test(int a) { return a + 1; } } Just ensure that you only compile main(): java -Xbatch -Xcomp -XX:-TieredCompilation -XX:CompileCommand=compileonly,Test::main Test.java
27-04-2020

[~chagedorn] I have hard time to write a program to generate HaltNode. GraphKit::must_be_not_null does generate HaltNode, but I found they are always optimized out. do you have one?
24-04-2020