On 3/29/21 2:55 PM, Kuppuswamy, Sathyanarayanan wrote:We will be reaching this point only if something is buggy in kernel. I am
Agree. Since we are not supposed to come here, I will use BUG.
MONITOR is a privileged instruction, right? So we can only end up in
here if the kernel screws up and isn't reading CPUID correctly, right?
That dosen't seem to me like something we want to suppress. This needs
a warning, at least. I assume that having a MONITOR instruction
immediately return doesn't do any harm.
"This is unexpected" is a WARN()able offense.
"This is unexpected and might be corrupting data" is where we want to
use BUG().
Does broken MONITOR risk data corruption?
This change is part of the same patch.
I am clearing the MWAIT feature flag in early init code. We should also+ 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"?
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.