[crac] RFR: RFC: -XX:CPUFeatures=0xnumber for CPU migration [v22]

Jan Kratochvil jkratochvil at openjdk.org
Tue May 30 17:03:51 UTC 2023


On Fri, 26 May 2023 15:17:25 GMT, Anton Kozlov <akozlov at openjdk.org> wrote:

>> Jan Kratochvil has updated the pull request incrementally with four additional commits since the last revision:
>> 
>>  - refactor
>>  - refactor
>>  - refactor
>>  - Fix el7 compatibility.
>
> src/hotspot/cpu/x86/vm_version_x86.cpp line 1297:
> 
>> 1295:   }
>> 1296: 
>> 1297:   glibc_not_using((CPU_MAX - 1) & ~_features, (GLIBC_MAX - 1) & ~_glibc_features);
> 
> Apparently this triggers re-exec even with default command line parameters, which does not look expected, see below.
> 
> Also, we need a way to disable CPU feature reduction as a workaround to possible bugs in the implementation.
> 
> 
> $ ./build/linux-x86_64-server-release/images/jdk/bin/java -XX:+ShowCPUFeatures -version
> This machine's CPU features are: -XX:CPUFeatures=0x61805fdfbff,0x1e6
> Re-exec of java with new environment variable: GLIBC_TUNABLES=:glibc.cpu.hwcaps=,-RTM,-AVX512F,-AVX512CD,-AVX512BW,-AVX512DQ,-AVX512ER,-AVX512PF,-AVX512VL,-IBT,-FMA4,-SHSTK
> This machine's CPU features are: -XX:CPUFeatures=0x61805fdfbff,0x1e6
> Environment variable already set, both glibc CPU_FEATURE_ACTIVE and ld.so --list-diagnostics are unavailable - re-exec suppressed: GLIBC_TUNABLES=:glibc.cpu.hwcaps=,-RTM,-AVX512F,-AVX512CD,-AVX512BW,-AVX512DQ,-AVX512ER,-AVX512PF,-AVX512VL,-IBT,-FMA4,-SHSTK
> openjdk version "17-internal" 2021-09-14
> OpenJDK Runtime Environment (build 17-internal+0-adhoc..crac)
> OpenJDK 64-Bit Server VM (build 17-internal+0-adhoc..crac, mixed mode, sharing)

I have remembered that was intentional for more safety of what jdk vs. glibc detect from CPU. I agree it is too expensive to do a jdk re-exec each time. The behavior you have seen can be now achieved by `-XX:CPUFeatures=verify`. Usefulness of this new option may not be too big.

To disable everything around the CPU features is now possible by `-XX:CPUFeatures=ignore`. I agree it may be useful if the glibc interface for these CPU features gets somehow incompatible.

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

PR Review Comment: https://git.openjdk.org/crac/pull/41#discussion_r1210569697


More information about the crac-dev mailing list