Re: [PATCHv2.1 05/29] x86/tdx: Add HLT support for TDX guests

From: Sean Christopherson
Date: Wed Feb 09 2022 - 20:21:39 EST


On Thu, Feb 10, 2022, Kirill A. Shutemov wrote:
> On Wed, Feb 09, 2022 at 06:05:52PM +0000, Sean Christopherson wrote:
> > On Wed, Feb 09, 2022, Kirill A. Shutemov wrote:
> > > On Mon, Feb 07, 2022 at 10:52:19PM +0000, Sean Christopherson wrote:
> > > .Lskip_sti:
> > > tdcall
> > >
> > > /*
> > > * TDVMCALL leaf does not suppose to fail. If it fails something
> > > * is horribly wrong with TDX module. Stop the world.
> > > */
> > > test %rax, %rax
> > > je .Lsuccess
> > > ud2
> >
> > If the ud2 or call to an external "do panic" helper is out-of-line, then the happy
> > path avoids a taken branch. Not a big deal, but it's also trivial to do.
>
> Something like this?

Yep.

> I assume FRAME_END is irrelevent after UD2.

Not irrelevant, but we don't want to do FRAME_END in this case. Keeping the current
frame pointer (setup by FRAME_BEGIN, torn down by FRAME_END) will let the unwinder
do its thing when its using frame pointers.