From mboxrd@z Thu Jan 1 00:00:00 1970 From: Gleb Natapov Subject: Re: [PATCH v2 0/5] ioapic/lapic/msi cleanup Date: Fri, 6 Mar 2009 08:06:02 +0200 Message-ID: <20090306060602.GB6510@redhat.com> References: <20090305143438.31443.51019.stgit@dhcp-1-237.tlv.redhat.com> <20090305223436.GA7818@amt.cnet> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: avi@redhat.com, kvm@vger.kernel.org To: Marcelo Tosatti Return-path: Received: from mx2.redhat.com ([66.187.237.31]:51955 "EHLO mx2.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751002AbZCFGJ3 (ORCPT ); Fri, 6 Mar 2009 01:09:29 -0500 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 n2669RSw020008 for ; Fri, 6 Mar 2009 01:09:27 -0500 Content-Disposition: inline In-Reply-To: <20090305223436.GA7818@amt.cnet> Sender: kvm-owner@vger.kernel.org List-ID: On Thu, Mar 05, 2009 at 07:34:36PM -0300, Marcelo Tosatti wrote: > On Thu, Mar 05, 2009 at 04:34:38PM +0200, Gleb Natapov wrote: > > There are many code/logic duplications throughout ioapic/lapic/msi device > > emulation. Try to consolidate as much code as possible. > > > > --- > > > > Gleb Natapov (5): > > Get rid of deliver_bitmask. > > Change the way how lowest priority vcpu is calculated. > > Consolidate ioapic/ipi interrupt delivery logic. > > ioapic/msi interrupt delivery consolidation. > > Make kvm_apic_set_irq() deliver all kinds of interrupts. > > Applied and pushed, thanks. > > There is one issue with the new low prio selection though. Say you have > an interrupt whose load is shared between all vcpus in the guest. > > The first vcpu which has its counter overflowed will then handle the int > load by itself until it approximates to the counter of the other vcpus. > I took this in account. The priority counter is signed, so if say vcpu1 counter is overflows to 0x7fffffff + 1 and the vcpu2 counter is still 0x7fffffff then vcpu1 - vcpu2 = 1 and vcpu2 will be chosen to deliver interrupts. > Same happens with cpu hotplug. > For got about hotplug :( > Not sure that the best way is to fix that. Perhaps reset all online > vcpus to 0 on overflow/cpu-hotplug ? > Yes, rest counters on hotplug should work and is rare event. > Or max the counter to a smaller value like 64 or something. I'll try this and see how well interrupts will be spread between CPUs. -- Gleb.