From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Yang, Sheng" Subject: Re: [PATCH v3] kvm: Use a bitmap for tracking used GSIs Date: Wed, 13 May 2009 12:15:32 +0800 Message-ID: <200905131215.33413.sheng.yang@intel.com> References: <20090508222925.5119.94814.stgit@dl380g6-3.ned.telco.ned.telco> <1242186123.4878.9.camel@2710p.home> <1242187834.4878.29.camel@2710p.home> Mime-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Cc: "kvm@vger.kernel.org" , "mst@redhat.com" To: Alex Williamson Return-path: Received: from mga11.intel.com ([192.55.52.93]:49288 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750843AbZEMEOp (ORCPT ); Wed, 13 May 2009 00:14:45 -0400 In-Reply-To: <1242187834.4878.29.camel@2710p.home> Content-Disposition: inline Sender: kvm-owner@vger.kernel.org List-ID: On Wednesday 13 May 2009 12:10:34 Alex Williamson wrote: > 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, > Oh, I understand that, and I just follow the logic of last comment here(which "gsi_bytes = (gsi_count + 31) / 32" )... Sorry for confusion... -- regards Yang, Sheng