Skip to content

x86/virt: KVM: x86: Exception handling fixes/cleanups

Sean Christopherson kvm lkml 1 version Applied

Status from this message: Queued, thanks.

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest9 patches 1 replyApplied

Patches in v1 Applied

#Subject and filesSizeRepliesApplied
1/9x86/virt: Eat faults on VMXOFF in reboot flowsarch/x86/include/asm/virtext.h+12 -50 replies
2/9x86/reboot: Force all cpus to exit VMX root if VMX is supportedarch/x86/kernel/reboot.c+10 -200 replies
3/9x86/virt: Mark flags and memory as clobbered by VMXOFFarch/x86/include/asm/virtext.h+2 -10 replies
4/9KVM/nVMX: Use __vmx_vcpu_run in nested_vmx_check_vmentry_hwarch/x86/kvm/vmx/nested.c arch/x86/kvm/vmx/vmenter.S arch/x86/kvm/vmx/vmx.c +1 more+5 -320 replies
5/9KVM: VMX: Move Intel PT shenanigans out of VMXON/VMXOFF flowsarch/x86/kvm/vmx/vmx.c+7 -40 replies
6/9KVM: VMX: Use the kernel's version of VMXOFFarch/x86/include/asm/virtext.h arch/x86/kvm/vmx/vmx.c+9 -130 replies
7/9KVM: SVM: Use asm goto to handle unexpected #UD on SVM instructionsarch/x86/kvm/svm/sev.c arch/x86/kvm/svm/svm.c arch/x86/kvm/svm/svm_ops.h+62 -160 replies
8/9KVM: x86: Kill off __ex() and __kvm_handle_fault_on_reboot()arch/x86/include/asm/kvm_host.h arch/x86/kvm/svm/sev.c arch/x86/kvm/svm/svm.c +2 more+9 -310 replies
9/9KVM: x86: Move declaration of kvm_spurious_fault() to x86.harch/x86/include/asm/kvm_host.h arch/x86/kvm/svm/svm_ops.h arch/x86/kvm/vmx/vmx_ops.h +1 more+4 -40 replies

Reviews trailers per patch

None of the 9 patches has a Reviewed-by or Acked-by.

PatchSean Christopherson
1/9
2/9
3/9
4/9Reviewed-and-tested-by
5/9
6/9
7/9
8/9
9/9

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

Read the v1 thread

Cover letter [PATCH 0/9] x86/virt: KVM: x86: Exception handling fixes/cleanups

This series is a conglomeration of three previous series/patches and a bit of new code. None of the previous series are directly related, but they are all needed to achieve the overarching goal of nuking __kvm_handle_fault_on_reboot(), which is a rather ugly inline asm macro that has the unfortunate side effect of inserting in-line JMP+CALL sequences.

Patches 1-3 are resurrected from a series by David Reed[1] to fix VMXOFF bugs in the reboot flows.

Patch 4 is a patch from Uros Bizjak to get rid of custom inline asm in nested VMX. This already received Paolo's "Queued, thanks." blessing, but has not been pushed to kvm.git. It's included here as there is an indirect dependency in patch 8.

Patches 5-6 are minor tweaks to KVM's VMX{ON/OFF} paths to use the kernel's now-fault-tolerant VMXOFF instead of KVM's custom asm.

Patch 7 replaces SVM's __ex()/__kvm_handle_fault_on_reboot() with more tailored asm goto macros, similar to the existing VMX asm_vmx*() macros. This is largely an excuse to get rid of __kvm_handle_fault_on_reboot(); the actual benefits of removing JMP+CALL are likely negligible as SVM only has a few uses of the macro (versus VMX's bajillion VMREADs/VMWRITEs).

Patch 8 removes __ex()/__kvm_handle_fault_on_reboot().

Patch 9 is a very trimmed down version of a different patch from Uros[3], which cleaned up the __ex()/__kvm_handle_fault_on_reboot() code, as opposed to zapping them entirely.

[1] https://lkml.kernel.org/r/[email protected]
[2] https://lkml.kernel.org/r/[email protected]
[3] https://lkml.kernel.org/r/[email protected]

David P. Reed (1):
x86/virt: Mark flags and memory as clobbered by VMXOFF

Sean Christopherson (6):
x86/virt: Eat faults on VMXOFF in reboot flows x86/reboot: Force all cpus to exit VMX root if VMX is supported
KVM: VMX: Move Intel PT shenanigans out of VMXON/VMXOFF flows
KVM: VMX: Use the kernel's version of VMXOFF
KVM: SVM: Use asm goto to handle unexpected #UD on SVM instructions
KVM: x86: Kill off __ex() and __kvm_handle_fault_on_reboot()

Uros Bizjak (2):
KVM/nVMX: Use __vmx_vcpu_run in nested_vmx_check_vmentry_hw
KVM: x86: Move declaration of kvm_spurious_fault() to x86.h

 arch/x86/include/asm/kvm_host.h | 25 --------------
 arch/x86/include/asm/virtext.h  | 25 ++++++++++----
 arch/x86/kernel/reboot.c        | 30 ++++++-----------
 arch/x86/kvm/svm/sev.c          |  5 ++-
 arch/x86/kvm/svm/svm.c          | 18 +---------
 arch/x86/kvm/svm/svm_ops.h      | 59 +++++++++++++++++++++++++++++++++
 arch/x86/kvm/vmx/nested.c       | 32 ++----------------
 arch/x86/kvm/vmx/vmenter.S      |  2 +-
 arch/x86/kvm/vmx/vmx.c          | 28 ++++++----------
 arch/x86/kvm/vmx/vmx.h          |  1 +
 arch/x86/kvm/vmx/vmx_ops.h      |  4 +--
 arch/x86/kvm/x86.c              |  9 ++++-
 arch/x86/kvm/x86.h              |  2 ++
 13 files changed, 117 insertions(+), 123 deletions(-)
 create mode 100644 arch/x86/kvm/svm/svm_ops.h
Signature · 1 line
2.29.2.729.g45daf8777d-goog