On Wed, Feb 12, 2025 at 4:54 AM Kirill A. Shutemov <kirill@xxxxxxxxxxxxx> wrote: > > On Wed, Feb 12, 2025 at 12:07:45AM +0000, Vishal Annapurve wrote: > > Direct HLT instruction execution causes #VEs for TDX VMs which is routed > > to hypervisor via TDCALL. safe_halt() routines execute HLT in STI-shadow > > so IRQs need to remain disabled until the TDCALL to ensure that pending > > IRQs are correctly treated as wake events. So "sti;hlt" sequence needs to > > be replaced with "TDCALL; raw_local_irq_enable()" for TDX VMs. > > The last sentence is somewhat confusing. > > Maybe drop it and add explanation that #VE handler doesn't have info about > STI shadow, enables interrupts before TDCALL which can lead to missed > wakeup events. Ack, will fix it in the next version. > > > @@ -409,6 +410,12 @@ void __cpuidle tdx_safe_halt(void) > > WARN_ONCE(1, "HLT instruction emulation failed\n"); > > } > > > > +static void __cpuidle tdx_safe_halt(void) > > +{ > > + tdx_halt(); > > + raw_local_irq_enable(); > > What is justification for raw_? Why local_irq_enable() is not enough? > > To very least, it has to be explained. Let me replace it with a more suitable arch specific <>_irq_enable() function in the next version. Intention here is to just enable interrupts. > > -- > Kiryl Shutsemau / Kirill A. Shutemov