RFR: 8297697: RISC-V: Add support for SATP mode detection [v2]

Fei Yang fyang at openjdk.org
Tue Nov 29 07:15:30 UTC 2022


On Tue, 29 Nov 2022 01:41:48 GMT, Feilong Jiang <fjiang at openjdk.org> wrote:

>> RISC-V gets sv57-based virtual memory support since Linux 5.18 [1]. There are some reports of the OpenJDK RISC-V port crashing on Linux 5.18+ with QEMU-system 7.10+ when sv57 was enabled [2][3] as currently RISC-V port only supports up to sv48.
>> As discussed in [3], given the fact that there are no existing boards or hardware even support anything more than sv48,
>> we decide to add detection for SATP (Supervisor Address Translation and Protection) mode at JVM startup time if possible and explicitly issue a warning and stop early when sv57 is enabled.
>> 
>> When sv57 is enabled, the output of java -version would be:
>> 
>> 
>> root at qemuriscv64:~# jdk/bin/java -version
>> Error occurred during initialization of VM
>> Unsupported satp mode: sv57
>> 
>> 
>> [1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=aa5b537b0ecc16992577b013f11112d54c7ce869
>> [2] https://mail.openjdk.org/pipermail/riscv-port-dev/2022-September/000639.html
>> [3] https://mail.openjdk.org/pipermail/riscv-port-dev/2022-November/000681.html
>> 
>> Testing:
>> 
>> - QEMU-system with sv48/sv57-enabled Linux image `-version` test
>> - HiFive Unmatched board (sv39) `-version` test
>
> Feilong Jiang has updated the pull request incrementally with one additional commit since the last revision:
> 
>   print vm mode string instead of vm mode code

src/hotspot/cpu/riscv/vm_version_riscv.cpp line 41:

> 39: 
> 40:   // check if satp.mode is supported, currently supports up to SV48(RV64)/SV32(RV32)
> 41:   if (get_satp_mode() > RISCV64_ONLY(VM_SV48) RISCV32_ONLY(VM_SV32)) {

I am not sure whether it makes sense to consider SV32 here. We only support RV32 Zero for now and haven't seen a simillar issue for it yet.

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

PR: https://git.openjdk.org/jdk/pull/11388


More information about the hotspot-dev mailing list