Re: [RFC v2 16/32] x86/tdx: Handle MWAIT, MONITOR and WBINVD

From: Dave Hansen
Date: Tue May 11 2021 - 11:46:03 EST


On 5/11/21 8:37 AM, Dan Williams wrote:
>> I disagree. We already spent a lot of cycles on this. WBINVD makes never
>> sense in current TDX and all the code will be disabled.
> Why not just drop the patch if it continues to cause people to spend
> cycles on it and it addresses a problem that will never happen?

If someone calls WBINVD, we have a bug. Not a little bug, either. It
probably means there's some horribly confused kernel code that's now
facing broken cache coherency. To me, it's a textbook place to use
BUG_ON().

This also doesn't "address" the problem, it just helps produce a more
coherent warning message. It's why we have OOPS messages in the page
fault handler: it never makes any sense to dereference a NULL pointer,
yet we have code to make debugging them easier. It's well worth the ~20
lines of code that this costs us for ease of debugging.