Skip to content

Commit 2537a05

Browse files
committed
8348384: RISC-V: Disable auto-enable Vector on buggy kernels
Reviewed-by: fyang, mli, luhenry
1 parent 46f48e4 commit 2537a05

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

src/hotspot/os_cpu/linux_riscv/riscv_hwprobe.cpp

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@
2424
*/
2525

2626
#include "logging/log.hpp"
27+
#include "logging/logMessage.hpp"
28+
#include "os_linux.hpp"
2729
#include "riscv_hwprobe.hpp"
2830
#include "runtime/os.hpp"
2931
#include "runtime/vm_version.hpp"
@@ -163,7 +165,18 @@ void RiscvHwprobe::add_features_from_query_result() {
163165
VM_Version::ext_C.enable_feature();
164166
}
165167
if (is_set(RISCV_HWPROBE_KEY_IMA_EXT_0, RISCV_HWPROBE_IMA_V)) {
166-
VM_Version::ext_V.enable_feature();
168+
// Linux signal return bug when using vector with vlen > 128b in pre 6.8.5.
169+
long major, minor, patch;
170+
os::Linux::kernel_version(&major, &minor, &patch);
171+
if (os::Linux::kernel_version_compare(major, minor, patch, 6, 8, 5) == -1) {
172+
LogMessage(os) log;
173+
if (log.is_info()) {
174+
log.info("Linux kernels before 6.8.5 (current %ld.%ld.%ld) have a known bug when using Vector and signals.", major, minor, patch);
175+
log.info("Vector not enabled automatically via hwprobe, but can be turned on with -XX:+UseRVV.");
176+
}
177+
} else {
178+
VM_Version::ext_V.enable_feature();
179+
}
167180
}
168181
if (is_set(RISCV_HWPROBE_KEY_IMA_EXT_0, RISCV_HWPROBE_EXT_ZBA)) {
169182
VM_Version::ext_Zba.enable_feature();

0 commit comments

Comments
 (0)