Re: [PATCH v5 1/8] x86/bugs: Allow forcing Automatic IBRS with SNP active using spectre_v2=eibrs

From: Borislav Petkov

Date: Thu Sep 03 2026 - 00:07:17 EST


On Wed, Aug 26, 2026 at 05:35:03PM -0500, Kim Phillips wrote:
> spectre_v2=eibrs currently enables retpolines when SNP is enabled,
> instead of AutoIBRS (EIBRS) because the commit that disabled
> AutoIBRS if SNP is enabled stopped short of enabling
> X86_FEATURE_IBRS_ENHANCED.

This and the comment below in spectre_v2_select_mitigation() is somewhat
hinting on what you're trying to do here, and I can only guess. But
I shouldn't be guessing. Rather, the text should explain it clearly.

> Change the logic to enable X86_FEATURE_IBRS_ENHANCED, and move the
> decision to switch to retpolines in the default/"auto" case in
> spectre_v2_select_mitigation(). This allows the existing
> spectre_v2=eibrs logic to work as intended.
>
> Condition that switch on CONFIG_MITIGATION_RETPOLINE being built in.
> Otherwise spectre_v2_select_retpoline() returns SPECTRE_V2_NONE and an
> SNP host with AutoIBRS available would be left completely unmitigated
> against Spectre v2 in the default/auto case, which is worse than the
> userspace indirect branch performance loss AutoIBRS costs.
>
> Also emit a performance loss warning for using AutoIBRS with SNP
> enabled. AutoIBRS is activated for all three eIBRS modes via
> spectre_v2_in_eibrs_mode(), so use that helper to cover
> spectre_v2=eibrs, spectre_v2=eibrs,lfence, and
> spectre_v2=eibrs,retpoline uniformly. Word the warning in terms of the
> eIBRS mitigation enabling AutoIBRS, rather than naming AutoIBRS as the
> selected mitigation, so it reads correctly for the ,lfence and
> ,retpoline variants where another component is also active.

This whole text is explaining the diff. Never write about the "what" - but the
"why". Why does this patch exist?

Please structure your commit message something like this:

1. Prepare the context for the explanation briefly.

2. Explain the problem at hand.

3. "It happens because of <...>"

4. "Fix it by doing X"

5. "(Potentially do Y)."

And some of those above are optional depending on the issue being
explained.

But do not explain the patch. If there are questions about it, I will ask.

Thx.

--
Regards/Gruss,
Boris.

https://people.kernel.org/tglx/notes-about-netiquette