From mboxrd@z Thu Jan 1 00:00:00 1970 From: Juergen Gross Subject: Re: [PATCH 3 of 4] Extend cpupools to support numa Date: Wed, 08 Dec 2010 13:07:50 +0100 Message-ID: <4CFF7516.90909@ts.fujitsu.com> References: <1291805935.13966.4513.camel@zakaz.uk.xensource.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1291805935.13966.4513.camel@zakaz.uk.xensource.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Ian Campbell Cc: "xen-devel@lists.xensource.com" List-Id: xen-devel@lists.xenproject.org On 12/08/10 11:58, Ian Campbell wrote: > See previous comments about the interface to libxl_get_topoplogy and > leaking the returned pointer value. > > On Fri, 2010-11-26 at 07:10 +0000, Juergen Gross wrote: >> + if (libxl_get_freecpus(&ctx,&freemap)) { >> + fprintf(stderr, "libxl_get_freecpus failed\n"); >> + return -ERROR_FAIL; >> + } >> + >> + topology = libxl_get_topologyinfo(&ctx); >> + if (topology == NULL) { >> + fprintf(stderr, "libxl_get_topologyinfo failed\n"); >> + return -ERROR_FAIL; >> + } >> + >> + n = 0; >> + for (cpu = 0; cpu< topology->nodemap.entries; cpu++) { >> + if (libxl_cpumap_test(&freemap, cpu)&& >> + (topology->nodemap.array[cpu] == node)&& >> + !libxl_cpupool_cpuadd(&ctx, poolid, cpu)) { >> + n++; >> + } >> + } > > This sequence of actions look like they would make a useful addition to > the libxl interface as a helper function. > > Not sure what it would be called, perhaps: > libxl_cpupool_cpuadd_node(&ctx, poolid, node) > ? Okay. > >> + for (p = 0; p< n_pools; p++) { >> + if (poolinfo[p].poolid == poolid) { >> + for (cpu = 0; cpu< topology->nodemap.entries; cpu++) { >> + if ((topology->nodemap.array[cpu] == node)&& >> + libxl_cpumap_test(&poolinfo[p].cpumap, cpu)&& >> + !libxl_cpupool_cpuremove(&ctx, poolid, cpu)) { >> + n++; >> + } >> + } >> + } >> + } > > also a helper function? > > libxl_cpupool_cpuremove_node(&ctx, poolid, node) Okay. > > Isn't there an existing function to find a poolinfo from a poolid? (if > not then should there be?) Currently it is only possible to get infos for ALL cpupools. As the number of cpupools is expected to be not very large, this should be no problem. Perhaps it would make sense to create a helper function to locate the correct poolinfo member based on the poolid. Juergen -- Juergen Gross Principal Developer Operating Systems TSP ES&S SWE OS6 Telephone: +49 (0) 89 3222 2967 Fujitsu Technology Solutions e-mail: juergen.gross@ts.fujitsu.com Domagkstr. 28 Internet: ts.fujitsu.com D-80807 Muenchen Company details: ts.fujitsu.com/imprint.html