From: "Jan Beulich" Subject: Re: [RFC v2 08/15] Update IRTE according to guest interrupt config changes Date: Tue, 16 Jun 2015 09:17:29 +0100 Message-ID: <557FF7B9020000780008549D@mail.emea.novell.com> References: <1431076038-7497-1-git-send-email-feng.wu@intel.com> <1431076038-7497-9-git-send-email-feng.wu@intel.com> <55771CFD0200007800082BB4@mail.emea.novell.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: Content-Disposition: inline List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Feng Wu Cc: Kevin Tian , "keir@xen.org" , "george.dunlap@eu.citrix.com" , "andrew.cooper3@citrix.com" , "xen-devel@lists.xen.org" , Yang Z Zhang List-Id: xen-devel@lists.xenproject.org >>> On 16.06.15 at 10:08, wrote: >> From: Jan Beulich [mailto:JBeulich@suse.com] >> Sent: Tuesday, June 09, 2015 11:06 PM >> >>> On 08.05.15 at 11:07, wrote: >> > + dest_vcpu_array = xzalloc_array(struct vcpu *, d->max_vcpus); >> >> You realize that this can be quite big an allocation? (You could at >> least halve it by storing vCPU IDs instead of pointers, but if I'm >> not mistaken this could even be a simple bitmap.) > > I think maybe storing the vCPU IDs is better than using bitmap, because > If using vCPU IDs, we can easily to find the destination vCPU id by > dest_vcpu_id_array [gvec % dest_vcpu_num], > then we can get the vcpu form d->vcpu[]. However if we use bitmap here, we set > the bits for those vCPUs which > is present in the destination field, then we need to use find_next_bit() to > find the right vCPU ID, this may need > a while loop, see the following scenario: > > - Guest has 8 vCPUs, in the interrupt destination fields, it only configures > vcpu 0, 1, 3, 4, 5, 7 for the lowest-priority interrupt. > So we get the vCPU destination bitmap like this: 10111011b > - Suppose guest vector is 44, so we choose 44%6=2, we need to use > find_next_bit() to find the second set bit (counting from 0, which is vCPU ID > 3), this may need a while loop. > > What is your opinion about this? Space vs Speed? Since the array can get rather large (in particular, larger than a page), space would seem the more important factor here. Also - please trim your replies. Jan