Skip to content

KVM: x86: User-return MSR fix+cleanups

Sean Christopherson kvm linux-coco lkml 2 versions – Applied

Status from this message: Applied to kvm-x86 misc, thanks!

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v5 Latest4 patches 13 repliesApplied
  2. v44 patches 12 repliesSuperseded

Changes in v5 from the cover letter

- Set TDX MSRs to their expected post-run value during tdx_prepare_switch_to_guest() instead of trying to predict what value is in hardware after the SEAMCALL. [Yan]
- Free user_return_msrs at kvm_x86_vendor_exit(), not kvm_x86_exit(). [Chao]

Patches in v5 Applied

#Subject and filesSizeRepliesApplied
1/4KVM: TDX: Explicitly set user-return MSRs that *may* be clobbered by the TDX-Modulearch/x86/include/asm/kvm_host.h arch/x86/kvm/vmx/tdx.c arch/x86/kvm/vmx/tdx.h +1 more+23 -409 replies
2/4KVM: x86: WARN if user-return MSR notifier is registered on exitarch/x86/kvm/x86.c+25 -80 replies
3/4KVM: x86: Leave user-return notifier registered on reboot/shutdownarch/x86/kvm/x86.c+15 -12 replies
4/4KVM: x86: Don't disable IRQs when unregistering user-return notifierarch/x86/kvm/x86.c+3 -111 reply

Reviews trailers per patch

2 of 4 patches have a Reviewed-by or Acked-by.

PatchXiaoyao LiKai Huang
1/4R-b
2/4
3/4
4/4R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v5 thread

Cover letter [PATCH v5 0/4] KVM: x86: User-return MSR fix+cleanups

Fix a bug in TDX where KVM will incorrectly update the current user-return MSR values when the TDX-Module doesn't actually clobber the relevant MSRs, and then cleanup and harden the user-return MSR code, e.g. against forced reboots.

v5:
- Set TDX MSRs to their expected post-run value during tdx_prepare_switch_to_guest() instead of trying to predict what value is in hardware after the SEAMCALL. [Yan]
- Free user_return_msrs at kvm_x86_vendor_exit(), not kvm_x86_exit(). [Chao]

v4:
- https://lore.kernel.org/all/[email protected]
- Tweak changelog regarding the "cache" rename to try and better capture the details of how .curr is used. [Yan]
- Synchronize the cache immediately after TD-Exit to minimize the window where the cache is stale (even with the reboot change, it's still nice to minimize the window). [Yan]
- Leave the user-return notifier registered on reboot/shutdown so that the common code doesn't have to be paranoid about being interrupted.

v3: https://lore.kernel.org/all/15fa59ba7f6f849082fb36735e784071539d5ad2.1758002303.git.houwenlong.hwl@antgroup.com

v1 (cache): https://lore.kernel.org/all/[email protected]

Hou Wenlong (1):
KVM: x86: Don't disable IRQs when unregistering user-return notifier

Sean Christopherson (3):
KVM: TDX: Explicitly set user-return MSRs that *may* be clobbered by
the TDX-Module
KVM: x86: WARN if user-return MSR notifier is registered on exit
KVM: x86: Leave user-return notifier registered on reboot/shutdown

 arch/x86/include/asm/kvm_host.h |  1 -
 arch/x86/kvm/vmx/tdx.c          | 52 +++++++++++-------------
 arch/x86/kvm/vmx/tdx.h          |  1 -
 arch/x86/kvm/x86.c              | 72 ++++++++++++++++++++-------------
 4 files changed, 66 insertions(+), 60 deletions(-)

base-commit: 4cc167c50eb19d44ac7e204938724e685e3d8057

Signature · 1 line
2.51.1.930.gacf6e81ea2-goog