From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932101AbdJJK5f (ORCPT ); Tue, 10 Oct 2017 06:57:35 -0400 Received: from mail-wm0-f65.google.com ([74.125.82.65]:51869 "EHLO mail-wm0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755221AbdJJK5d (ORCPT ); Tue, 10 Oct 2017 06:57:33 -0400 X-Google-Smtp-Source: AOwi7QAJzbU7RPszFg2BDmGTsDmoITzcxyymC5sXYUb1kIPfEvQpKm7j91DD4s399hh58Bmyiqxv8A== From: Paolo Bonzini To: linux-kernel@vger.kernel.org, kvm@vger.kernel.org Cc: suravee.suthikulpanit@amd.com, rkrcmar@redhat.com Subject: [PATCH] KVM: SVM: unconditionally wake up VCPU on IOMMU interrupt Date: Tue, 10 Oct 2017 12:57:29 +0200 Message-Id: <1507633049-63191-1-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. Signed-off-by: Paolo Bonzini --- arch/x86/kvm/svm.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c index 01e6e8fab5d6..712406f725a2 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) } spin_unlock_irqrestore(&svm_vm_data_hash_lock, flags); - if (!vcpu) - return 0; - /* Note: * At this point, the IOMMU should have already set the pending * bit in the vAPIC backing page. So, we just need to schedule * in the vcpu. */ - if (vcpu->mode == OUTSIDE_GUEST_MODE) + if (vcpu) kvm_vcpu_wake_up(vcpu); return 0; -- 1.8.3.1