From mboxrd@z Thu Jan 1 00:00:00 1970 From: Wanpeng Li Subject: Re: [PATCH 2/5] KVM: x86: ioapic: Don't fire level irq when Remote IRR set Date: Mon, 6 Nov 2017 10:50:49 +0800 Message-ID: References: <20171105135233.34572-1-nikita.leshchenko@oracle.com> <20171105135233.34572-3-nikita.leshchenko@oracle.com> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Cc: kvm , Paolo Bonzini , Radim Krcmar , idan.brown@oracle.com, Konrad Rzeszutek Wilk To: Nikita Leshenko Return-path: Received: from mail-oi0-f67.google.com ([209.85.218.67]:46643 "EHLO mail-oi0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750778AbdKFCuu (ORCPT ); Sun, 5 Nov 2017 21:50:50 -0500 Received: by mail-oi0-f67.google.com with SMTP id n82so6021220oig.3 for ; Sun, 05 Nov 2017 18:50:50 -0800 (PST) In-Reply-To: <20171105135233.34572-3-nikita.leshchenko@oracle.com> Sender: kvm-owner@vger.kernel.org List-ID: 2017-11-05 21:52 GMT+08:00 Nikita Leshenko : > Avoid firing a level-triggered interrupt that has the Remote IRR bit set, > because that means that some CPU is already processing it. The Remote > IRR bit will be cleared after an EOI and the interrupt will refire > if the irq line is still asserted. > > This behavior is aligned with QEMU's IOAPIC implementation that was > introduced by commit f99b86b94987 > ("x86: ioapic: ignore level irq during processing") in QEMU. > > Signed-off-by: Nikita Leshenko > Reviewed-by: Liran Alon > Signed-off-by: Konrad Rzeszutek Wilk Reviewed-by: Wanpeng Li > --- > arch/x86/kvm/ioapic.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/arch/x86/kvm/ioapic.c b/arch/x86/kvm/ioapic.c > index ae0a7dc318b2..5c9231139243 100644 > --- a/arch/x86/kvm/ioapic.c > +++ b/arch/x86/kvm/ioapic.c > @@ -323,7 +323,9 @@ static int ioapic_service(struct kvm_ioapic *ioapic, int irq, bool line_status) > struct kvm_lapic_irq irqe; > int ret; > > - if (entry->fields.mask) > + if (entry->fields.mask || > + (entry->fields.trig_mode == IOAPIC_LEVEL_TRIG && > + entry->fields.remote_irr)) > return -1; > > ioapic_debug("dest=%x dest_mode=%x delivery_mode=%x " > -- > 2.13.3 >