Re: [PATCH v2 1/1] x86/tdx: Handle MWAIT, MONITOR and WBINVD

From: Kuppuswamy, Sathyanarayanan
Date: Mon Mar 29 2021 - 18:43:53 EST




On 3/29/21 3:12 PM, Dave Hansen wrote:
On 3/29/21 3:09 PM, Kuppuswamy, Sathyanarayanan wrote:
+    case EXIT_REASON_MWAIT_INSTRUCTION:
+        /* MWAIT is supressed, not supposed to reach here. */
+        WARN(1, "MWAIT unexpected #VE Exception\n");
+        return -EFAULT;

How is MWAIT "supppressed"?
I am clearing the MWAIT feature flag in early init code. We should also
disable this feature in firmware.
setup_clear_cpu_cap(X86_FEATURE_MWAIT);

I'd be more explicit about that.  Maybe even reference the code that
clears the X86_FEATURE.
This change is part of the same patch.

Right, but if someone goes and looks at the switch() statement in 10
years is it going to be obvious how MWAIT was "suppressed"?
Ok. I can add a comment line for it.


--
Sathyanarayanan Kuppuswamy
Linux Kernel Developer