kernel.org, VMware Inc <[email protected]>, [email protected], [email protected], [email protected], Arnd Bergmann <[email protected]>, [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], Borislav Petkov <[email protected]>, [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], "H. Peter Anvin" <[email protected]>, [email protected], [email protected], [email protected], Isaku Yamahata <[email protected]>, [email protected], [email protected], [email protected], Richard Weinberger <[email protected]>, X86 ML <[email protected]>, [email protected], Ingo Molnar <[email protected]>, Albert Ou <[email protected]>, paulmck@ker nel.org, [email protected], [email protected], [email protected], Paul Walmsley <[email protected]>, [email protected], Namhyung Kim <[email protected]>, Andy Shevchenko <[email protected]>, [email protected], Juergen Gross <[email protected]>, [email protected], [email protected], Palmer Dabbelt <[email protected]>, Anup Patel <[email protected]>, [email protected], Johannes Berg <[email protected]>, [email protected] Errors-To: [email protected] Sender: "Linuxppc-dev" <[email protected]>
On Wed, Jun 8, 2022 at 10:48 PM Peter Zijlstra <[email protected]> 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
