openjdk 20 crash on linux kernel 5.19, because it can not support huge VM?
jiangfeilong
jiangfeilong at huawei.com
Thu Nov 24 13:16:17 UTC 2022
Hi,
I’m trying to get satp mode on QEMU-USER, QEMU-SYSTEM and
hardware (HiFive Unmatched) by reading /proc/cpuinfo.
Turns out we can only get mmu info on QEMU-SYSTEM and hardware.
QEMU-USER will return empty string when reading /proc/cpuinfo.
Any ideas about that?
Here are the outputs:
QEMU-USER:
$ /riscv-qemu/bin/qemu-riscv64 -L ~/riscv-sysroot/ release/images/jdk/bin/java -version
stap mode:
openjdk version "20" 2022-11-24
OpenJDK Runtime Environment OpenJDK (build 20)
OpenJDK 64-Bit Server VM OpenJDK (build 20, mixed mode)
QEMU-SYSTEM
[root at fedora-riscv ~]# jdk-satp/bin/java -version
vm_mode: sv48
stap mode: sv48
openjdk version "20" 2022-11-24
OpenJDK Runtime Environment OpenJDK (build 20)
OpenJDK 64-Bit Server VM OpenJDK (build 20, mixed mode)
HiFive Unmatched:
$ jdk-satp/bin/java -version
vm_mode: sv39
uarch: sifive,u74-mc
stap mode: sv39
openjdk version "20" 2022-11-24
OpenJDK Runtime Environment OpenJDK (build 20)
OpenJDK 64-Bit Server VM OpenJDK (build 20, mixed mode)
From: riscv-port-dev <riscv-port-dev-retn at openjdk.org> On Behalf Of yangfei at iscas.ac.cn
Sent: Thursday, November 24, 2022 6:16 PM
To: Ludovic Henry <ludovic at rivosinc.com>
Cc: Vladimir Kempik <vladimir.kempik at gmail.com>; Zixian Cai <zixian.cai at anu.edu.au>; riscv-port-dev at openjdk.org; Ze Zhang <zhangze.linux at gmail.com>
Subject: Re: Re: openjdk 20 crash on linux kernel 5.19, because it can not support huge VM?
I think at this stage we should do some detection for sv57+ at JVM startup time and explicitly issue a warning and stop early.
That would be better and more elegant than simply crashing the JVM afterwards.
I see this kind of information is availble on linux-riscv64 at /proc/cpuinfo:
$ cat /proc/cpuinfo
processor : 0
hart : 1
isa : rv64imafdc
mmu : sv39
uarch : sifive,u74-mc
Regards,
Fei
-----Original Messages-----
From:"Ludovic Henry" <ludovic at rivosinc.com<mailto:ludovic at rivosinc.com>>
Sent Time:2022-11-24 07:25:19 (Thursday)
To: "Vladimir Kempik" <vladimir.kempik at gmail.com<mailto:vladimir.kempik at gmail.com>>
Cc: "Zixian Cai" <zixian.cai at anu.edu.au<mailto:zixian.cai at anu.edu.au>>, "riscv-port-dev at openjdk.org<mailto:riscv-port-dev at openjdk.org>" <riscv-port-dev at openjdk.org<mailto:riscv-port-dev at openjdk.org>>, "Ze Zhang" <zhangze.linux at gmail.com<mailto:zhangze.linux at gmail.com>>
Subject: Re: openjdk 20 crash on linux kernel 5.19, because it can not support huge VM?
Hi,
We are currently working on contributing to Qemu a command-line option to disable/enable certain modes in Qemu. I'll keep you posted as soon as I've anything material to share.
The solution on the OpenJDK should IMO to probe at startup for the satp mode (sv39/sv48/sv57/sv64) and generate the appropriate and cheapest movptr according to this value. I wouldn't want to pay the full cost of sv57 or sv64 while no existing boards or hardware even support anything more than sv48. Especially given the current discussions in RISC-V on reducing the cost of auipc/jalr, movptr, and trampolines.
Thanks,
Ludovic
On Wed, Nov 23, 2022 at 9:33 AM Vladimir Kempik <vladimir.kempik at gmail.com<mailto:vladimir.kempik at gmail.com>> wrote:
Hello
A kind of workaround for this case
disable sv57 csr and rebuild qemu - https://github.com/qemu/qemu/blob/master/target/riscv/csr.c#L1027 put 0 here
Regards, Vladimir
23 нояб. 2022 г., в 04:08, Zixian Cai <zixian.cai at anu.edu.au<mailto:zixian.cai at anu.edu.au>> написал(а):
This has been discussed in a previous thread. https://mail.openjdk.org/pipermail/riscv-port-dev/2022-September/000636.html
I agree that it would be nice to support different modes. Although with the patches in QEMU/Kernel that can restrict the OS to run with sv39/sv48 only, and the fact that there are not enough real hardware board supporting above sv48, I don’t know whether there will be sufficient motivation to fix the problem in the short term.
Also worth noting until very recently (Intel implemented 5-level paging around the release of Ice Lake), x86_64 has been staying 48 bits a for long time.
Sincerely,
Zixian
On 23/11/2022, 11:58, "riscv-port-dev" <riscv-port-dev-retn at openjdk.org<mailto:riscv-port-dev-retn at openjdk.org>> wrote:
hi,
openjdk 20 crash on linux kernel 5.19, because it can not support huge VM?
but I think openjdk as a application, it should not has any limitation on virtual address length,
even if it has very close relationship with hardware, just as qemu should not depend on hardware VM size, it's none of business for an application, because all other apps can run very well.
when will it support the newest kernel and qemu?
https://groups.google.com/a/groups.riscv.org/g/sw-dev/c/pILY0WGHhOs
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/riscv-port-dev/attachments/20221124/4e56489e/attachment-0001.htm>
More information about the riscv-port-dev
mailing list