RFR: 8309258: RISC-V: Add riscv_hwprobe syscall [v3]

Fei Yang fyang at openjdk.org
Thu Jun 15 05:54:57 UTC 2023


On Wed, 14 Jun 2023 14:24:06 GMT, Robbin Ehn <rehn at openjdk.org> wrote:

>> Hi, please consider.
>> 
>> Linux kernel 6.4 will come with the new syscall https://docs.kernel.org/riscv/hwprobe.html to determine CPU and features.
>> RV cpus features/capabilities can vastly differ and it is not feasible for users to manually enable the correct feature set.
>> Today the VM uses the ELF aux vector and cpuinfo to gather some information about CPU capabilities.
>> 
>> Currently features are track with a bit field, this is insufficient.
>> There are many capabilities and these can have values attached to them.
>> CPU features should also be possible to turn if we can determine vendor (hwprobe).
>> 
>> This patchs adds the syscall, uses the syscall in combination with the aux and cpuinfo to enable features by default.
>> If there is a vendor specific path it calls that in addition.
>> Then we build the feature string(and bit field) and update flags accordingly.
>> 
>> Tested t1 and hwprobe with:
>> https://lore.kernel.org/qemu-devel/7f8d733df6e9b6151e9efb843d55441348805e70.camel@rivosinc.com/
>
> Robbin Ehn has updated the pull request incrementally with one additional commit since the last revision:
> 
>   updated after review comments

I tried to do a native release build on HiFive Unmatched board with the latest version and unfortunately I got SIGILL problem:

#
# A fatal error has been detected by the Java Runtime Environment:
#
#  SIGILL (0x4) at pc=0x0000003f9053eb34, pid=64268, tid=64273
#
# JRE version:  (22.0) (build )
# Java VM: OpenJDK 64-Bit Server VM (22-internal-adhoc.fyang.jdk, mixed mode, tiered, compressed oops, compressed class ptrs, g1 gc, linux-riscv64)
# Problematic frame:
#
[error occurred during error reporting (printing problematic frame), id 0xb, SIGSEGV (0xb) at pc=0x0000003f9df03b0e]
# 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/fyang/jdk/make/core.64268)
#
#

---------------  S U M M A R Y ------------

Command Line: -Xms64M -Xmx1600M --add-exports=java.base/jdk.internal.module=ALL-UNNAMED build.tools.jigsaw.AddPackagesAttribute /home/fyang/jdk/build/linux-riscv64-server-release/jdk

Host: RISCV64, 4 cores, 15G, Ubuntu 22.04.2 LTS
Time: Thu Jun 15 13:11:35 2023 CST elapsed time: 0.209789 seconds (0d 0h 0m 0s)

-------------

PR Comment: https://git.openjdk.org/jdk/pull/14445#issuecomment-1592411047


More information about the hotspot-dev mailing list