Re: [PATCH v4 02/10] cpu/bugs: Allow forcing Automatic IBRS with SNP active using spectre_v2=eibrs
From: Pawan Gupta
Date: Tue Aug 18 2026 - 20:19:02 EST
On Tue, Aug 04, 2026 at 06:56:03PM -0500, Kim Phillips wrote:
...
> @@ -2192,7 +2193,12 @@ static void __init spectre_v2_select_mitigation(void)
> break;
> fallthrough;
> case SPECTRE_V2_CMD_FORCE:
> - if (boot_cpu_has(X86_FEATURE_IBRS_ENHANCED)) {
> + /*
> + * Don't use AutoIBRS when SNP is enabled because it degrades
> + * host userspace indirect branch performance.
> + */
> + if (boot_cpu_has(X86_FEATURE_IBRS_ENHANCED) &&
> + !boot_cpu_has(X86_FEATURE_SEV_SNP)) {
> spectre_v2_enabled = SPECTRE_V2_EIBRS;
> break;
> }
Can we also account for retpoline availability here? If both SNP and
retpoline are available, then only avoid AutoIBRS:
case SPECTRE_V2_CMD_FORCE:
/*
* Prefer retpoline when SNP is enabled because Auto-IBRS
* degrades host userspace indirect branch performance.
*/
if (boot_cpu_has(X86_FEATURE_IBRS_ENHANCED) &&
!(boot_cpu_has(X86_FEATURE_SEV_SNP) &&
IS_ENABLED(CONFIG_MITIGATION_RETPOLINE))) {
spectre_v2_enabled = SPECTRE_V2_EIBRS;
break;
}
With this, patch 1 & 3 can be omitted. Also avoids the ping pong: we don't
want AutoIBRS -> We don't have retpoline -> Lets have AutoIBRS.