[crac] RFR: 8374491: CPUFeatures: check performance regression of AVX_Fast_Unaligned_Load

Timofei Pushkin tpushkin at openjdk.org
Mon Jan 5 19:56:15 UTC 2026


On Sun, 4 Jan 2026 23:58:39 GMT, Jan Kratochvil <jkratochvil at openjdk.org> wrote:

> A regression by [JDK-8372863](https://bugs.openjdk.org/browse/JDK-8372863).
> 
> On AWS m1.small:
> 
> bin/java -XX:+ShowCPUFeatures --version
> This machine's CPU features are: -XX:CPUFeatures=0x142000070bbdf,0x380
> CPU features being used are: -XX:CPUFeatures=0x142000070bbdf,0x380
> Re-exec of java with new environment variable: GLIBC_TUNABLES=:glibc.cpu.hwcaps=,-AVX_Fast_Unaligned_Load
> This machine's CPU features are: -XX:CPUFeatures=0x142000070bbdf,0x380
> CPU features being used are: -XX:CPUFeatures=0x142000070bbdf,0x380
> openjdk 25-internal 2025-09-16
> OpenJDK Runtime Environment (fastdebug build 25-internal-adhoc.azul.crac-git)
> OpenJDK 64-Bit Server VM (fastdebug build 25-internal-adhoc.azul.crac-git, mixed mode, sharing)
> 
> That is a needless re-exec.

src/hotspot/cpu/x86/vm_version_x86.cpp line 1201:

> 1199: #define EXCESSIVE(tunables) EXCESSIVE2(tunables, FEATURE_ACTIVE(tunables))
> 1200: // There is no CPU_FEATURE_ACTIVE() available for this symbol.
> 1201: #define EXCESSIVE_GLIBC_PREFERRED(tunables) EXCESSIVE2(tunables, !from_reexec)

`from_reexec` can now become a non-static variable inside `glibc_env_set`.

src/hotspot/cpu/x86/vm_version_x86.cpp line 1232:

> 1230:   // There is no CPU_FEATURE_ACTIVE() available for this symbol.
> 1231:   // There is no check for 'xem_xcr0_eax.bits.sse != 0 && xem_xcr0_eax.bits.ymm != 0' but FEATURE_ACTIVE(AVX) depends on it so it can be assumed.
> 1232:   EXCESSIVE2(AVX_Fast_Unaligned_Load, FEATURE_ACTIVE(OSXSAVE) && FEATURE_ACTIVE(AVX) && FEATURE_ACTIVE(AVX2));

Since we check it like this here, I'd again suggest simplifying the detection of `AVX_Fast_Unaligned_Load` in `feature_flags()` to `vm_features.supports_feature(CPU_OSXSAVE) && vm_features.supports_feature(CPU_AVX) && vm_features.supports_feature(CPU_AVX2)` (maybe with `assert(xem_xcr0_eax.bits.sse != 0 && xem_xcr0_eax.bits.ymm != 0)`), but I don't insist.

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

PR Review Comment: https://git.openjdk.org/crac/pull/283#discussion_r2660503450
PR Review Comment: https://git.openjdk.org/crac/pull/283#discussion_r2660516760


More information about the crac-dev mailing list