From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ian Campbell Subject: Re: [PATCH v4 16/21] libxl: build, check and pass vNUMA info to Xen for HVM guest Date: Wed, 28 Jan 2015 16:41:05 +0000 Message-ID: <1422463265.5187.62.camel@citrix.com> References: <1422011632-22018-1-git-send-email-wei.liu2@citrix.com> <1422011632-22018-17-git-send-email-wei.liu2@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1422011632-22018-17-git-send-email-wei.liu2@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: Wei Liu Cc: ufimtseva@gmail.com, andrew.cooper3@citrix.com, dario.faggioli@citrix.com, ian.jackson@eu.citrix.com, xen-devel@lists.xen.org, JBeulich@suse.com List-Id: xen-devel@lists.xenproject.org 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? > + 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). Ian.