[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <dac078b4-e50c-42b9-db52-6dc65b99406e@linux.intel.com>
Date: Mon, 29 Mar 2021 15:09:51 -0700
From: "Kuppuswamy, Sathyanarayanan"
<sathyanarayanan.kuppuswamy@...ux.intel.com>
To: Dave Hansen <dave.hansen@...el.com>,
Peter Zijlstra <peterz@...radead.org>,
Andy Lutomirski <luto@...nel.org>
Cc: Andi Kleen <ak@...ux.intel.com>,
Kirill Shutemov <kirill.shutemov@...ux.intel.com>,
Kuppuswamy Sathyanarayanan <knsathya@...nel.org>,
Dan Williams <dan.j.williams@...el.com>,
Raj Ashok <ashok.raj@...el.com>,
Sean Christopherson <seanjc@...gle.com>,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2 1/1] x86/tdx: Handle MWAIT, MONITOR and WBINVD
On 3/29/21 3:02 PM, Dave Hansen wrote:
> On 3/29/21 2:55 PM, Kuppuswamy, Sathyanarayanan wrote:
>>>
>>> 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.
>> Agree. Since we are not supposed to come here, I will use BUG.
>
> "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?
We will be reaching this point only if something is buggy in kernel. I am
not sure about impact of this buggy state. But MONITOR instruction by
itself, should not cause data corruption.
>
>>>> + 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.
>
--
Sathyanarayanan Kuppuswamy
Linux Kernel Developer
Powered by blists - more mailing lists