virtualization.lists.linux-foundation.org archive mirror
 help / color / mirror / Atom feed
* [PATCH V5 0/4] x86/tdx: Fix HLT logic execution for TDX VMs
@ 2025-02-20 21:16 Vishal Annapurve
  2025-02-20 21:16 ` [PATCH V5 1/4] x86/paravirt: Move halt paravirt calls under CONFIG_PARAVIRT Vishal Annapurve
                   ` (3 more replies)
  0 siblings, 4 replies; 11+ messages in thread
From: Vishal Annapurve @ 2025-02-20 21:16 UTC (permalink / raw)
  To: x86, linux-kernel, linux-coco, virtualization
  Cc: pbonzini, seanjc, erdemaktas, ackerleytng, jxgao, sagis, oupton,
	pgonda, kirill, dave.hansen, chao.p.peng, isaku.yamahata,
	sathyanarayanan.kuppuswamy, jgross, ajay.kaher, alexey.amakhalov,
	Vishal Annapurve

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 for TDX VMs with TDCALL execution followed by enabling of
interrupts.

Changes introduced by the series include:
- Move *halt() variants outside CONFIG_PARAVIRT_XXL and under
  CONFIG_PARAVIRT [1].
- Route "sti; hlt" sequences via tdx_safe_halt() for reliability.
- Route "hlt" sequences via tdx_halt() to avoid unnecessary #VEs.
- Add explicit dependency on CONFIG_PARAVIRT for TDX VMs.
- Warn and fail emulation if HLT #VE emulation executes with interrupts
  enabled.
- Clean up TDX specific idle routine override.

Changes since v4:
1) Addressed Kirill's comments.

v4: https://lore.kernel.org/lkml/20250212000747.3403836-1-vannapurve@google.com/

Changes since v3:
1) Addressed comments from Sean.
2) Included [1] in the series to fix the scenarios where
CONFIG_PARAVIRT_XXL could be disabled.
v3: https://lore.kernel.org/all/20250206222714.1079059-1-vannapurve@google.com/

[1] https://lore.kernel.org/lkml/20210517235008.257241-1-sathyanarayanan.kuppuswamy@linux.intel.com/

Kirill A. Shutemov (1):
  x86/paravirt: Move halt paravirt calls under CONFIG_PARAVIRT

Vishal Annapurve (3):
  x86/tdx: Route safe halt execution via tdx_safe_halt()
  x86/tdx: Emit warning if IRQs are enabled during HLT #VE handling
  x86/tdx: Remove TDX specific idle routine

 arch/x86/Kconfig                      |  1 +
 arch/x86/coco/tdx/tdx.c               | 30 +++++++++++++++++++-
 arch/x86/include/asm/irqflags.h       | 40 +++++++++++++++------------
 arch/x86/include/asm/paravirt.h       | 20 +++++++-------
 arch/x86/include/asm/paravirt_types.h |  3 +-
 arch/x86/include/asm/tdx.h            |  2 --
 arch/x86/kernel/paravirt.c            | 14 ++++++----
 arch/x86/kernel/process.c             |  3 --
 8 files changed, 71 insertions(+), 42 deletions(-)

-- 
2.48.1.601.g30ceb7b040-goog


^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2025-03-03  9:54 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-02-20 21:16 [PATCH V5 0/4] x86/tdx: Fix HLT logic execution for TDX VMs Vishal Annapurve
2025-02-20 21:16 ` [PATCH V5 1/4] x86/paravirt: Move halt paravirt calls under CONFIG_PARAVIRT Vishal Annapurve
2025-02-20 21:47   ` Dave Hansen
2025-02-20 23:17     ` Vishal Annapurve
2025-02-28 21:47   ` Konrad Rzeszutek Wilk
2025-03-03  9:54     ` Jürgen Groß
2025-02-20 21:16 ` [PATCH V5 2/4] x86/tdx: Route safe halt execution via tdx_safe_halt() Vishal Annapurve
2025-02-20 23:00   ` Dave Hansen
2025-02-20 23:51     ` Vishal Annapurve
2025-02-20 21:16 ` [PATCH V5 3/4] x86/tdx: Emit warning if IRQs are enabled during HLT #VE handling Vishal Annapurve
2025-02-20 21:16 ` [PATCH V5 4/4] x86/tdx: Remove TDX specific idle routine Vishal Annapurve

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).