RE: [PATCH v3 17/35] x86/bugs: Restructure l1tf mitigation

Kaplan, David
2025-02-12T16:47:37Z

[AMD Official Use Only - AMD Internal Distribution Only]

> -----Original Message-----
> From: Josh Poimboeuf <jpoimboe@kernel.org>
> Sent: Monday, February 10, 2025 7:21 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 17/35] x86/bugs: Restructure l1tf 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:57PM -0600, David Kaplan wrote:
> > static void __init l1tf_select_mitigation(void)
> > +{
> > + if (!boot_cpu_has_bug(X86_BUG_L1TF) || cpu_mitigations_off()) {
> > + l1tf_mitigation = L1TF_MITIGATION_OFF;
> > + return;
> > + }
> > +
> > + if (l1tf_mitigation == L1TF_MITIGATION_AUTO) {
> > + if (cpu_mitigations_auto_nosmt())
> > + l1tf_mitigation = L1TF_MITIGATION_FLUSH_NOSMT;
> > + else
> > + l1tf_mitigation = L1TF_MITIGATION_FLUSH;
> > + }
> > +
> > +}
>
> Extra whitespace.

Ack

>
> > +
> > +static void __init l1tf_apply_mitigation(void)
> > {
> > u64 half_pa;
> >
> > if (!boot_cpu_has_bug(X86_BUG_L1TF))
> > return;
> >
> > - if (cpu_mitigations_off())
> > - l1tf_mitigation = L1TF_MITIGATION_OFF;
> > - else if (cpu_mitigations_auto_nosmt())
> > - l1tf_mitigation = L1TF_MITIGATION_FLUSH_NOSMT;
> > -
> > override_cache_bits(&boot_cpu_data);
> >
> > switch (l1tf_mitigation) {
> > case L1TF_MITIGATION_OFF:
> > + return;
>
> Note the PTE inverstion mitigation is already done unconditionally, the
> X86_FEATURE_L1TF_PTEINV bit is just for reporting that. So this shouldn't return.
>

Ok, will fix

--David Kaplan