openjdk 20 crash on linux kernel 5.19, because it can not support huge VM?

Ze Zhang zhangze.linux at gmail.com
Fri Nov 25 04:16:17 UTC 2022


Only qemu 7.10 system mode + risc-v kernel 5.19 can satisfy SV57, so in
qemu system mode, run qemu-riscv64 -L  xxxx   /usr/bin/java -version,
result is Segmentation fault,

but other app also Segmentation fault:
root at qemuriscv64:~# qemu-riscv64 -L recipe-sysroot /bin/ls
Segmentation fault

even when qemu 7.10 system mode(disable sv57, so sv48 ) + risc-v kernel
5.19, result is the same,

root at qemuriscv64:~# cat /proc/cpuinfo
processor : 0
hart : 3
isa : rv64imafdch
mmu : sv48

root at qemuriscv64:~# qemu-riscv64 -L recipe-sysroot /bin/ls
Segmentation fault

I don't known whether this is qemu issue,  but no one will do this in
normal use.



Ludovic Henry <ludovic at rivosinc.com> 于2022年11月25日周五 02:01写道:

> Hi.
>
> You wouldn't have that issue in qemu user-mode except if the underlying
> architecture supports sv57+. Given x86 is sv48 and I am guessing most of us
> are using an x86 machine to run qemu on, it doesn't have that issue.
>
> On Thu, Nov 24, 2022 at 3:33 PM <yangfei at iscas.ac.cn> wrote:
>
>> Hi,
>>
>>   That's a good question. Maybe someone familiar with qemu could help
>> answer?
>>   I am not sure about how qemu-user mode works and whether it will be
>> bound to certain kernel versions.
>>   I am told by the people who raised this discussion that they are
>> actually using qemu-system mode.
>>
>> Thanks,
>> Fei
>>
>> > -----Original Messages-----
>> > From: "Vladimir Kempik" <vladimir.kempik at gmail.com>
>> > Sent Time: 2022-11-24 22:12:11 (Thursday)
>> > To: yangfei at iscas.ac.cn
>> > Cc: jiangfeilong <jiangfeilong at huawei.com>, "Ludovic Henry" <
>> ludovic at rivosinc.com>, "Zixian Cai" <zixian.cai at anu.edu.au>, "
>> riscv-port-dev at openjdk.org" <riscv-port-dev at openjdk.org>, "Ze Zhang" <
>> zhangze.linux at gmail.com>
>> > Subject: Re: openjdk 20 crash on linux kernel 5.19, because it can
>> not support huge VM?
>> >
>> > Hello
>> >
>> > Do we really have that issue (with mmu mode) in qemu-user-mode?
>> >
>> > I was running qemu7 in user mode with openjdk without any issues.
>> >
>> > Regards, Vladimir.
>> >
>> > > 24 нояб. 2022 г., в 16:43, yangfei at iscas.ac.cn написал(а):
>> > >
>> > >
>> > > Hi,
>> > >
>> > >  I guess qemu-user doesn't provide /proc/cpuinfo for us to use
>> like qemu-system.
>> > >  But it's still nice if we can enable that detection in
>> qemu-system mode or on real hardware platforms.
>> > >
>> > > Thanks,
>> > > Fei
>> > >
>> > > -----Original Messages-----
>> > > From:jiangfeilong <jiangfeilong at huawei.com>
>> > > Sent Time:2022-11-24 21:16:17 (Thursday)
>> > > To: "yangfei at iscas.ac.cn" <yangfei at iscas.ac.cn>, "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" <
>> 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?
>> > >
>> > > 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>
>> > > Sent Time:2022-11-24 07:25:19 (Thursday)
>> > > To: "Vladimir Kempik" <vladimir.kempik at gmail.com>
>> > > Cc: "Zixian Cai" <zixian.cai at anu.edu.au>, "
>> riscv-port-dev at openjdk.org" <riscv-port-dev at openjdk.org>, "Ze Zhang" <
>> 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> 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>
>> написал(а):
>> > >
>> > >
>> > >           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> 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
>> &gt
>> <https://groups.google.com/a/groups.riscv.org/g/sw-dev/c/pILY0WGHhOs&gt>;
>> >
>> > >
>> > > </riscv-port-dev-retn at openjdk.org></zixian.cai at anu.edu.au></
>> vladimir.kempik at gmail.com></zhangze.linux at gmail.com></
>> riscv-port-dev at openjdk.org></zixian.cai at anu.edu.au></
>> vladimir.kempik at gmail.com></ludovic at rivosinc.com></
>> zhangze.linux at gmail.com></zixian.cai at anu.edu.au></
>> vladimir.kempik at gmail.com></ludovic at rivosinc.com></
>> riscv-port-dev-retn at openjdk.org></zhangze.linux at gmail.com></
>> riscv-port-dev at openjdk.org></zixian.cai at anu.edu.au></
>> vladimir.kempik at gmail.com></ludovic at rivosinc.com></yangfei at iscas.ac.cn></
>> jiangfeilong at huawei.com>
>> </zhangze.linux at gmail.com></riscv-port-dev at openjdk.org></
>> zixian.cai at anu.edu.au></ludovic at rivosinc.com></jiangfeilong at huawei.com></
>> vladimir.kempik at gmail.com>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/riscv-port-dev/attachments/20221125/448febec/attachment-0001.htm>


More information about the riscv-port-dev mailing list