public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>
Cc: frederic@kernel.org, paulmck@kernel.org, rjw@rjwysocki.net,
	x86@kernel.org, linux-kernel@vger.kernel.org,
	jpoimboe@kernel.org
Subject: Re: [RFC][PATCH 9/9] arch/idle: Change arch_cpu_idle() IRQ behaviour
Date: Fri, 20 May 2022 09:06:14 +0200	[thread overview]
Message-ID: <20220520070614.GP2578@worktop.programming.kicks-ass.net> (raw)
In-Reply-To: <20220520022052.mkrc4v4evtp74bxe@black.fi.intel.com>

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.

  reply	other threads:[~2022-05-20  7:06 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-19 21:27 [RFC][PATCH 0/9] Rework cpuidle vs instrumentation Peter Zijlstra
2022-05-19 21:27 ` [RFC][PATCH 1/9] x86/perf/amd: Remove tracing from perf_lopwr_cb() Peter Zijlstra
2022-05-19 21:27 ` [RFC][PATCH 2/9] x86/idle: Replace x86_idle with a static_call Peter Zijlstra
2022-05-30 11:07   ` Frederic Weisbecker
2022-05-19 21:27 ` [RFC][PATCH 3/9] cpuidle: Move IRQ state validation Peter Zijlstra
2022-05-30 11:36   ` Frederic Weisbecker
2022-05-30 12:00     ` Peter Zijlstra
2022-05-19 21:27 ` [RFC][PATCH 4/9] idle: Fix rcu_idle_*() usage Peter Zijlstra
2022-05-23  9:46   ` Gautham R. Shenoy
2022-05-31  9:33     ` Peter Zijlstra
2022-05-19 21:27 ` [RFC][PATCH 5/9] rcu: Fix rcu_idle_exit() Peter Zijlstra
2022-05-20 21:00   ` Paul E. McKenney
2022-05-19 21:27 ` [RFC][PATCH 6/9] acpi_idle: Remove tracing Peter Zijlstra
2022-05-19 21:27 ` [RFC][PATCH 7/9] cpuidle: Annotate poll_idle() Peter Zijlstra
2022-05-19 21:27 ` [RFC][PATCH 8/9] objtool/idle: Validate __cpuidle code as noinstr Peter Zijlstra
2022-05-19 21:27 ` [RFC][PATCH 9/9] arch/idle: Change arch_cpu_idle() IRQ behaviour Peter Zijlstra
2022-05-19 22:03   ` Peter Zijlstra
2022-05-20  2:20     ` Kirill A. Shutemov
2022-05-20  7:06       ` Peter Zijlstra [this message]
2022-05-20 10:13         ` Kirill A. Shutemov
2022-05-20 12:58           ` Peter Zijlstra
2022-05-24 14:55             ` Isaku Yamahata
2022-05-23 10:02   ` Gautham R. Shenoy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220520070614.GP2578@worktop.programming.kicks-ass.net \
    --to=peterz@infradead.org \
    --cc=frederic@kernel.org \
    --cc=jpoimboe@kernel.org \
    --cc=kirill.shutemov@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=paulmck@kernel.org \
    --cc=rjw@rjwysocki.net \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox