<div class="__aliyun_email_body_block"><div  style="line-height:1.7;font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;color:#000000;"><div  style="clear:both;">Hi Zixian,</div><div  style="clear:both;"><br ></div><div  style="clear:both;">The current backend supports sv48 and below only. Please see [1] for more details.</div><div  style="clear:both;"><br ></div><div  style="clear:both;">The kernel 5.17 supports sv48 and 5.18 supports sv57. Your address `<span  style="color:#000000;font-family:Calibri,sans-serif;font-size:14.7px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:.0px;text-transform:none;white-space:normal;word-spacing:.0px;text-decoration-thickness:initial;text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline;">0xfffffff71136b8</span>` is a 56-bit address, which is not supported by the backend currently.</div><div  style="clear:both;"><br ></div><div  style="clear:both;">To bypass this issue, you can try to use kernel 5.17 directly or find if there are options for QEMU to limit the address space to an sv48 one.</div><div  style="clear:both;"><br ></div><div  style="clear:both;">Not sure if there will be support for a larger address space recently in the backend, for there seems no hardware supporting even sv48 now.</div><div  style="clear:both;"><br ></div><div  style="clear:both;"><br ></div><div  style="clear:both;">Thanks,</div><div  style="clear:both;">Xiaolin</div><div  style="clear:both;"><br ></div><div  style="clear:both;">[1] <span ><a  href="https://github.com/openjdk/jdk/blob/master/src/hotspot/cpu/riscv/macroAssembler_riscv.hpp#L910-L914" target="_blank">https://github.com/openjdk/jdk/blob/master/src/hotspot/cpu/riscv/macroAssembler_riscv.hpp#L910-L914</a></span></div><div  style="clear:both;"><br /></div><blockquote  style="margin-right:0;margin-top:0;margin-bottom:0;font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;color:#000000;"><div  style="clear:both;">------------------------------------------------------------------</div><div  style="clear:both;">From:Zixian Cai <zixian.cai@anu.edu.au></div><div  style="clear:both;">Send Time:2022年9月23日(星期五) 16:57</div><div  style="clear:both;">To:riscv-port-dev@openjdk.org <riscv-port-dev@openjdk.org></div><div  style="clear:both;">Subject:Non-zero build crash on kernel 5.17+?</div><div  style="clear:both;"><br /></div>
<head >


<style >!--  @font-face{font-family:Cambria Math;panose-1:2 4 5 3 5 4 6 3 2 4;}{font-family:DengXian;panose-1:2 1 6 0 3 1 1 1 1 1;}{font-family:Calibri;panose-1:2 15 5 2 2 2 4 3 2 4;}{font-family:\@DengXian;panose-1:2 1 6 0 3 1 1 1 1 1;}p.MsoNormal, li.MsoNormal, div.MsoNormal{margin:.0cm;font-size:12.0pt;font-family:Calibri,sans-serif;}a:link, span.MsoHyperlink{mso-style-priority:99;color:#0563c1;text-decoration:underline;}span.EmailStyle17{mso-style-type:personal-compose;font-family:Calibri,sans-serif;color:windowtext;}.MsoChpDefault{mso-style-type:export-only;font-size:12.0pt;font-family:Calibri,sans-serif;}@page WordSection1{size:612.0pt 792.0pt;margin:72.0pt 72.0pt 72.0pt 72.0pt;}div.WordSection1{page:WordSection1;}--></style>
</head>

<div  class="WordSection1">
<p  class="MsoNormal"><span  style="font-size:11.0pt;">Hi all,</span></p>
<p  class="MsoNormal"><span  style="font-size:11.0pt;"> </span></p>
<p  class="MsoNormal"><span  style="font-size:11.0pt;">I found that a non-zero build of jdk-20+16 crashes on Ubuntu 22.10 (kernel 5.19) running on QEMU.</span></p>
<p  class="MsoNormal"><span  style="font-size:11.0pt;">The same build works on Ubuntu 22.04 (kernel 5.15) running on QEMU.</span></p>
<p  class="MsoNormal"><span  style="font-size:11.0pt;">The error message is as follows.</span></p>
<p  class="MsoNormal"><span  style="font-size:11.0pt;"> </span></p>
<p  class="MsoNormal"><span  style="font-size:11.0pt;"># To suppress the following error report, specify this argument</span></p>
<p  class="MsoNormal"><span  style="font-size:11.0pt;"># after -XX: or in .hotspotrc:  SuppressErrorAt=/assembler_riscv.cpp:285</span></p>
<p  class="MsoNormal"><span  style="font-size:11.0pt;">#</span></p>
<p  class="MsoNormal"><span  style="font-size:11.0pt;"># A fatal error has been detected by the Java Runtime Environment:</span></p>
<p  class="MsoNormal"><span  style="font-size:11.0pt;">#</span></p>
<p  class="MsoNormal"><span  style="font-size:11.0pt;">#  Internal Error (/home/buildbot/worker/build-jdkX-debian10/build/src/hotspot/cpu/riscv/assembler_riscv.cpp:285), pid=907, tid=908</span></p>
<p  class="MsoNormal"><span  style="font-size:11.0pt;">#  assert(is_unsigned_imm_in_range(imm64, 47, 0) || (imm64 == (int64_t)-1)) failed: bit 47 overflows in address constant</span></p>
<p  class="MsoNormal"><span  style="font-size:11.0pt;">#</span></p>
<p  class="MsoNormal"><span  style="font-size:11.0pt;"># JRE version:  (20.0) (slowdebug build )</span></p>
<p  class="MsoNormal"><span  style="font-size:11.0pt;"># Java VM: OpenJDK 64-Bit Server VM (slowdebug 20-testing-builds.shipilev.net-openjdk-jdk-b212-20220922, mixed mode, sharing, tiered, compressed oops, compressed class ptrs, g1 gc, linux-riscv64)</span></p>
<p  class="MsoNormal"><span  style="font-size:11.0pt;"># Problematic frame:</span></p>
<p  class="MsoNormal"><span  style="font-size:11.0pt;"># V  [libjvm.so+0x39f41c]  Assembler::movptr_with_offset(Register, unsigned char*, int&)+0x96</span></p>
<p  class="MsoNormal"><span  style="font-size:11.0pt;">#</span></p>
<p  class="MsoNormal"><span  style="font-size:11.0pt;"># Core dump will be written. Default location: Core dumps may be processed with "/usr/share/apport/apport -p%p -s%s -c%c -d%d -P%P -u%u -g%g -- %E" (or dumping to /home/ubuntu/core.907)</span></p>
<p  class="MsoNormal"><span  style="font-size:11.0pt;">#</span></p>
<p  class="MsoNormal"><span  style="font-size:11.0pt;"># An error report file with more information is saved as:</span></p>
<p  class="MsoNormal"><span  style="font-size:11.0pt;"># /home/ubuntu/hs_err_pid907.log</span></p>
<p  class="MsoNormal"><span  style="font-size:11.0pt;">#</span></p>
<p  class="MsoNormal"><span  style="font-size:11.0pt;">#</span></p>
<p  class="MsoNormal"><span  style="font-size:11.0pt;"> </span></p>
<p  class="MsoNormal"><span  style="font-size:11.0pt;">Here is the backtrace and local variables seen in gdb.</span></p>
<p  class="MsoNormal"><span  style="font-size:11.0pt;"> </span></p>
<p  class="MsoNormal"><span  style="font-size:11.0pt;">(gdb) bt</span></p>
<p  class="MsoNormal"><span  style="font-size:11.0pt;">#0  0x00fffffff674941c in Assembler::movptr_with_offset (this=0xfffffff0000e30, Rd=...,</span></p>
<p  class="MsoNormal"><span  style="font-size:11.0pt;">    addr=0xfffffff71136b8 <SharedRuntime::exception_handler_for_return_address(JavaThread*, unsigned char*)> "9q\006\374\"\370", <incomplete sequence \364\200>, offset=@0xfffffff632f00c: 0)</span></p>
<p  class="MsoNormal"><span  style="font-size:11.0pt;">    at /home/buildbot/worker/build-jdkX-debian10/build/src/hotspot/cpu/riscv/assembler_riscv.cpp:284</span></p>
<p  class="MsoNormal"><span  style="font-size:11.0pt;">#1  0x00fffffff6f17c5c in MacroAssembler::call_VM_leaf_base (this=0xfffffff0000e30,</span></p>
<p  class="MsoNormal"><span  style="font-size:11.0pt;">    entry_point=0xfffffff71136b8 <SharedRuntime::exception_handler_for_return_address(JavaThread*, unsigned char*)> "9q\006\374\"\370", <incomplete sequence \364\200>, number_of_arguments=2,</span></p>
<p  class="MsoNormal"><span  style="font-size:11.0pt;">    retaddr=0x0) at /home/buildbot/worker/build-jdkX-debian10/build/src/hotspot/cpu/riscv/macroAssembler_riscv.cpp:568</span></p>
<p  class="MsoNormal"><span  style="font-size:11.0pt;">#2  0x00fffffff6f17da2 in MacroAssembler::call_VM_leaf (this=0xfffffff0000e30,</span></p>
<p  class="MsoNormal"><span  style="font-size:11.0pt;">    entry_point=0xfffffff71136b8 <SharedRuntime::exception_handler_for_return_address(JavaThread*, unsigned char*)> "9q\006\374\"\370", <incomplete sequence \364\200>, arg_0=..., arg_1=...)</span></p>
<p  class="MsoNormal"><span  style="font-size:11.0pt;">    at /home/buildbot/worker/build-jdkX-debian10/build/src/hotspot/cpu/riscv/macroAssembler_riscv.cpp:588</span></p>
<p  class="MsoNormal"><span  style="font-size:11.0pt;">#3  0x00fffffff7222308 in StubGenerator::generate_forward_exception (this=0xfffffff632f1e8) at /home/buildbot/worker/build-jdkX-debian10/build/src/hotspot/cpu/riscv/stubGenerator_riscv.cpp:546</span></p>
<p  class="MsoNormal"><span  style="font-size:11.0pt;">#4  0x00fffffff7231506 in StubGenerator::generate_initial (this=0xfffffff632f1e8) at /home/buildbot/worker/build-jdkX-debian10/build/src/hotspot/cpu/riscv/stubGenerator_riscv.cpp:3870</span></p>
<p  class="MsoNormal"><span  style="font-size:11.0pt;">#5  0x00fffffff7231956 in StubGenerator::StubGenerator (this=0xfffffff632f1e8, code=0xfffffff632f3c8, phase=0)</span></p>
<p  class="MsoNormal"><span  style="font-size:11.0pt;">    at /home/buildbot/worker/build-jdkX-debian10/build/src/hotspot/cpu/riscv/stubGenerator_riscv.cpp:3971</span></p>
<p  class="MsoNormal"><span  style="font-size:11.0pt;">#6  0x00fffffff721faa0 in StubGenerator_generate (code=0xfffffff632f3c8, phase=0) at /home/buildbot/worker/build-jdkX-debian10/build/src/hotspot/cpu/riscv/stubGenerator_riscv.cpp:3988</span></p>
<p  class="MsoNormal"><span  style="font-size:11.0pt;">#7  0x00fffffff72322c8 in StubRoutines::initialize1 () at /home/buildbot/worker/build-jdkX-debian10/build/src/hotspot/share/runtime/stubRoutines.cpp:228</span></p>
<p  class="MsoNormal"><span  style="font-size:11.0pt;">#8  0x00fffffff72330d2 in stubRoutines_init1 () at /home/buildbot/worker/build-jdkX-debian10/build/src/hotspot/share/runtime/stubRoutines.cpp:389</span></p>
<p  class="MsoNormal"><span  style="font-size:11.0pt;">#9  0x00fffffff6c7823a in init_globals () at /home/buildbot/worker/build-jdkX-debian10/build/src/hotspot/share/runtime/init.cpp:123</span></p>
<p  class="MsoNormal"><span  style="font-size:11.0pt;">#10 0x00fffffff72bcc34 in Threads::create_vm (args=0xfffffff632f7e0, canTryAgain=0xfffffff632f70b) at /home/buildbot/worker/build-jdkX-debian10/build/src/hotspot/share/runtime/threads.cpp:570</span></p>
<p  class="MsoNormal"><span  style="font-size:11.0pt;">#11 0x00fffffff6d891ae in JNI_CreateJavaVM_inner (vm=0xfffffff632f838, penv=0xfffffff632f840, args=0xfffffff632f7e0)</span></p>
<p  class="MsoNormal"><span  style="font-size:11.0pt;">    at /home/buildbot/worker/build-jdkX-debian10/build/src/hotspot/share/prims/jni.cpp:3628</span></p>
<p  class="MsoNormal"><span  style="font-size:11.0pt;">#12 0x00fffffff6d893a8 in JNI_CreateJavaVM (vm=0xfffffff632f838, penv=0xfffffff632f840, args=0xfffffff632f7e0) at /home/buildbot/worker/build-jdkX-debian10/build/src/hotspot/share/prims/jni.cpp:3714</span></p>
<p  class="MsoNormal"><span  style="font-size:11.0pt;">#13 0x00fffffff7fb1a44 in InitializeJVM (pvm=0xfffffff632f838, penv=0xfffffff632f840, ifn=0xfffffff632f890)</span></p>
<p  class="MsoNormal"><span  style="font-size:11.0pt;">    at /home/buildbot/worker/build-jdkX-debian10/build/src/java.base/share/native/libjli/java.c:1457</span></p>
<p  class="MsoNormal"><span  style="font-size:11.0pt;">#14 0x00fffffff7faef16 in JavaMain (_args=0xffffffffffc0d8) at /home/buildbot/worker/build-jdkX-debian10/build/src/java.base/share/native/libjli/java.c:413</span></p>
<p  class="MsoNormal"><span  style="font-size:11.0pt;">#15 0x00fffffff7fb50ea in ThreadJavaMain (args=0xffffffffffc0d8) at /home/buildbot/worker/build-jdkX-debian10/build/src/java.base/unix/native/libjli/java_md.c:650</span></p>
<p  class="MsoNormal"><span  style="font-size:11.0pt;">#16 0x00fffffff7ed7450 in start_thread (arg=<optimized out>) at ./nptl/pthread_create.c:442</span></p>
<p  class="MsoNormal"><span  style="font-size:11.0pt;">#17 0x00fffffff7f24ed2 in __thread_start () at ../sysdeps/unix/sysv/linux/riscv/clone.S:85</span></p>
<p  class="MsoNormal"><span  style="font-size:11.0pt;">(gdb) info locals</span></p>
<p  class="MsoNormal"><span  style="font-size:11.0pt;">imm64 = 0xfffffff71136b8</span></p>
<p  class="MsoNormal"><span  style="font-size:11.0pt;">imm = 0xfffffff632efb0</span></p>
<p  class="MsoNormal"><span  style="font-size:11.0pt;">upper = 0xfffffff632efb0</span></p>
<p  class="MsoNormal"><span  style="font-size:11.0pt;">lower = 0xffffff80000000</span></p>
<p  class="MsoNormal"><span  style="font-size:11.0pt;"> </span></p>
<p  class="MsoNormal"><span  style="font-size:11.0pt;">I suspect that the issue is due to the newer kernels (5.17+) supports sv48, and that increases the bits in the addresses that the assembler needs to handle. See kernel changelog
<a  href="https://cdn.kernel.org/pub/linux/kernel/v5.x/ChangeLog-5.17" target="_blank">https://cdn.kernel.org/pub/linux/kernel/v5.x/ChangeLog-5.17</a>.</span></p>
<p  class="MsoNormal"><span  style="font-size:11.0pt;"> </span></p>
<p  class="MsoNormal"><span  style="font-size:11.0pt;">To reproduce the issue, I use the following.</span></p>
<p  class="MsoNormal"><span  style="font-size:11.0pt;">Guest Ubuntu 22.10: <a  href="https://cdimage.ubuntu.com/ubuntu-server/daily-preinstalled/current/kinetic-preinstalled-server-riscv64+unmatched.img.xz" target="_blank">
https://cdimage.ubuntu.com/ubuntu-server/daily-preinstalled/current/kinetic-preinstalled-server-riscv64+unmatched.img.xz</a></span></p>
<p  class="MsoNormal"><span  style="font-size:11.0pt;">Guest Ubuntu 22.04: <a  href="https://cdimage.ubuntu.com/releases/22.04.1/release/ubuntu-22.04.1-preinstalled-server-riscv64+unmatched.img.xz" target="_blank">
https://cdimage.ubuntu.com/releases/22.04.1/release/ubuntu-22.04.1-preinstalled-server-riscv64+unmatched.img.xz</a></span></p>
<p  class="MsoNormal"><span  style="font-size:11.0pt;">JDK slowdebug build: <a  href="https://builds.shipilev.net/openjdk-jdk/openjdk-jdk-linux-riscv64-server-slowdebug-gcc8-glibc2.28.tar.xz" target="_blank">
https://builds.shipilev.net/openjdk-jdk/openjdk-jdk-linux-riscv64-server-slowdebug-gcc8-glibc2.28.tar.xz</a> (OpenJDK 64-Bit Server VM (slowdebug build 20-testing-builds.shipilev.net-openjdk-jdk-b212-20220922, mixed mode))</span></p>
<p  class="MsoNormal"><span  style="font-size:11.0pt;">QEMU: installed via apt on Ubuntu 22.04 host</span></p>
<p  class="MsoNormal"><span  style="font-size:11.0pt;">QEMU setup: <a  href="https://wiki.ubuntu.com/RISC-V" target="_blank">
https://wiki.ubuntu.com/RISC-V</a></span></p>
<p  class="MsoNormal"><span  style="font-size:11.0pt;"> </span></p>
<p  class="MsoNormal"><span  style="font-size:11.0pt;">Sincerely,</span></p>
<p  class="MsoNormal"><span  style="font-size:11.0pt;">Zixian</span></p>
</div>


</blockquote></div></div>