[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20220520070614.GP2578@worktop.programming.kicks-ass.net>
Date: Fri, 20 May 2022 09:06:14 +0200
From: Peter Zijlstra <peterz@...radead.org>
To: "Kirill A. Shutemov" <kirill.shutemov@...ux.intel.com>
Cc: frederic@...nel.org, paulmck@...nel.org, rjw@...ysocki.net,
x86@...nel.org, linux-kernel@...r.kernel.org, jpoimboe@...nel.org
Subject: Re: [RFC][PATCH 9/9] arch/idle: Change arch_cpu_idle() IRQ behaviour
On Fri, May 20, 2022 at 05:20:52AM +0300, Kirill A. Shutemov wrote:
> On Fri, May 20, 2022 at 12:03:49AM +0200, Peter Zijlstra wrote:
> >
> > On Thu, May 19, 2022 at 11:27:59PM +0200, Peter Zijlstra wrote:
> > > --- a/arch/x86/coco/tdx/tdx.c
> > > +++ b/arch/x86/coco/tdx/tdx.c
> > > @@ -178,6 +178,9 @@ void __cpuidle tdx_safe_halt(void)
> > > */
> > > if (__halt(irq_disabled, do_sti))
> > > WARN_ONCE(1, "HLT instruction emulation failed\n");
> > > +
> > > + /* XXX I can't make sense of what @do_sti actually does */
> > > + raw_local_irq_disable();
> > > }
> > >
> >
> > Kirill, Dave says I should prod you :-)
>
> It calls STI just before doing TDCALL that requests HLT.
> See comment above $TDX_HCALL_ISSUE_STI usage in __tdx_hypercall()[1].
Yes, it says that, but it's useless information since it doesn't
actually tell me the behaviour.
What I'm interested in is the behavour of the hypercall when:
.irq_disabled=false, .do_sti=false
>From what I can tell, irq_disabled=false should have the hypercall wake
on interrupt, do_sti=false should have it not enable interrupts.
But what does it actually do ? Because HLT without STI is a dead
machine, but this hypercall looks more like mwait with the irq_disabled
argument...
>
> __halt(do_sti == true) matches native_safe_halt() semantics (or suppose
> to) and __halt(do_sti == false) corresponds to native_halt().
>
> For context, see Section 3.8 in GHCI[2]
>
> [1] https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git/tree/arch/x86/coco/tdx/tdcall.S?h=x86/tdx#n151
> [2] https://www.intel.com/content/dam/develop/external/us/en/documents/intel-tdx-guest-hypervisor-communication-interface-1.0-344426-002.pdf
Yeah, that stuff is unreadable garbage. Not going to waste time trying
to make sense of it again.
Powered by blists - more mailing lists