RFR: 8309258: RISC-V: Add riscv_hwprobe syscall [v8]
Ludovic Henry
luhenry at openjdk.org
Fri Jul 14 12:43:13 UTC 2023
On Fri, 14 Jul 2023 10:45:52 GMT, Dingli Zhang <dzhang at openjdk.org> wrote:
>> Robbin Ehn has updated the pull request incrementally with one additional commit since the last revision:
>>
>> removed q and zbc from rivos common features
>
> Hi, I noticed fastdebug building crashed when running `java -version` on SG2042 (64cores c910):
>
>
> $ ./java -version
> #
> # A fatal error has been detected by the Java Runtime Environment:
> #
> # SIGILL (0x4) at pc=0x0000003f73a70892, pid=347134, tid=347135
> #
> # JRE version: (22.0) (fastdebug build )
> # Java VM: OpenJDK 64-Bit Server VM (fastdebug 22-internal-adhoc.zhangdingli.jdk, mixed mode, tiered, compressed oops, compressed class ptrs, g1 gc, linux-riscv64)
> # Problematic frame:
> # v ~StubRoutines::jint_disjoint_arraycopy 0x0000003f73a70892
> #
> # Core dump will be written. Default location: Core dumps may be processed with "/usr/share/apport/apport -p%p -s%s -c%c -d%d -P%P -u%u -g%g -- %E" (or dumping to /home/perfxlab01/jdkbuild/compare/jdk_after/bin/core.347134)
> #
> # An error report file with more information is saved as:
> # /home/perfxlab01/jdkbuild/compare/jdk_after/bin/hs_err_pid347134.log
> [0.727s][warning][os] Loading hsdis library failed
> #
> #
> Aborted (core dumped)
>
> The instruct at the pc of crash is `020f6007`, which is `vle32.v v0,(t5)`.
> Complete log: https://cr.openjdk.org/~dzhang/hs_err_pid347134.log
>
> System Information:
>
> $ lsb_release -a
> No LSB modules are available.
> Distributor ID: Ubuntu
> Description: Ubuntu 22.10
> Release: 22.10
> Codename: kinetic
>
> $ uname -a
> Linux riscv-02 6.1.31 #6 SMP Tue Jul 11 18:48:27 CST 2023 riscv64 riscv64 riscv64 GNU/Linux
>
> $ cat /proc/cpuinfo
> processor : 0
> hart : 4
> isa : rv64imafdcv
> mmu : sv39
> mvendorid : 0x5b7
> marchid : 0x0
> mimpid : 0x0
> ...
>
>
> The release building `java -version` doesn't cause a crash, but when set it as JAVA_HOME and then executes `jtreg -version`, it will crash for similar reasons. We can see the flag under release building:
>
> $ ./java -XX:+PrintFlagsFinal -XX:+UnlockExperimentalVMOptions -version | grep UseRVV
> bool UseRVV = true {ARCH experimental} {default}
> bool UseRVVForBigIntegerShiftIntrinsics = true {ARCH product} {default}
>
> The problem looks like c910 only supports rvv0.7.1, while openjdk only supports rvv1.0. `UseRVV` is automatically enabled on SG2042, even though it's a experimental VMOption. Maybe we should set `UPDATE_DEFAULT(UseRVV)` to `NO_UPDATE_DEFAULT` for now or do something depending on the version of rvv?
>
> I would appreciate it if some advice is given, thank you!
@DingliZhang I expect that it gets enabled because `hwcap` sets the `V` bit to 1, which sets `ext_V.enabled = true` which, when calling `update_flags` sets `UseRVV` to true, correct?
`riscv_hwprobe` does support versioning (checking the exact details). So if anything, we should indeed not set `UseRVV` when probing via hwcap, but we _should_ set `UseRVV` when probing via hwprobe (given we have RVV 1.0 of course).
-------------
PR Comment: https://git.openjdk.org/jdk/pull/14445#issuecomment-1635806911
More information about the hotspot-dev
mailing list