From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andrew Cooper Subject: Re: [PATCHv6 5/5] gnttab: use per-VCPU maptrack free lists Date: Fri, 24 Apr 2015 11:02:01 +0100 Message-ID: <553A1499.4050708@citrix.com> References: <1429718436-9782-1-git-send-email-david.vrabel@citrix.com> <1429718436-9782-6-git-send-email-david.vrabel@citrix.com> <553935E402000078000755B7@mail.emea.novell.com> <553A0846.3030509@citrix.com> <553A2E0D0200007800075869@mail.emea.novell.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1YlaQx-0002G5-60 for xen-devel@lists.xenproject.org; Fri, 24 Apr 2015 10:02:07 +0000 In-Reply-To: <553A2E0D0200007800075869@mail.emea.novell.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Jan Beulich , David Vrabel , Malcolm Crossley Cc: KeirFraser , IanCampbell , Christoph Egger , Tim Deegan , Matt Wilson , xen-devel@lists.xenproject.org List-Id: xen-devel@lists.xenproject.org On 24/04/15 10:50, Jan Beulich wrote: >>>> On 24.04.15 at 11:09, wrote: >> On 23/04/15 17:11, Jan Beulich wrote: >>>>>> On 22.04.15 at 18:00, wrote: >>>> --- a/xen/include/xen/grant_table.h >>>> +++ b/xen/include/xen/grant_table.h >>>> @@ -60,6 +60,8 @@ struct grant_mapping { >>>> u32 ref; /* grant ref */ >>>> u16 flags; /* 0-4: GNTMAP_* ; 5-15: unused */ >>>> domid_t domid; /* granting domain */ >>>> + u32 vcpu; /* vcpu which created the grant mapping */ >>>> + u16 pad[2]; >>>> }; >>> What is this pad[] good for? >> The pad is to keep the struct power of 2 sized because this allows the >> compiler to optimise these macro's to right and left shifts: >> >> #define MAPTRACK_PER_PAGE (PAGE_SIZE / sizeof(struct grant_mapping)) >> #define maptrack_entry(t, e) \ >> ((t)->maptrack[(e)/MAPTRACK_PER_PAGE][(e)%MAPTRACK_PER_PAGE]) > Okay, then why u16[2] instead of u32? And please add a brief > comment explaining the reason. Most likely because vcpu was a u16 in the first draft, and got bumped during internal review. > > Apart from that I wonder whether fitting vcpu in the 10 unused > flags bits (not 11, as the comment on the field suggests) would be > an option. That would require limiting vCPU count to 4k, which I > don't think would really be a problem for anyone. 8k VCPU PV guests do function, and are very good at finding scalability limits. It would be nice not to break this. ~Andrew