linux/arch/x86/kvm/vmx
Vitaly Kuznetsov 250552b925 KVM: nVMX: Don't use Enlightened MSR Bitmap for L3
When KVM runs as a nested hypervisor on top of Hyper-V it uses Enlightened
VMCS and enables Enlightened MSR Bitmap feature for its L1s and L2s (which
are actually L2s and L3s from Hyper-V's perspective). When MSR bitmap is
updated, KVM has to reset HV_VMX_ENLIGHTENED_CLEAN_FIELD_MSR_BITMAP from
clean fields to make Hyper-V aware of the change. For KVM's L1s, this is
done in vmx_disable_intercept_for_msr()/vmx_enable_intercept_for_msr().
MSR bitmap for L2 is build in nested_vmx_prepare_msr_bitmap() by blending
MSR bitmap for L1 and L1's idea of MSR bitmap for L2. KVM, however, doesn't
check if the resulting bitmap is different and never cleans
HV_VMX_ENLIGHTENED_CLEAN_FIELD_MSR_BITMAP in eVMCS02. This is incorrect and
may result in Hyper-V missing the update.

The issue could've been solved by calling evmcs_touch_msr_bitmap() for
eVMCS02 from nested_vmx_prepare_msr_bitmap() unconditionally but doing so
would not give any performance benefits (compared to not using Enlightened
MSR Bitmap at all). 3-level nesting is also not a very common setup
nowadays.

Don't enable 'Enlightened MSR Bitmap' feature for KVM's L2s (real L3s) for
now.

Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
Message-Id: <20211129094704.326635-2-vkuznets@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2021-12-08 04:53:13 -05:00
..
capabilities.h KVM: x86: Use common 'enable_apicv' variable for both APICv and AVIC 2021-06-17 13:09:33 -04:00
evmcs.c KVM: nVMX: Filter out all unsupported controls when eVMCS was activated 2021-09-22 10:33:15 -04:00
evmcs.h x86/kvm: Always inline evmcs_write64() 2021-09-15 15:51:46 +02:00
nested.c KVM: VMX: Set failure code in prepare_vmcs02() 2021-12-02 04:12:11 -05:00
nested.h KVM: nVMX: Introduce 'EVMPTR_MAP_PENDING' post-migration state 2021-06-17 13:09:49 -04:00
pmu_intel.c kvm: x86: Convert return type of *is_valid_rdpmc_ecx() to bool 2021-11-11 10:56:19 -05:00
posted_intr.c KVM: x86: Use a stable condition around all VT-d PI paths 2021-11-30 03:53:14 -05:00
posted_intr.h KVM: VMX: update vcpu posted-interrupt descriptor when assigning device 2021-05-27 07:58:23 -04:00
sgx.c KVM: x86: SGX must obey the KVM_INTERNAL_ERROR_EMULATION protocol 2021-10-25 06:48:25 -04:00
sgx.h KVM: VMX: Enable SGX virtualization for SGX1, SGX2 and LC 2021-04-20 04:18:56 -04:00
vmcs12.c KVM: x86: Clean up redundant ROL16(val, n) macro definition 2021-08-13 03:35:16 -04:00
vmcs12.h KVM: x86: Clean up redundant ROL16(val, n) macro definition 2021-08-13 03:35:16 -04:00
vmcs_shadow_fields.h KVM: Fix some out-dated function names in comment 2020-01-21 13:57:27 +01:00
vmcs.h KVM: x86: Clean up redundant ROL16(val, n) macro definition 2021-08-13 03:35:16 -04:00
vmenter.S KVM/nVMX: Use __vmx_vcpu_run in nested_vmx_check_vmentry_hw 2021-02-04 05:27:32 -05:00
vmx_ops.h KVM: x86: Move declaration of kvm_spurious_fault() to x86.h 2021-08-13 03:35:16 -04:00
vmx.c KVM: nVMX: Don't use Enlightened MSR Bitmap for L3 2021-12-08 04:53:13 -05:00
vmx.h KVM: nVMX: Use a gfn_to_hva_cache for vmptrld 2021-11-18 02:03:43 -05:00