Re: [PATCH] x86/tsx: Use MSR_TSX_CTRL to clear CPUID bits

From: Pawan Gupta
Date: Tue Feb 15 2022 - 07:11:13 EST


On 15.02.2022 11:24, Borislav Petkov wrote:
On Mon, Feb 14, 2022 at 04:20:14PM -0800, Pawan Gupta wrote:
... we are calling tsx_clear_cpuid() unconditionally.

I know, that's why I asked...

> If those CPUs which support only disabling TSX through MSR_IA32_TSX_CTRL
> but don't have MSR_TSX_FORCE_ABORT - if those CPUs set
> X86_FEATURE_RTM_ALWAYS_ABORT too, then this should work.

... this^^.

IOW, what are you fixing here exactly?

Let's look at the two callsites of tsx_clear_cpuid():

1. tsx_init: that will do something on X86_FEATURE_RTM_ALWAYS_ABORT CPUs.

2. init_intel: that will get called when

tsx_ctrl_state == TSX_CTRL_RTM_ALWAYS_ABORT

But TSX_CTRL_RTM_ALWAYS_ABORT gets set only when
X86_FEATURE_RTM_ALWAYS_ABORT is set. I.e., the first case, in
tsx_init().

So, IIUC, you wanna fix the case where CPUs which set
X86_FEATURE_RTM_ALWAYS_ABORT but *don't* have MSR_TSX_FORCE_ABORT, those
CPUs should still disable TSX through MSR_IA32_TSX_CTRL.

Correct?

That is exactly what this patch is fixing. Please let me know if you
have any questions.

Thanks,
Pawan