aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2017-10-10 06:51:56 -0400
committerPaolo Bonzini <pbonzini@redhat.com>2017-10-12 08:01:54 -0400
commit1cf53587c03025885af359da3bd0be091aa34b53 (patch)
treefd3205a5e0df998685918af87e4ce92f70be0951
parentc1bd743e54cd653bd5e7082255dc236cfd40dbf0 (diff)
KVM: SVM: unconditionally wake up VCPU on IOMMU interrupt
Checking the mode is unnecessary, and is done without a memory barrier separating the LAPIC write from the vcpu->mode read; in addition, kvm_vcpu_wake_up is already doing a check for waiters on the wait queue that has the same effect. In practice it's safe because spin_lock has full-barrier semantics on x86, but don't be too clever. Reviewed-by: Radim Krčmář <rkrcmar@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
-rw-r--r--arch/x86/kvm/svm.c5
1 files changed, 1 insertions, 4 deletions
diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c
index 0e68f0b3cbf7..3e4337ee59cb 100644
--- a/arch/x86/kvm/svm.c
+++ b/arch/x86/kvm/svm.c
@@ -1034,15 +1034,12 @@ static int avic_ga_log_notifier(u32 ga_tag)
1034 } 1034 }
1035 spin_unlock_irqrestore(&svm_vm_data_hash_lock, flags); 1035 spin_unlock_irqrestore(&svm_vm_data_hash_lock, flags);
1036 1036
1037 if (!vcpu)
1038 return 0;
1039
1040 /* Note: 1037 /* Note:
1041 * At this point, the IOMMU should have already set the pending 1038 * At this point, the IOMMU should have already set the pending
1042 * bit in the vAPIC backing page. So, we just need to schedule 1039 * bit in the vAPIC backing page. So, we just need to schedule
1043 * in the vcpu. 1040 * in the vcpu.
1044 */ 1041 */
1045 if (vcpu->mode == OUTSIDE_GUEST_MODE) 1042 if (vcpu)
1046 kvm_vcpu_wake_up(vcpu); 1043 kvm_vcpu_wake_up(vcpu);
1047 1044
1048 return 0; 1045 return 0;