OSDN Git Service

KVM: nVMX: clear PIN_BASED_POSTED_INTR from nested pinbased_ctls only when apicv...
authorVitaly Kuznetsov <vkuznets@redhat.com>
Thu, 20 Feb 2020 17:22:04 +0000 (18:22 +0100)
committerPaolo Bonzini <pbonzini@redhat.com>
Fri, 21 Feb 2020 17:05:35 +0000 (18:05 +0100)
commita4443267800af240072280c44521caab61924e55
treedb9faf1d7dfd402506fba6cf6397e7d1b186b10c
parent91a5f413af596ad01097e59bf487eb07cb3f1331
KVM: nVMX: clear PIN_BASED_POSTED_INTR from nested pinbased_ctls only when apicv is globally disabled

When apicv is disabled on a vCPU (e.g. by enabling KVM_CAP_HYPERV_SYNIC*),
nothing happens to VMX MSRs on the already existing vCPUs, however, all new
ones are created with PIN_BASED_POSTED_INTR filtered out. This is very
confusing and results in the following picture inside the guest:

$ rdmsr -ax 0x48d
ff00000016
7f00000016
7f00000016
7f00000016

This is observed with QEMU and 4-vCPU guest: QEMU creates vCPU0, does
KVM_CAP_HYPERV_SYNIC2 and then creates the remaining three.

L1 hypervisor may only check CPU0's controls to find out what features
are available and it will be very confused later. Switch to setting
PIN_BASED_POSTED_INTR control based on global 'enable_apicv' setting.

Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
Cc: stable@vger.kernel.org
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/x86/kvm/vmx/capabilities.h
arch/x86/kvm/vmx/nested.c
arch/x86/kvm/vmx/nested.h
arch/x86/kvm/vmx/vmx.c