From 2537a05c06171ce91eae69d478c4e4e88a11a60f Mon Sep 17 00:00:00 2001 From: Robbin Ehn Date: Tue, 28 Jan 2025 07:35:30 +0000 Subject: [PATCH] 8348384: RISC-V: Disable auto-enable Vector on buggy kernels Reviewed-by: fyang, mli, luhenry --- src/hotspot/os_cpu/linux_riscv/riscv_hwprobe.cpp | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/hotspot/os_cpu/linux_riscv/riscv_hwprobe.cpp b/src/hotspot/os_cpu/linux_riscv/riscv_hwprobe.cpp index 10652660c73..5b427693a8d 100644 --- a/src/hotspot/os_cpu/linux_riscv/riscv_hwprobe.cpp +++ b/src/hotspot/os_cpu/linux_riscv/riscv_hwprobe.cpp @@ -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();