From mboxrd@z Thu Jan 1 00:00:00 1970 From: Avi Kivity Subject: Re: RFC: PIC: enhance IPI avoidance Date: Sun, 13 Jul 2008 19:00:43 +0300 Message-ID: <487A26AB.9000305@qumranet.com> References: <20080711210843.GA30887@dmt.cnet> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Cc: "Yang, Sheng" , kvm-devel To: Marcelo Tosatti Return-path: Received: from il.qumranet.com ([212.179.150.194]:11658 "EHLO il.qumranet.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751381AbYGMQAo (ORCPT ); Sun, 13 Jul 2008 12:00:44 -0400 In-Reply-To: <20080711210843.GA30887@dmt.cnet> Sender: kvm-owner@vger.kernel.org List-ID: Marcelo Tosatti wrote: > 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(). > > Looks good. > s->isr &= ~(1 << irq); > + s->isr_ack |= (1 << irq); > > s->isr &= ~(1 << irq); > + s->isr_ack |= (1 << irq); > > s->isr &= ~(1 << irq); > + s->isr_ack |= (1 << irq); > > s->pics_state->pics[0].isr &= ~(1 << 2); > + s->pics_state->pics[0].isr_ack |= (1 << 2); > > s->isr &= ~(1 << ret); > + s->isr_ack |= (1 << ret); > I already have a patch which consolidates isr clearing into a function, so I've queued it up and will push once it passes regression testing. Please rebase your patch on top of that. -- error compiling committee.c: too many arguments to function