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

Ze Zhang zhangze.linux at gmail.com
Sat Nov 26 04:48:22 UTC 2022


but I think there is a error about this part of the patch:

diff --git a/target/riscv/csr.c b/target/riscv/csr.c
index 5c9a7ee287..d26b830f1a 100644
--- a/target/riscv/csr.c
+++ b/target/riscv/csr.c
@@ -1109,10 +1109,12 @@ static RISCVException read_mstatus(CPURISCVState
*env,
int csrno,

 static int validate_vm(CPURISCVState *env, target_ulong vm)
 {
+    vm &= 0xf;
+
     if (riscv_cpu_mxl(env) == MXL_RV32) {
-        return valid_vm_1_10_32[vm & 0xf];
+        return valid_vm_1_10_32[vm] && (vm
<=RISCV_CPU(env_cpu(env))->cfg.satp_mode);
     } else {
-        return valid_vm_1_10_64[vm & 0xf];
+        return valid_vm_1_10_64[vm] && (vm
<=RISCV_CPU(env_cpu(env))->cfg.satp_mode);
     }
 }

maybe it should be:

 static int validate_vm(CPURISCVState *env, target_ulong vm)
 {
+    vm &= 0xf;
+
     if (riscv_cpu_mxl(env) == MXL_RV32) {
-        return valid_vm_1_10_32[vm & 0xf];
+        if (vm <= RISCV_CPU(env_cpu(env))->cfg.satp_mode)
+        {
+            return valid_vm_1_10_32[vm];
+        } else {
+             return 0;
+         }
     } else {
-        return valid_vm_1_10_64[vm & 0xf];
+        if (vm <= RISCV_CPU(env_cpu(env))->cfg.satp_mode)
+        {
+            return valid_vm_1_10_64[vm];
+        } else {
+             return 0;
+        }
     }
 }


Ludovic Henry <ludovic at rivosinc.com> 于2022年11月26日周六 09:49写道:

> The more proper fix in QEMU is being upstreamed with
> https://lists.gnu.org/archive/html/qemu-riscv/2022-11/msg00105.html
>
> On Sat, Nov 26, 2022 at 1:06 AM Ze Zhang <zhangze.linux at gmail.com> wrote:
>
>> yes,
>>
>> all I have tried in the previous mail is about user-mode, because ONLY
>> run linux kernel 5.19 on qemu 7.10 system mode, we can get a SV57 VM, so I
>> run qemu system mode first, then in qemu system mode environment, run
>> qemu-riscv64 user-mode cmdline, which means run qemu user mode in a qemu
>> system mode linux system, otherwise test is not for SV57.
>> openjdk team should do the detail test about this, I only care about qemu
>> system mode.
>>
>> sincerely
>>
>> Vladimir Kempik <vladimir.kempik at gmail.com> 于2022年11月25日周五 17:56写道:
>>
>>> Hello
>>>
>>>  run qemu-riscv64 -L  xxxx   /usr/bin/java -version, result
>>> is Segmentation fault,
>>>
>>>
>>> That’s actually user-mode, isn’t it ?
>>>
>>> Regards, Vladimir
>>>
>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/riscv-port-dev/attachments/20221126/e598e0d6/attachment-0001.htm>


More information about the riscv-port-dev mailing list