Re: [PATCHv9 05/17] x86/kexec: Keep CR4.MCE set during kexec for TDX guest
From: Kirill A. Shutemov
Date: Mon Mar 17 2025 - 08:02:06 EST
On Mon, Mar 17, 2025 at 11:32:42AM +0000, David Woodhouse wrote:
> > And we don't want MCE to be enabled during kexec for !TDX_GUEST:
> >
> > https://lore.kernel.org/all/1144340e-dd95-ee3b-dabb-579f9a65b3c7@xxxxxxxxxx/
>
> Actually now I've added proper exception handling in relocate_kernel
> perhaps we could rethink that. But that's for the future.
There still going to be a gap once the new kernel is started until it gets
proper exception handling in place.
> > I think we should patch AND instruction to include X86_CR4_MCE on
> > TDX_GUEST:
> > ...
> > - andl $(X86_CR4_PAE | X86_CR4_LA57), %r13d
> > - ALTERNATIVE "", __stringify(orl $X86_CR4_MCE, %r13d), X86_FEATURE_TDX_GUEST
> > + ALTERNATIVE __stringify(andl $(X86_CR4_PAE | X86_CR4_LA57), %r13d), \
> > + __stringify(andl $(X86_CR4_PAE | X86_CR4_LA57 | X86_CR4_MCE), %r13d), X86_FEATURE_TDX_GUEST
>
> Yeah... although the reason I'm looking at this is because I want to
> kill the ALTERNATIVE so that I can move the relocate_kernel() function
> into a data section:
> https://lore.kernel.org/all/20241218212326.44qff3i5n6cxuu5d@jpoimboe/
>
> So I think I'll do it like this instead:
Looks good to me. Thanks for the cleanup you are doing!
--
Kiryl Shutsemau / Kirill A. Shutemov