RE: [PATCH v3 15/35] x86/bugs: Restructure spectre_v2 mitigation

Kaplan, David
2025-02-12T16:40:52Z

[AMD Official Use Only - AMD Internal Distribution Only]

> -----Original Message-----
> From: Josh Poimboeuf <jpoimboe@kernel.org>
> Sent: Monday, February 10, 2025 7:08 PM
> To: Kaplan, David <David.Kaplan@amd.com>
> Cc: Thomas Gleixner <tglx@linutronix.de>; Borislav Petkov <bp@alien8.de>; Peter
> Zijlstra <peterz@infradead.org>; Pawan Gupta
> <pawan.kumar.gupta@linux.intel.com>; Ingo Molnar <mingo@redhat.com>; Dave
> Hansen <dave.hansen@linux.intel.com>; x86@kernel.org; H . Peter Anvin
> <hpa@zytor.com>; linux-kernel@vger.kernel.org
> Subject: Re: [PATCH v3 15/35] x86/bugs: Restructure spectre_v2 mitigation
>
> Caution: This message originated from an External Source. Use proper caution
> when opening attachments, clicking links, or responding.
>
>
> On Wed, Jan 08, 2025 at 02:24:55PM -0600, David Kaplan wrote:
> > +static void __init spectre_v2_update_mitigation(void)
> > +{
> > + if (spectre_v2_cmd == SPECTRE_V2_CMD_AUTO) {
> > + if (IS_ENABLED(CONFIG_MITIGATION_IBRS_ENTRY) &&
> > + boot_cpu_has_bug(X86_BUG_RETBLEED) &&
> > + retbleed_mitigation != RETBLEED_MITIGATION_NONE &&
> > + retbleed_mitigation != RETBLEED_MITIGATION_STUFF &&
> > + boot_cpu_has(X86_FEATURE_IBRS) &&
> > + boot_cpu_data.x86_vendor == X86_VENDOR_INTEL) {
> > + spectre_v2_enabled = SPECTRE_V2_IBRS;
> > + }
> > + }
>
> This has a dependency on retbleed_update_mitigation() which hasn't run yet?
>

It's actually the reverse, retbleed_update_mitigation() needs to run after this. That hasn't changed vs upstream, although I do need to document that.

--David Kaplan