Integrated: 8368366: RISC-V: AlignVector is mistakenly set to AvoidUnalignedAccesses

Fei Yang fyang at openjdk.org
Wed Sep 24 11:34:09 UTC 2025


On Tue, 23 Sep 2025 07:21:47 GMT, Fei Yang <fyang at openjdk.org> wrote:

> Hi, please consider this small change fixing setting of `AlignVector` flag on RISC-V.
> 
> According to the latest RISC-V linux hardware probing syscall [1], the performance of misaligned memory accesses
> has been divided into two cases: `RISCV_HWPROBE_KEY_MISALIGNED_SCALAR_PERF` and `RISCV_HWPROBE_KEY_MISALIGNED_VECTOR_PERF`
> for scalar and vector respectively. And `RISCV_HWPROBE_KEY_CPUPERF_0` is now deprecated and it returns similar values
> to `RISCV_HWPROBE_KEY_MISALIGNED_SCALAR_PERF`.
> 
> Previously, we use `RISCV_HWPROBE_KEY_CPUPERF_0` to detect support for misaligned memory accesses and reflect the result
> on these VM flags: `AvoidUnalignedAccesses`, `UseUnalignedAccesses` and `AlignVector`. But it doesn't seem correct to update
> `AlignVector` according to this value. And this is causing issues on RISC-V hardwares which have fast misaligned accesses only
> for the scalar case. I witnessed SIGBUG error on these hardwares when doing vector misaligned accesses.
> 
> So we should align AlignVector with `RISCV_HWPROBE_KEY_MISALIGNED_VECTOR_PERF` instead. This patch just reverts the previous
> setting of AlignVector and just let it have the default value which is true. I will try to add detection in a separate PR
> for `RISCV_HWPROBE_KEY_MISALIGNED_VECTOR_PERF` and update `AlignVector` accordingly.
> 
> [1] https://docs.kernel.org/arch/riscv/hwprobe.html

This pull request has now been integrated.

Changeset: 2313f8e4
Author:    Fei Yang <fyang at openjdk.org>
URL:       https://git.openjdk.org/jdk/commit/2313f8e4ebe5b6d7542fa8a33fd08673cc0caf10
Stats:     4 lines in 1 file changed: 0 ins; 4 del; 0 mod

8368366: RISC-V: AlignVector is mistakenly set to AvoidUnalignedAccesses

Reviewed-by: fjiang, rehn, mli

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

PR: https://git.openjdk.org/jdk/pull/27445


More information about the hotspot-dev mailing list