From mboxrd@z Thu Jan 1 00:00:00 1970 From: Alex Williamson Subject: Re: [PATCH v3] kvm: Use a bitmap for tracking used GSIs Date: Tue, 12 May 2009 22:10:34 -0600 Message-ID: <1242187834.4878.29.camel@2710p.home> References: <20090508222925.5119.94814.stgit@dl380g6-3.ned.telco.ned.telco> <20090512220142.5663.72948.stgit@dl380g6-3.ned.telco.ned.telco> <200905131130.01846.sheng.yang@intel.com> <1242186123.4878.9.camel@2710p.home> Mime-Version: 1.0 Content-Type: text/plain Content-Transfer-Encoding: 7bit Cc: "kvm@vger.kernel.org" , "mst@redhat.com" To: "Yang, Sheng" Return-path: Received: from g1t0027.austin.hp.com ([15.216.28.34]:26523 "EHLO g1t0027.austin.hp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750703AbZEMEKy (ORCPT ); Wed, 13 May 2009 00:10:54 -0400 In-Reply-To: <1242186123.4878.9.camel@2710p.home> Sender: kvm-owner@vger.kernel.org List-ID: On Tue, 2009-05-12 at 21:42 -0600, Alex Williamson wrote: > On Wed, 2009-05-13 at 11:30 +0800, Yang, Sheng wrote: > > > + kvm->used_gsi_bitmap = malloc(gsi_bytes); > > > + if (!kvm->used_gsi_bitmap) { > > > + pthread_mutex_unlock(&kvm->gsi_mutex); > > > + goto out_close; > > > + } > > > + memset(kvm->used_gsi_bitmap, 0, gsi_bytes); > > > + kvm->max_gsi = gsi_bytes * 8; > > > > So max_gsi = gsi_count / 4? kvm->max_gsi actually becomes the number of GSIs available in the bitmap, which may be more than gsi_count if we rounded up. We preallocate GSIs between gsi_count and max_gsi to avoid using them. This just lets us not need to special case testing whether a bit in the last index is < gsi_count. Am I overlooking anything here? Thanks, Alex