Re: [PATCHv9 05/17] x86/kexec: Keep CR4.MCE set during kexec for TDX guest

From: Kirill A. Shutemov
Date: Fri Mar 29 2024 - 12:48:35 EST


On Fri, Mar 29, 2024 at 11:21:32PM +0800, Xiaoyao Li wrote:
> On 3/25/2024 6:38 PM, Kirill A. Shutemov wrote:
> > TDX guests are not allowed to clear CR4.MCE. Attempt to clear it leads
> > to #VE.
>
> Will we consider making it more safe and compatible for future to guard
> against X86_FEATURE_MCE as well?
>
> If in the future, MCE becomes configurable for TD guest, then CR4.MCE might
> not be fixed1.

Good point.

I guess we can leave it clear if it was clear. This should be easy
enough. But we might want to clear even if was set if clearing is allowed.

It would require some kind of indication that clearing MCE is fine. We
don't have such indication yet. Not sure we can reasonably future-proof
the code at this point.

But let me think more.

--
Kiryl Shutsemau / Kirill A. Shutemov