RE: [PATCH v3 04/35] x86/bugs: Restructure mds mitigation
From: Kaplan, David
Date: Mon Feb 10 2025 - 17:34:55 EST
[AMD Official Use Only - AMD Internal Distribution Only]
> -----Original Message-----
> From: Josh Poimboeuf <jpoimboe@xxxxxxxxxx>
> Sent: Monday, February 10, 2025 4:25 PM
> To: Kaplan, David <David.Kaplan@xxxxxxx>
> Cc: Thomas Gleixner <tglx@xxxxxxxxxxxxx>; Borislav Petkov <bp@xxxxxxxxx>; Peter
> Zijlstra <peterz@xxxxxxxxxxxxx>; Pawan Gupta
> <pawan.kumar.gupta@xxxxxxxxxxxxxxx>; Ingo Molnar <mingo@xxxxxxxxxx>; Dave
> Hansen <dave.hansen@xxxxxxxxxxxxxxx>; x86@xxxxxxxxxx; H . Peter Anvin
> <hpa@xxxxxxxxx>; linux-kernel@xxxxxxxxxxxxxxx
> 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