Skip to content

KVM: nVMX: Defer error from VM-entry MSR-load area to until after hardware verifies VMCS guest state-area

Krish Sadhukhan kvm 2 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest2 patches 1 replyIn review
  2. v11 patch 5 repliesSuperseded

Changes in v2 from the cover letter

1. In patch# 1, the invalid VM-entry MSR-load area for vmcs02 is now a system-wide entity. It is allocated and initialized during VMX initialization. The exit qualification is now contained in a 32-bit variable in 'struct nested_vmx'.
2. Patch# 2 is new. It rolls back MSR updates when VM-entry fails due to invalid VM-entry MSR-load area.

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2KVM: nVMX: Defer error from VM-entry MSR-load area to until after hardware verifies VMCS guest state-areaarch/x86/kvm/vmx/nested.c arch/x86/kvm/vmx/nested.h arch/x86/kvm/vmx/vmx.c +1 more+68 -50 replies
2/2KVM: nVMX: Rollback MSR-load if VM-entry fails due to VM-entry MSR-loadingarch/x86/kvm/vmx/nested.c arch/x86/kvm/vmx/nested.h arch/x86/kvm/vmx/vmx.h+74 -101 reply

Reviews trailers per patch

All 2 patches have a Reviewed-by or Acked-by.

PatchKarl HeubaumMihai CarabasLiran Alon
1/2R-b R-b
2/2R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 3 reviewers.

Read the v2 thread

Cover letter [PATCH 0/2 v2] KVM: nVMX: Defer error from VM-entry MSR-load area to until after hardware verifies VMCS guest state-area

v1 -> v2:
1. In patch# 1, the invalid VM-entry MSR-load area for vmcs02 is now a system-wide entity. It is allocated and initialized during VMX initialization. The exit qualification is now contained in a 32-bit variable in 'struct nested_vmx'.
2. Patch# 2 is new. It rolls back MSR updates when VM-entry fails due to invalid VM-entry MSR-load area.

Some VM-entry checks can be offloaded from KVM to hardware. But if we want to do that, the current implementation of KVM creates a priority issue where the order in which VM-entry checks need to be performed according to the SDM, is not maintained. VM-entry fails in nested_vmx_enter_non_root_mode() if an error is encountered while processing the entries in VM-entry MSR-load area. This leads to VM-exit due to a VM-entry check that is supposed to be done after any guest-state checks done in hardware. This patch fixes this priority issue so that checks that can be offloaded to hardware can now be offloaded.

[PATCH 1/2 v2] nVMX: Defer error from VM-entry MSR-load area to until [PATCH 2/2 v2] nVMX: Rollback MSR-load if VM-entry fails due to VM-entry

 arch/x86/kvm/vmx/nested.c | 84 +++++++++++++++++++++++++++++++++++++++++++----
 arch/x86/kvm/vmx/nested.h | 29 ++++++++++++++--
 arch/x86/kvm/vmx/vmx.c    | 18 ++++++++++
 arch/x86/kvm/vmx/vmx.h    | 14 ++++++++
 4 files changed, 136 insertions(+), 9 deletions(-)

Krish Sadhukhan (2):
nVMX: Defer error from VM-entry MSR-load area to until after hardware verifies VMCS guest state-area
nVMX: Rollback MSR-load if VM-entry fails due to VM-entry MSR-loading