RE: [RFC PATCH 03/56] cpu: Reset global mitigations

Kaplan, David
2025-10-17T14:05:38Z

[AMD Official Use Only - AMD Internal Distribution Only]

> -----Original Message-----
> From: Josh Poimboeuf <jpoimboe@kernel.org>
> Sent: Thursday, October 16, 2025 4:34 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>; Alexander Graf <graf@amazon.com>; Boris Ostrovsky
> <boris.ostrovsky@oracle.com>; linux-kernel@vger.kernel.org
> Subject: Re: [RFC PATCH 03/56] cpu: Reset global mitigations
>
> Caution: This message originated from an External Source. Use proper caution
> when opening attachments, clicking links, or responding.
>
>
> On Mon, Oct 13, 2025 at 09:33:51AM -0500, David Kaplan wrote:
> > +#ifdef CONFIG_DYNAMIC_MITIGATIONS
> > +void __weak arch_cpu_reset_mitigations(void)
> > +{
> > +}
> > +
> > +void cpu_reset_mitigations(void)
> > +{
> > + smt_mitigations = SMT_MITIGATIONS_AUTO;
> > + cpu_mitigations = CPU_MITIGATIONS_AUTO;
> > + attack_vectors[CPU_MITIGATE_USER_KERNEL] = true;
> > + attack_vectors[CPU_MITIGATE_USER_USER] = true;
> > + attack_vectors[CPU_MITIGATE_GUEST_HOST] =
> IS_ENABLED(CONFIG_KVM);
> > + attack_vectors[CPU_MITIGATE_GUEST_GUEST] =
> IS_ENABLED(CONFIG_KVM);
> > + arch_cpu_reset_mitigations();
> > +}
> > +#endif
>
> Considering this will have no effect on other arches (or even on x86 at
> this point in the series), should CONFIG_DYNAMIC_MITIGATIONS depend on
> an arch-specific CONFIG_HAVE_DYNAMIC_MITIGATIONS?
>
> Then the weak function can be removed (and weak functions should be
> avoided anyway, IMO).
>

Ok. I agree, the feature doesn't make sense without arch-specific support anyway, so that seems reasonable.

Thanks --David Kaplan