[crac] RFR: 8373781: [CRaC] Permit -XX:CPUFeatures on other platforms

Timofei Pushkin tpushkin at openjdk.org
Mon Dec 22 14:58:05 UTC 2025


On Wed, 17 Dec 2025 10:26:55 GMT, Radim Vansa <rvansa at openjdk.org> wrote:

> Currently `-XX:CPUFeatures` option is available only on `x86_64`. This complicates creating multiarch container images that are meant to be universally runnable (with `-XX:CPUFeatures=generic`).
> 
> I propose to make this option available on all architectures, with the non-arch specific values:
> * `generic`
> * `native`
> * `ignore`
> 
> The implementation on non-x86_64 will only validate the sanity of the value.
> 
> The related option `-XX:+ShowCPUFeatures` will print an informative message (saying that the option does not make much sense).
> 
> `-XX:+IgnoreCPUFeatures` will be permitted as well, but it will be a no-op on the other architectures.

Implementation LGTM, but we have non-x86 machines in CI so it makes sense to add a test for this

src/hotspot/share/runtime/abstract_vm_version.cpp line 414:

> 412:   }
> 413:   if (!FLAG_IS_DEFAULT(ShowCPUFeatures)) {
> 414:     tty->print_cr("This architecture does not support any arch-specific strings.");

I think the message should indicate that it is about CPU features. Otherwise it is not obvious.
Suggestion:

    tty->print_cr("Showing and controlling CPU features is not supported on this architecture.");

src/java.base/share/man/java.md line 1886:

> 1884: `-XX:CPUFeatures=`*features*
> 1885: :   Limit set of CPU features to make the CRaC image compatible for running
> 1886:     on a machine with different CPU:

Nitpicking: "Limit **the** set of CPU features to make the CRaC image compatible for running on a machine with **a** different CPU:"

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

PR Review: https://git.openjdk.org/crac/pull/282#pullrequestreview-3604360310
PR Review Comment: https://git.openjdk.org/crac/pull/282#discussion_r2640111675
PR Review Comment: https://git.openjdk.org/crac/pull/282#discussion_r2640130178


More information about the crac-dev mailing list