From d5d486a1b7fa29739d63fd0eb4a3b5909d20f01c Mon Sep 17 00:00:00 2001 From: Robbin Ehn Date: Wed, 22 Jan 2025 16:11:23 +0100 Subject: [PATCH 1/3] No V <6.9 --- 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 10652660c7362..6db01234cd6b0 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.9. + long major, minor; + os::Linux::kernel_version(&major, &minor); + if (!(major > 6 || (major == 6 && minor >= 9))) { + LogMessage(os) log; + if (log.is_info()) { + log.info("Linux kernels before 6.9 (current %ld.%ld) have a known bug when using Vector and signals.", major, minor); + 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(); From d7a645a60f98b58c1e5c0c590af77b1505fddbc4 Mon Sep 17 00:00:00 2001 From: Robbin Ehn Date: Mon, 27 Jan 2025 08:37:10 +0100 Subject: [PATCH 2/3] Update for merge --- src/hotspot/os_cpu/linux_riscv/riscv_hwprobe.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/hotspot/os_cpu/linux_riscv/riscv_hwprobe.cpp b/src/hotspot/os_cpu/linux_riscv/riscv_hwprobe.cpp index 6db01234cd6b0..69019456d1d9b 100644 --- a/src/hotspot/os_cpu/linux_riscv/riscv_hwprobe.cpp +++ b/src/hotspot/os_cpu/linux_riscv/riscv_hwprobe.cpp @@ -165,10 +165,10 @@ 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)) { - // Linux signal return bug when using vector with vlen > 128b in pre 6.9. - long major, minor; - os::Linux::kernel_version(&major, &minor); - if (!(major > 6 || (major == 6 && minor >= 9))) { + // 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.9 (current %ld.%ld) have a known bug when using Vector and signals.", major, minor); From 0b2e26c0e9f4885d3c2d4e46e9560a3510366343 Mon Sep 17 00:00:00 2001 From: Robbin Ehn Date: Mon, 27 Jan 2025 08:50:17 +0100 Subject: [PATCH 3/3] Fixed log --- src/hotspot/os_cpu/linux_riscv/riscv_hwprobe.cpp | 2 +- 1 file changed, 1 insertion(+), 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 69019456d1d9b..5b427693a8dfd 100644 --- a/src/hotspot/os_cpu/linux_riscv/riscv_hwprobe.cpp +++ b/src/hotspot/os_cpu/linux_riscv/riscv_hwprobe.cpp @@ -171,7 +171,7 @@ void RiscvHwprobe::add_features_from_query_result() { 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.9 (current %ld.%ld) have a known bug when using Vector and signals.", major, minor); + 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 {