From mboxrd@z Thu Jan 1 00:00:00 1970 From: Avi Kivity Subject: Re: KVM: PIC: enhance IPI avoidance Date: Wed, 24 Sep 2008 15:19:47 +0300 Message-ID: <48DA3063.2070402@redhat.com> References: <20080922165749.GA18733@dmt.cnet> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Cc: kvm-devel To: Marcelo Tosatti Return-path: Received: from mx2.redhat.com ([66.187.237.31]:57332 "EHLO mx2.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751418AbYIXMTv (ORCPT ); Wed, 24 Sep 2008 08:19:51 -0400 Received: from int-mx2.corp.redhat.com (int-mx2.corp.redhat.com [172.16.27.26]) by mx2.redhat.com (8.13.8/8.13.8) with ESMTP id m8OCJoep014175 for ; Wed, 24 Sep 2008 08:19:50 -0400 In-Reply-To: <20080922165749.GA18733@dmt.cnet> Sender: kvm-owner@vger.kernel.org List-ID: Marcelo Tosatti wrote: > KVM: PIC: enhance IPI avoidance > > The PIC code makes little effort to avoid kvm_vcpu_kick(), resulting in > unnecessary guest exits in some conditions. > > For example, if the timer interrupt is routed through the IOAPIC, IRR > for IRQ 0 will get set but not cleared, since the APIC is handling the > acks. > > This means that everytime an interrupt < 16 is triggered, the priority > logic will find IRQ0 pending and send an IPI to vcpu0 (in case IRQ0 is > not masked, which is Linux's case). > > Introduce a new variable isr_ack to represent the IRQ's for which the > guest has been signalled / cleared the ISR. Use it to avoid more than > one IPI per trigger-ack cycle, in addition to the avoidance when ISR is > set in get_priority(). > > Signed-off-by: Marcelo Tosatti > > struct kvm_pic *kvm_create_pic(struct kvm *kvm) > Index: kvm/arch/x86/kvm/irq.h > =================================================================== > --- kvm.orig/arch/x86/kvm/irq.h > +++ kvm/arch/x86/kvm/irq.h > @@ -42,6 +42,7 @@ struct kvm_kpic_state { > u8 irr; /* interrupt request register */ > u8 imr; /* interrupt mask register */ > u8 isr; /* interrupt service register */ > + u8 isr_ack; /* interrupt ack detection */ > u8 priority_add; /* highest irq priority */ > u8 irq_base; > u8 read_reg_select; > Needs to be cleared by reset and by register load from userspace, no? -- error compiling committee.c: too many arguments to function