RE: [PATCH v3 06/35] x86/bugs: Restructure mmio mitigation

From: Kaplan, David
Date: Mon Feb 10 2025 - 12:23:38 EST


[AMD Official Use Only - AMD Internal Distribution Only]

> -----Original Message-----
> From: Brendan Jackman <jackmanb@xxxxxxxxxx>
> Sent: Monday, February 10, 2025 10:42 AM
> To: Kaplan, David <David.Kaplan@xxxxxxx>
> Cc: Thomas Gleixner <tglx@xxxxxxxxxxxxx>; Borislav Petkov <bp@xxxxxxxxx>; Peter
> Zijlstra <peterz@xxxxxxxxxxxxx>; Josh Poimboeuf <jpoimboe@xxxxxxxxxx>; 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 06/35] x86/bugs: Restructure mmio mitigation
>
> Caution: This message originated from an External Source. Use proper caution
> when opening attachments, clicking links, or responding.
>
>
> On Wed, 8 Jan 2025 at 21:27, David Kaplan <david.kaplan@xxxxxxx> wrote:
> > +static void __init mmio_apply_mitigation(void) {
> > if (mmio_mitigation == MMIO_MITIGATION_OFF)
> > return;
>
> > /*
> > * Enable CPU buffer clear mitigation for host and VMM, if also
> > affected
> > * by MDS or TAA. Otherwise, enable mitigation for VMM only.
> > */
> > if (boot_cpu_has_bug(X86_BUG_MDS) || (boot_cpu_has_bug(X86_BUG_TAA)
> &&
> > boot_cpu_has(X86_FEATURE_RTM)))
> > setup_force_cpu_cap(X86_FEATURE_CLEAR_CPU_BUF);
>
> This is still peeking at other mitigations in _apply_mitigation.
> Shouldn't we shunt that logic into _update_mitigation?
>
> I guess this would need a new enum value but that doesn't seem too bad. Worth it
> to have all the inter-mitigation dependencies localised into *_udpate_mitigation IMO.

I don't think it is peeking at other mitigations, it's only looking at what other bugs the CPU has (which is static). Looking at the mds/taa/etc. mitigation values is done in mmio_update_mitigation.

--David Kaplan