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

Kaplan, David
2025-02-10T17:22:47Z

[AMD Official Use Only - AMD Internal Distribution Only]

> -----Original Message-----
> From: Brendan Jackman <jackmanb@google.com>
> Sent: Monday, February 10, 2025 10:42 AM
> To: Kaplan, David <David.Kaplan@amd.com>
> Cc: Thomas Gleixner <tglx@linutronix.de>; Borislav Petkov <bp@alien8.de>; Peter
> Zijlstra <peterz@infradead.org>; Josh Poimboeuf <jpoimboe@kernel.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 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@amd.com> 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