[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <pvbwlmkknw7cwln4onmi5mujpykyaxisb73khlriq7pzqhgno2@nvu3cbchp4am>
Date: Wed, 26 Feb 2025 13:49:31 +0200
From: "Kirill A. Shutemov" <kirill@...temov.name>
To: Vishal Annapurve <vannapurve@...gle.com>
Cc: dave.hansen@...ux.intel.com, kirill.shutemov@...ux.intel.com,
jgross@...e.com, ajay.kaher@...adcom.com, ak@...ux.intel.com, tony.luck@...el.com,
thomas.lendacky@....com, tglx@...utronix.de, mingo@...hat.com, bp@...en8.de,
hpa@...or.com, pbonzini@...hat.com, seanjc@...gle.com, kai.huang@...el.com,
chao.p.peng@...ux.intel.com, isaku.yamahata@...il.com,
sathyanarayanan.kuppuswamy@...ux.intel.com, erdemaktas@...gle.com, ackerleytng@...gle.com, jxgao@...gle.com,
sagis@...gle.com, afranji@...gle.com, kees@...nel.org, jikos@...nel.org,
peterz@...radead.org, x86@...nel.org, linux-kernel@...r.kernel.org,
linux-coco@...ts.linux.dev, virtualization@...ts.linux.dev,
bcm-kernel-feedback-list@...adcom.com, stable@...r.kernel.org
Subject: Re: [PATCH v6 2/3] x86/tdx: Fix arch_safe_halt() execution for TDX
VMs
On Tue, Feb 25, 2025 at 12:47:03AM +0000, Vishal Annapurve wrote:
> Direct HLT instruction execution causes #VEs for TDX VMs which is routed
> to hypervisor via TDCALL. If HLT is executed in STI-shadow, resulting #VE
> handler will enable interrupts before TDCALL is routed to hypervisor
> leading to missed wakeup events.
>
> Current TDX spec doesn't expose interruptibility state information to
> allow #VE handler to selectively enable interrupts. To bypass this
> issue, TDX VMs need to replace "sti;hlt" execution with direct TDCALL
> followed by explicit interrupt flag update.
>
> Commit bfe6ed0c6727 ("x86/tdx: Add HLT support for TDX guests")
> prevented the idle routines from executing HLT instruction in STI-shadow.
> But it missed the paravirt routine which can be reached like this as an
> example:
> acpi_safe_halt() =>
> raw_safe_halt() =>
> arch_safe_halt() =>
> irq.safe_halt() =>
> pv_native_safe_halt()
I would rather use paravirt spinlock example. It is less controversial.
I still see no point in ACPI cpuidle be a thing in TDX guests.
>
> To reliably handle arch_safe_halt() for TDX VMs, introduce explicit
> dependency on CONFIG_PARAVIRT and override paravirt halt()/safe_halt()
> routines with TDX-safe versions that execute direct TDCALL and needed
> interrupt flag updates. Executing direct TDCALL brings in additional
> benefit of avoiding HLT related #VEs altogether.
>
> Cc: stable@...r.kernel.org
> Fixes: bfe6ed0c6727 ("x86/tdx: Add HLT support for TDX guests")
> Signed-off-by: Vishal Annapurve <vannapurve@...gle.com>
Reviewed-by: Kirill A. Shutemov <kirill.shutemov@...ux.intel.com>
--
Kiryl Shutsemau / Kirill A. Shutemov
Powered by blists - more mailing lists