From mboxrd@z Thu Jan 1 00:00:00 1970 From: Avi Kivity Subject: Re: [PATCH 1/2] KVM: PIC: call ack notifiers for irqs that are dropped form irr Date: Thu, 26 Jul 2012 12:18:19 +0300 Message-ID: <50110B5B.7070707@redhat.com> References: <1343286046-8051-1-git-send-email-gleb@redhat.com> <50110950.5080208@redhat.com> <20120726091123.GT26120@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: kvm@vger.kernel.org, mtosatti@redhat.com To: Gleb Natapov Return-path: Received: from mx1.redhat.com ([209.132.183.28]:34338 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750736Ab2GZJSZ (ORCPT ); Thu, 26 Jul 2012 05:18:25 -0400 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q6Q9IPrC012004 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 26 Jul 2012 05:18:25 -0400 In-Reply-To: <20120726091123.GT26120@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: On 07/26/2012 12:11 PM, Gleb Natapov wrote: > On Thu, Jul 26, 2012 at 12:09:36PM +0300, Avi Kivity wrote: >> On 07/26/2012 10:00 AM, Gleb Natapov wrote: >> > After commit 242ec97c358256 PIT interrupts are no longer delivered after >> > PIC reset. It happens because PIT injects interrupt only if previous one >> > was acked, but since on PIC reset it is dropped from irr it will never >> > be delivered and hence acknowledged. Fix that by calling ack notifier on >> > PIC reset. >> > >> > Signed-off-by: Gleb Natapov >> > --- >> > arch/x86/kvm/i8259.c | 17 +++++++++++++++++ >> > 1 file changed, 17 insertions(+) >> > >> > diff --git a/arch/x86/kvm/i8259.c b/arch/x86/kvm/i8259.c >> > index 81cf4fa..0147d16 100644 >> > --- a/arch/x86/kvm/i8259.c >> > +++ b/arch/x86/kvm/i8259.c >> > @@ -305,6 +305,11 @@ static void pic_ioport_write(void *opaque, u32 addr, u32 val) >> > addr &= 1; >> > if (addr == 0) { >> > if (val & 0x10) { >> > + u8 edge_irr = s->irr & ~s->elcr; >> > + int i; >> > + bool found; >> > + struct kvm_vcpu *vcpu; >> > + >> > s->init4 = val & 1; >> > s->last_irr = 0; >> > s->irr &= s->elcr; >> > @@ -322,6 +327,18 @@ static void pic_ioport_write(void *opaque, u32 addr, u32 val) >> > if (val & 0x08) >> > pr_pic_unimpl( >> > "level sensitive irq not supported"); >> > + >> > + kvm_for_each_vcpu(i, vcpu, s->pics_state->kvm) >> > + if (kvm_apic_accept_pic_intr(vcpu)) { >> > + found = true; >> > + break; >> > + } >> > + >> > + >> > + if (found) >> > + for (irq = 0; irq < PIC_NUM_PINS/2; irq++) >> > + if (edge_irr & (1 << irq)) >> > + pic_clear_isr(s, irq); >> > } else if (val & 0x08) { >> >> >> This duplicates the code in pic_reset(). Please extract it into a >> function (just the new code, since this is going into 3.6). >> >> > Extract what into a function? I specifically sent follow up patch to > cleanup duplicates. So you did. I didn't even look at it because I wasn't going to send cleanup patches to 3.6. I'll apply to master then. Please repost the cleanup once 3.6 is updated. -- error compiling committee.c: too many arguments to function