RFR: 8284196: RISC-V: Detect supported ISA extensions over cpuinfo
Feilong Jiang
fjiang at openjdk.org
Tue Feb 7 02:53:42 UTC 2023
Currently, `elf_hwcap` for RISC-V only sets single-letter extension bit (e.g. IMAFD).
As many standard multi-letter ISA extensions are ratified (e.g. Zba/Zbb/Zbc/Zbs),
we should find a stable way to detect and auto-enable these supported ISA extensions
in JVM. [1] has proposed a way to parse supported extensions through /proc/cpuinfo
or "riscv,isa" string of /sys/firmware/devicetree, we could detect supported extensions
in the same way.
Here is an example of /proc/cpuinfo from Ubuntu 20.04 in QEMU-SYSTEM:
ubuntu at ubuntu:~$ uname -a
Linux ubuntu 5.8.0-14-generic #16~20.04.3-Ubuntu SMP Mon Feb 1 16:33:19 UTC 2021 riscv64 riscv64 riscv64 GNU/Linux
ubuntu at ubuntu:~$ cat /proc/cpuinfo
processor : 0
hart : 2
isa : rv64imafdch_zicsr_zifencei_zihintpause_zba_zbb_zbc_zbs_sstc
mmu : sv48
1: http://lists.infradead.org/pipermail/linux-riscv/2021-November/010252.html
Testing:
- [x] `jdk/bin/java -XX:+UnlockExperimentalVMOptions -XX:+UseZihintpause -XX:+UseRVV -XX:+UseZicbop -XX:+UseZba -XX:+UseZbb -XX:+UseZbs -XX:+PrintFlagsFinal -version` with release build
-------------
Commit messages:
- code adjustment
- adjust comments
- update copyright
- add zihintpuase
- fix calling of strdup
- Detect isa extensions from cpuinfo isa string
Changes: https://git.openjdk.org/jdk/pull/12343/files
Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=12343&range=00
Issue: https://bugs.openjdk.org/browse/JDK-8284196
Stats: 210 lines in 3 files changed: 130 ins; 65 del; 15 mod
Patch: https://git.openjdk.org/jdk/pull/12343.diff
Fetch: git fetch https://git.openjdk.org/jdk pull/12343/head:pull/12343
PR: https://git.openjdk.org/jdk/pull/12343
More information about the hotspot-dev
mailing list