RE: [PATCH v2 03/35] x86/bugs: Add AUTO mitigations for mds/taa/mmio/rfds

From: Kaplan, David
Date: Thu Nov 14 2024 - 10:02:45 EST


[AMD Official Use Only - AMD Internal Distribution Only]

> -----Original Message-----
> From: Pawan Gupta <pawan.kumar.gupta@xxxxxxxxxxxxxxx>
> Sent: Wednesday, November 13, 2024 8:27 PM
> To: Kaplan, David <David.Kaplan@xxxxxxx>
> Cc: Thomas Gleixner <tglx@xxxxxxxxxxxxx>; Borislav Petkov <bp@xxxxxxxxx>; Peter
> Zijlstra <peterz@xxxxxxxxxxxxx>; Josh Poimboeuf <jpoimboe@xxxxxxxxxx>; Ingo
> Molnar <mingo@xxxxxxxxxx>; Dave Hansen <dave.hansen@xxxxxxxxxxxxxxx>;
> x86@xxxxxxxxxx; H . Peter Anvin <hpa@xxxxxxxxx>; linux-kernel@xxxxxxxxxxxxxxx
> Subject: Re: [PATCH v2 03/35] x86/bugs: Add AUTO mitigations for
> mds/taa/mmio/rfds
>
> Caution: This message originated from an External Source. Use proper caution
> when opening attachments, clicking links, or responding.
>
>
> On Tue, Nov 05, 2024 at 03:54:23PM -0600, David Kaplan wrote:
> > @@ -1995,6 +2004,7 @@ void cpu_bugs_smt_update(void)
> > update_mds_branch_idle();
> > break;
> > case MDS_MITIGATION_OFF:
> > + case MDS_MITIGATION_AUTO:
>
> This implies AUTO and OFF are similar, which is counter intuitive.
> While mitigation selection code ...
>
> > + if (mds_mitigation == MDS_MITIGATION_AUTO)
> > + mds_mitigation = MDS_MITIGATION_FULL;
> > +
>
> ... indicates that AUTO is equivalent to FULL. So, I think AUTO should be handled
> the same way as FULL in cpu_bugs_smt_update() as well.
>
> Same for TAA and MMIO below.
>

The mitigation is never actually AUTO by the time we call cpu_bugs_smt_update(), since this happens after cpu_select_mitigations(). I had to add the case statement here so the switch statement was complete, but this case will never be hit.

Should I put a comment here about that? Or is a default case the better way to handle this?

--David Kaplan