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

Fei Yang fyang at openjdk.org
Thu Dec 14 09:53:38 UTC 2023


On Thu, 14 Dec 2023 08:28:42 GMT, Gui Cao <gcao 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:
> - [ ]  Run tier1-3 tests on qemu 8.1.50 with UseRVV (release)

That make sense 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.

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

Marked as reviewed by fyang (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/17103#pullrequestreview-1781437272


More information about the hotspot-dev mailing list