Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756902AbcLSJrg (ORCPT ); Mon, 19 Dec 2016 04:47:36 -0500 Received: from mail-wm0-f65.google.com ([74.125.82.65]:34646 "EHLO mail-wm0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755214AbcLSJrb (ORCPT ); Mon, 19 Dec 2016 04:47:31 -0500 From: Paolo Bonzini To: linux-kernel@vger.kernel.org, kvm@vger.kernel.org Cc: rkrcmar@redhat.com, rkagan@virtuozzo.com, dplotnikov@virtuozzo.com Subject: [PATCH 6/6] KVM: lapic: do not scan IRR when delivering an interrupt Date: Mon, 19 Dec 2016 10:47:18 +0100 Message-Id: <1482140838-6303-7-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1482140838-6303-1-git-send-email-pbonzini@redhat.com> References: <1482140838-6303-1-git-send-email-pbonzini@redhat.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1282 Lines: 44 On interrupt delivery the PPR can only grow, so it is impossible that interrupt delivery results in KVM_REQ_EVENT. Make this clear by using __apic_update_ppr, and by not using apic_*_isr for Hyper-V auto-EOI interrupts. Signed-off-by: Paolo Bonzini --- arch/x86/kvm/lapic.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lapic.c index dc4ea8bdea9c..4dc02482faf7 100644 --- a/arch/x86/kvm/lapic.c +++ b/arch/x86/kvm/lapic.c @@ -2110,6 +2110,7 @@ int kvm_get_apic_interrupt(struct kvm_vcpu *vcpu) { int vector = kvm_apic_has_interrupt(vcpu); struct kvm_lapic *apic = vcpu->arch.apic; + u32 ppr; if (vector == -1) return -1; @@ -2121,15 +2122,11 @@ int kvm_get_apic_interrupt(struct kvm_vcpu *vcpu) * because the process would deliver it through the IDT. */ - apic_set_isr(vector, apic); - apic_update_ppr(apic); - apic_clear_irr(vector, apic); - - if (test_bit(vector, vcpu_to_synic(vcpu)->auto_eoi_bitmap)) { - apic_clear_isr(vector, apic); - apic_update_ppr(apic); - } + if (!test_bit(vector, vcpu_to_synic(vcpu)->auto_eoi_bitmap)) + apic_set_isr(vector, apic); + apic_clear_irr(vector, apic); + __apic_update_ppr(apic, &ppr); return vector; } -- 1.8.3.1