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

Fei Yang fyang at openjdk.org
Thu Jun 15 06:43:59 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

PS:
Checking the flags with -XX:+PrintFlagsFinal, looks like this will enable some features which are not available on this board.

fyang at ubuntu:~/jdk$ ./build/linux-riscv64-server-release/jdk/bin/java -XX:+PrintFlagsFinal -XX:+UnlockExperimentalVMOptions -version &> ~/flags.txt
Aborted (core dumped)

fyang at ubuntu:~/jdk$ grep "ARCH experimental" ~/flags.txt
     bool UseRVA22U64                              = false                           {ARCH experimental} {default}
     bool UseRVV                                   = false                           {ARCH experimental} {default}
     bool UseZba                                   = true                            {ARCH experimental} {default}
     bool UseZbb                                   = true                            {ARCH experimental} {default}
     bool UseZbs                                   = true                            {ARCH experimental} {default}
     bool UseZic64b                                = true                            {ARCH experimental} {default}
     bool UseZicbom                                = true                            {ARCH experimental} {default}
     bool UseZicbop                                = true                            {ARCH experimental} {default}
     bool UseZicboz                                = true                            {ARCH experimental} {default}
     bool UseZihintpause                           = true                            {ARCH experimental} {default}

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

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


More information about the hotspot-dev mailing list