[crac] RFR: 8373784: [CRaC] VM Option to require perfect CPU fit [v2]

Timofei Pushkin tpushkin at openjdk.org
Thu Jan 8 09:47:16 UTC 2026


On Wed, 7 Jan 2026 15:37:43 GMT, Radim Vansa <rvansa at openjdk.org> wrote:

>> Right now CRaC will refuse to restore from the image if it is not compatible with current CPU as it assumes extra features. This check can be only relaxed with -XX:+UnlockExperimentalVMOptions -XX:+IgnoreCPUFeatures.
>> 
>> In scenarios with -XX:CRaCIgnoreRestoreIfUnavailable it might be favorable to skip the restore and proceed with running the application from scratch with all CPU features if the image has these restricted. Therefore I propose to create a new option -XX:CheckCPUFeatures with these values:
>> * compatible - this is the current behaviour (default)
>> * exact - require CPU features from the image to match perfectly
>> * skip - the same behaviour as `-XX:+IgnoreCPUFeatures`.
>> 
>> The current `-XX:+IgnoreCPUFeatures` option will be deprecated.
>
> Radim Vansa has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Minor fixups

src/hotspot/share/runtime/arguments.cpp line 584:

> 582:   { "CRaCAllowToSkipCheckpoint",    JDK_Version::jdk(25), JDK_Version::jdk(26), JDK_Version::jdk(27) },
> 583:   { "CRaCDoThrowCheckpointException", JDK_Version::undefined(), JDK_Version::jdk(25), JDK_Version::jdk(26) },
> 584:   { "IgnoreCPUFeatures",            JDK_Version::jdk(26), JDK_Version::jdk(29), JDK_Version::undefined() },

1. I would really prefer the expiration version to be set because each entry in this least slows down VM option parsing a bit.
2. Obsoleting in 29 seems too generous. Since `IgnoreCPUFeatures` was experimental, per the guide above even obsoleting it right away is acceptable. I would suggest either 26, 27, 28 or 26, 28, 29. As can be seen above, the latter would match what we have been doing historically for non-experimental options.

src/hotspot/share/runtime/arguments.cpp line 4081:

> 4079:     }
> 4080:   }
> 4081: 

Does not matter functionally, but semantically I think this should be in `check_vm_args_consistency` and use `FLAG_SET_CMDLINE` instead of `FLAG_SET_ERGO`.

src/hotspot/share/runtime/crac.cpp line 823:

> 821:       log_error(crac)("-XX:CheckCPUFeatures=skip is allowed only with -XX:+UnlockExperimentalVMOptions");
> 822:       return;
> 823:     }

Better to do this in `Arguments::check_vm_args_consistency`

src/hotspot/share/runtime/crac.cpp line 828:

> 826:     exact = true;
> 827:   } else if (strcmp(CheckCPUFeatures, "compatible")) {
> 828:     log_error(crac)("Invalid value for -XX:CheckCPUFeatures=%s; available are 'compatible', 'exact' or 'skip'", CheckCPUFeatures);

Nitpick: I think having `CheckCPUFeatures == nullptr || !strcmp(CheckCPUFeatures, "compatible")` as the first check and just `else` here would be more readable

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

PR Review Comment: https://git.openjdk.org/crac/pull/285#discussion_r2671546690
PR Review Comment: https://git.openjdk.org/crac/pull/285#discussion_r2671615423
PR Review Comment: https://git.openjdk.org/crac/pull/285#discussion_r2671626492
PR Review Comment: https://git.openjdk.org/crac/pull/285#discussion_r2671637816


More information about the crac-dev mailing list