RFR: 8321972: test runtime/Unsafe/InternalErrorTest.java timeout on linux-riscv64 platform

Gui Cao gcao at openjdk.org
Wed Dec 20 02:42:36 UTC 2023


On Thu, 14 Dec 2023 09:50:54 GMT, Fei Yang <fyang at openjdk.org> wrote:

>> As described on the JBS issue, JDK-8320886 extended InternalErrorTest.java adding extra test for Unsafe_SetMemory0 trying to access next page after truncation. This triggers SIGBUS error and control flow is transfered to JVM signal handler [1]. But the current logic doesn't consider 16-bit compressed instructions when calculating next_pc. It always add NativeCall::instruction_size which is 4 to pc and use the result as next_pc. This is not correct as the memset invoked in this case contains compressed instructions and it is those instructions that are triggering the SIGBUS error.
>> 
>> The proposed fix is similar with other platform with variable-length instruction encoding like x86.
>> The encoding of the instruction triggering the SIGBUS error is checked to see if it is a compressed instruction and then calculate next_pc based on that. The test case can now pass normally with this fix. 
>> 
>> [1] https://github.com/openjdk/jdk/blob/master/src/hotspot/os_cpu/linux_riscv/os_linux_riscv.cpp#L274
>> 
>> ### Testing:
>> - [x]  Run tier1-3 tests on qemu 8.1.50 with UseRVV (release)
>
> Looks reasonable to me. I find that the native GNU compiler toolchain on both my unmatched and licheepi-4a boards are compiling with RVC by default, which means native JDK builds on those hardware platforms will also have compressed instructions.

@RealFYang : Thanks for taking a look. If there is no other comment, I will proceed to integrate.

-------------

PR Comment: https://git.openjdk.org/jdk/pull/17103#issuecomment-1863763236


More information about the hotspot-dev mailing list