8348384: RISC-V: Disable auto-enable Vector on buggy kernels

Reviewed-by: fyang, mli, luhenry
This commit is contained in:
Robbin Ehn 2025-01-28 07:35:30 +00:00
parent 46f48e4e3d
commit 2537a05c06

View File

@ -24,6 +24,8 @@
*/
#include "logging/log.hpp"
#include "logging/logMessage.hpp"
#include "os_linux.hpp"
#include "riscv_hwprobe.hpp"
#include "runtime/os.hpp"
#include "runtime/vm_version.hpp"
@ -163,7 +165,18 @@ void RiscvHwprobe::add_features_from_query_result() {
VM_Version::ext_C.enable_feature();
}
if (is_set(RISCV_HWPROBE_KEY_IMA_EXT_0, RISCV_HWPROBE_IMA_V)) {
VM_Version::ext_V.enable_feature();
// Linux signal return bug when using vector with vlen > 128b in pre 6.8.5.
long major, minor, patch;
os::Linux::kernel_version(&major, &minor, &patch);
if (os::Linux::kernel_version_compare(major, minor, patch, 6, 8, 5) == -1) {
LogMessage(os) log;
if (log.is_info()) {
log.info("Linux kernels before 6.8.5 (current %ld.%ld.%ld) have a known bug when using Vector and signals.", major, minor, patch);
log.info("Vector not enabled automatically via hwprobe, but can be turned on with -XX:+UseRVV.");
}
} else {
VM_Version::ext_V.enable_feature();
}
}
if (is_set(RISCV_HWPROBE_KEY_IMA_EXT_0, RISCV_HWPROBE_EXT_ZBA)) {
VM_Version::ext_Zba.enable_feature();