JDK-8364296 : Set IntelJccErratumMitigation flag ergonomically
  • Type: Enhancement
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: 17,21,25,26
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2025-07-29
  • Updated: 2025-09-14
  • Resolved: 2025-08-01
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 26
26 b10Fixed
Related Reports
Causes :  
Relates :  
Description
JDK-8234160 implemented the mitigation feature and JDK-8240370 provided the JVM flag to opt-out of it. Unfortunately, current implementation does not set the flag ergonomically, instead it just sets the internal `VM_Version` flag. So we end up in a situation where we have *no* visibility whether the mitigation is actually enabled or not. More confusingly, the option would say `true` for machines where ergonomics does not enable the mitigation.

```
% build/linux-x86_64-server-release/images/jdk/bin/java -XX:+UnlockDiagnosticVMOptions -XX:+PrintFlagsFinal 2>&1 | grep IntelJcc 
     bool IntelJccErratumMitigation                = true      

% lscpu
...
Model name:          AMD EPYC 9R14
```

It would be good to set the flag value itself ergonomically.

Something simple might do:

```
diff --git a/src/hotspot/cpu/x86/vm_version_x86.cpp b/src/hotspot/cpu/x86/vm_version_x86.cpp
index 42661bd7a2b..baeea79e7ea 100644
--- a/src/hotspot/cpu/x86/vm_version_x86.cpp
+++ b/src/hotspot/cpu/x86/vm_version_x86.cpp
@@ -1068,7 +1068,9 @@ void VM_Version::get_processor_features() {
   }
 
   if (FLAG_IS_DEFAULT(IntelJccErratumMitigation)) {
-    _has_intel_jcc_erratum = compute_has_intel_jcc_erratum();
+    bool r = compute_has_intel_jcc_erratum();
+    _has_intel_jcc_erratum = r;
+    FLAG_SET_ERGO(IntelJccErratumMitigation, r);
   } else {
     _has_intel_jcc_erratum = IntelJccErratumMitigation;
   }
```

Or, maybe purge the `VM_Version::_has_intel_jcc_erratum` completely, and replace it with `IntelJccErratumMitigation` checks.
Comments
[jdk25u-fix-request] Approval Request from Rui Li A clean backport for https://bugs.openjdk.org/browse/JDK-8337679 Add visibility of flag IntelJccErratumMitigation. In tip for around 1 month.
12-09-2025

A pull request was submitted for review. Branch: master URL: https://git.openjdk.org/jdk25u/pull/195 Date: 2025-09-12 19:51:55 +0000
12-09-2025

Changeset: 6c580472 Branch: master Author: Oli Gillespie <ogillespie@openjdk.org> Committer: Aleksey Shipilev <shade@openjdk.org> Date: 2025-08-01 10:27:08 +0000 URL: https://git.openjdk.org/jdk/commit/6c5804722b5b2064e0d6ade2180c3126d8f2dabc
01-08-2025

A pull request was submitted for review. Branch: master URL: https://git.openjdk.org/jdk/pull/26560 Date: 2025-07-30 16:27:42 +0000
30-07-2025