From: Wei Liu Subject: Re: [PATCH v4 16/21] libxl: build, check and pass vNUMA info to Xen for HVM guest Date: Wed, 28 Jan 2015 22:14:45 +0000 Message-ID: <20150128221445.GE14935@zion.uk.xensource.com> References: <1422011632-22018-1-git-send-email-wei.liu2@citrix.com> <1422011632-22018-17-git-send-email-wei.liu2@citrix.com> <1422463265.5187.62.camel@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Content-Disposition: inline In-Reply-To: <1422463265.5187.62.camel@citrix.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: Ian Campbell Cc: Wei Liu , JBeulich@suse.com, andrew.cooper3@citrix.com, dario.faggioli@citrix.com, ian.jackson@eu.citrix.com, xen-devel@lists.xen.org, ufimtseva@gmail.com List-Id: xen-devel@lists.xenproject.org On Wed, Jan 28, 2015 at 04:41:05PM +0000, Ian Campbell wrote: > On Fri, 2015-01-23 at 11:13 +0000, Wei Liu wrote: > > + if (info->num_vnuma_nodes != 0) { > > + int i; > > + > > + args.nr_vnuma_info = info->num_vnuma_nodes; > > + args.vnuma_info = libxl__malloc(gc, sizeof(*args.vnuma_info) * > > + args.nr_vnuma_info); > > + for (i = 0; i < args.nr_vnuma_info; i++) { > > + args.vnuma_info[i].vnode = i; > > + args.vnuma_info[i].pnode = info->vnuma_nodes[i].pnode; > > + args.vnuma_info[i].pages = info->vnuma_nodes[i].memkb >> 2; > > + } > > + > > + /* Consider video ram belongs to node 0 */ > > + args.vnuma_info[0].pages -= (info->video_memkb >> 2); > > You need to check that the node is big enough I think? > Right. > > + if (next >= hole_start && next < hole_end) > > + next = hole_end; > > + if ((next < hole_start) && (next + remaining_bytes >= hole_start)) > > + count = hole_start - next; > > + > > + GCREALLOC_ARRAY(vmemranges, nr_vmemrange+1); > > Given there's only a single hole, can't you calculate the final > nr_vmemrange value up front? (i.e. it's 2, I think). > I would like to keep the algorithm more flexible here so that we can incorporate e820_host option for hvm guest in the future. Wei. > Ian.