RE: [PATCH v5 02/16] x86/bugs: Restructure TAA mitigation

Kaplan, David
2025-04-20T21:03:28Z

[AMD Official Use Only - AMD Internal Distribution Only]

> -----Original Message-----
> From: Borislav Petkov <bp@alien8.de>
> Sent: Saturday, April 19, 2025 7:37 AM
> To: Kaplan, David <David.Kaplan@amd.com>
> Cc: Thomas Gleixner <tglx@linutronix.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 v5 02/16] x86/bugs: Restructure TAA mitigation
>
> Caution: This message originated from an External Source. Use proper caution
> when opening attachments, clicking links, or responding.
>
>
> On Fri, Apr 18, 2025 at 11:17:07AM -0500, David Kaplan wrote:
> > @@ -394,6 +399,11 @@ static const char * const taa_strings[] = {
> > [TAA_MITIGATION_TSX_DISABLED] = "Mitigation: TSX disabled",
> > };
> >
> > +static bool __init taa_vulnerable(void) {
> > + return boot_cpu_has_bug(X86_BUG_TAA) &&
> > +boot_cpu_has(X86_FEATURE_RTM); }
> > +
> > static void __init taa_select_mitigation(void) {
> > if (!boot_cpu_has_bug(X86_BUG_TAA)) {
>
> Shouldn't you use !taa_vulnerable() here directly too, since we're introducing it as a
> helper?
>

No, because taa_vulnerable() requires both X86_BUG_TAA and X86_FEATURE_RTM.

In taa_select_mitigation() there is a difference depending on which of these doesn't exist which sets the mitigation to either OFF (if unaffected) or TSX_DISABLED (if no RTM).

taa_vulnerable() is used however in taa_update_mitigation().

--David Kaplan