aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorWanpeng Li <wanpeng.li@linux.intel.com>2014-08-05 00:42:23 -0400
committerPaolo Bonzini <pbonzini@redhat.com>2014-08-05 08:50:45 -0400
commitf3380ca5d7edb5e31932998ab2e29dfdce39c5ed (patch)
tree78d027d6532cbba584229b0062e2f29172c6de9f /arch
parent25a2150bee00b4d996487552948b9b3ba21d0257 (diff)
KVM: nVMX: Fix nested vmexit ack intr before load vmcs01
An external interrupt will cause a vmexit with reason "external interrupt" when L2 is running. L1 will pick up the interrupt through vmcs12 if L1 set the ack interrupt bit. Commit 77b0f5d (KVM: nVMX: Ack and write vector info to intr_info if L1 asks us to) retrieves the interrupt that belongs to L1 before vmcs01 is loaded. This will lead to problems in the next patch, which would write to SVI of vmcs02 instead of vmcs01 (SVI of vmcs02 doesn't make sense because L2 runs without APICv). Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Tested-by: Liu, RongrongX <rongrongx.liu@intel.com> Tested-by: Felipe Reyes <freyes@suse.com> Fixes: 77b0f5d67ff2781f36831cba79674c3e97bd7acf Cc: stable@vger.kernel.org Signed-off-by: Wanpeng Li <wanpeng.li@linux.intel.com> [Move tracepoint as well. - Paolo] Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'arch')
-rw-r--r--arch/x86/kvm/vmx.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
index e618f34bde2d..bfe11cf124a1 100644
--- a/arch/x86/kvm/vmx.c
+++ b/arch/x86/kvm/vmx.c
@@ -8754,6 +8754,8 @@ static void nested_vmx_vmexit(struct kvm_vcpu *vcpu, u32 exit_reason,
8754 prepare_vmcs12(vcpu, vmcs12, exit_reason, exit_intr_info, 8754 prepare_vmcs12(vcpu, vmcs12, exit_reason, exit_intr_info,
8755 exit_qualification); 8755 exit_qualification);
8756 8756
8757 vmx_load_vmcs01(vcpu);
8758
8757 if ((exit_reason == EXIT_REASON_EXTERNAL_INTERRUPT) 8759 if ((exit_reason == EXIT_REASON_EXTERNAL_INTERRUPT)
8758 && nested_exit_intr_ack_set(vcpu)) { 8760 && nested_exit_intr_ack_set(vcpu)) {
8759 int irq = kvm_cpu_get_interrupt(vcpu); 8761 int irq = kvm_cpu_get_interrupt(vcpu);
@@ -8769,8 +8771,6 @@ static void nested_vmx_vmexit(struct kvm_vcpu *vcpu, u32 exit_reason,
8769 vmcs12->vm_exit_intr_error_code, 8771 vmcs12->vm_exit_intr_error_code,
8770 KVM_ISA_VMX); 8772 KVM_ISA_VMX);
8771 8773
8772 vmx_load_vmcs01(vcpu);
8773
8774 vm_entry_controls_init(vmx, vmcs_read32(VM_ENTRY_CONTROLS)); 8774 vm_entry_controls_init(vmx, vmcs_read32(VM_ENTRY_CONTROLS));
8775 vm_exit_controls_init(vmx, vmcs_read32(VM_EXIT_CONTROLS)); 8775 vm_exit_controls_init(vmx, vmcs_read32(VM_EXIT_CONTROLS));
8776 vmx_segment_cache_clear(vmx); 8776 vmx_segment_cache_clear(vmx);