From mboxrd@z Thu Jan 1 00:00:00 1970 From: Alex Williamson Subject: Re: [PATCH v6] kvm: Use a bitmap for tracking used GSIs Date: Mon, 18 May 2009 16:32:23 -0600 Message-ID: <1242685943.4700.102.camel@lappy> References: <20090513150815.8221.49221.stgit@dl380g6-3.ned.telco.ned.telco> <20090513172350.8722.70990.stgit@dl380g6-3.ned.telco.ned.telco> <4A10798E.4030301@redhat.com> Mime-Version: 1.0 Content-Type: text/plain Content-Transfer-Encoding: 7bit Cc: kvm@vger.kernel.org, sheng.yang@intel.com, mst@redhat.com To: Avi Kivity Return-path: Received: from g1t0027.austin.hp.com ([15.216.28.34]:27722 "EHLO g1t0027.austin.hp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751979AbZERWcY (ORCPT ); Mon, 18 May 2009 18:32:24 -0400 In-Reply-To: <4A10798E.4030301@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: On Sun, 2009-05-17 at 23:54 +0300, Avi Kivity wrote: > Alex Williamson wrote: > > We're currently using a counter to track the most recent GSI we've > > handed out. This quickly hits KVM_MAX_IRQ_ROUTES when using device > > assignment with a driver that regularly toggles the MSI enable bit. > > This can mean only a few minutes of usable run time. Instead, track > > used GSIs in a bitmap. > > > > v6: Make use of ALIGN macro, per Michael > > Define KVM_IOAPIC_NUM_PINS if not already, per Michael > > > > Due to me being slow I nacked this after you prepared the new patch. Sorry. > > We could define have platform_gsis passed from qemu to tell us how many > GSIs to reserve (let's pretend libkvm isn't on death row for a moment). Perhaps we should update the bitmap on entry points that everyone uses so we don't have to worry about preallocating. We could set the bitmap in kvm_add_routing_entry() and clear it in kvm_del_routing_entry(). This would mean that kvm_del_routing_entry() implicitly gives up a GSI obtained via kvm_get_irq_route_gsi(), which seems to be the assumption already. That would eliminate any need for proliferating KVM_CAP_IRQ_ROUTING ifdefs or doing anything based on KVM_IOAPIC_NUM_PINS, but should I keep the KVM_CAP_IRQ_ROUTING around the new code for documentation purposes? Thanks, Alex