RE: [PATCH v3 04/35] x86/bugs: Restructure mds mitigation

Kaplan, David
2025-02-10T22:33:06Z

[AMD Official Use Only - AMD Internal Distribution Only]

> -----Original Message-----
> From: Josh Poimboeuf <jpoimboe@kernel.org>
> Sent: Monday, February 10, 2025 4:25 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 04/35] x86/bugs: Restructure mds 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:44PM -0600, David Kaplan wrote:
> > @@ -229,9 +259,6 @@ static void x86_amd_ssb_disable(void)
> > wrmsrl(MSR_AMD64_LS_CFG, msrval); }
> >
> > -#undef pr_fmt
> > -#define pr_fmt(fmt) "MDS: " fmt
> > -
>
> Why? For consistency with the rest of the file it's best to leave the correct pr_fmt()
> in place for mds_*(), taa_*(), rfds_*(), etc.

I had removed it because it wasn't used, but it actually can be used for the pr_info in mds_update_mitigation so I'll put it back.

>
> > static void __init mds_select_mitigation(void) {
> > - if (!boot_cpu_has_bug(X86_BUG_MDS) || cpu_mitigations_off()) {
> > + if (!boot_cpu_has_bug(X86_BUG_MDS) || cpu_mitigations_off())
> > mds_mitigation = MDS_MITIGATION_OFF;
> > - return;
> > - }
>
> For clarity it should still return here, that makes it obvious none of the subsequent
> conditions apply.

Ok
>
> > +static void __init mds_apply_mitigation(void) {
> > + if (mds_mitigation == MDS_MITIGATION_FULL) {
> > + setup_force_cpu_cap(X86_FEATURE_CLEAR_CPU_BUF);
>
> The mitigation still needs to be attempted for the MDS_MITIGATION_VMWERV
> case.
>

Good catch, will fix.

Thanks --David Kaplan