kernel.org, VMware Inc <pv-driv...@vmware.com>, linux-snps-...@lists.infradead.org, mgor...@suse.de, jacob.jun....@linux.intel.com, Arnd Bergmann <a...@arndb.de>, ulli.kr...@googlemail.com, vgu...@kernel.org, linux-...@vger.kernel.org, j...@joshtriplett.org, rost...@goodmis.org, r...@vger.kernel.org, Borislav Petkov <b...@alien8.de>, bc...@quicinc.com, tsbog...@alpha.franken.de, linux-par...@vger.kernel.org, sudeep.ho...@arm.com, shawn...@kernel.org, da...@davemloft.net, kirill.shute...@linux.intel.com, dal...@libc.org, t...@atomide.com, amakha...@vmware.com, bjorn.anders...@linaro.org, "H. Peter Anvin" <h...@zytor.com>, sparcli...@vger.kernel.org, linux-hexa...@vger.kernel.org, linux-ri...@lists.infradead.org, Isaku Yamahata <isaku.yamah...@gmail.com>, anton.iva...@cambridgegreys.com, jo...@southpole.se, yury.no...@gmail.com, Richard Weinberger <rich...@nod.at>, X86 ML <x...@kernel.org>, li...@armlinux.org.uk, Ingo Molnar <mi...@redhat.com>, Albert Ou <a...@eecs.berkeley.edu>, paulmck@ker nel.org, h...@linux.ibm.com, stefan.kristians...@saunalahti.fi, openr...@lists.librecores.org, Paul Walmsley <paul.walms...@sifive.com>, linux-te...@vger.kernel.org, Namhyung Kim <namhy...@kernel.org>, Andy Shevchenko <andriy.shevche...@linux.intel.com>, jpoim...@kernel.org, Juergen Gross <jgr...@suse.com>, mon...@monstr.eu, linux-m...@vger.kernel.org, Palmer Dabbelt <pal...@dabbelt.com>, Anup Patel <a...@brainfault.org>, i...@jurassic.park.msu.ru, Johannes Berg <johan...@sipsolutions.net>, linuxppc-dev@lists.ozlabs.org Errors-To: linuxppc-dev-bounces+archive=mail-archive....@lists.ozlabs.org Sender: "Linuxppc-dev" <linuxppc-dev-bounces+archive=mail-archive....@lists.ozlabs.org>
On Wed, Jun 8, 2022 at 10:48 PM Peter Zijlstra <pet...@infradead.org> wrote: > > Now that arch_cpu_idle() is expected to return with IRQs disabled, > avoid the useless STI/CLI dance. > > Per the specs this is supposed to work, but nobody has yet relied up > this behaviour so broken implementations are possible. I'm totally newbie here. The point of safe_halt() is that STI must be used and be used directly before HLT to enable IRQ during the halting and stop the halting if there is any IRQ. In TDX case, STI must be used directly before the hypercall. Otherwise, no IRQ can come and the vcpu would be stalled forever. Although the hypercall has an "irq_disabled" argument. But the hypervisor doesn't (and can't) touch the IRQ flags no matter what the "irq_disabled" argument is. The IRQ is not enabled during the halting if the IRQ is disabled before the hypercall even if irq_disabled=false. The "irq_disabled" argument is used for workaround purposes: https://lore.kernel.org/kvm/c020ee0b90c424a7010e979c9b32a28e9c488a51.1651774251.git.isaku.yamah...@intel.com/ Hope my immature/incorrect reply elicits a real response from others. Thanks Lai