From mboxrd@z Thu Jan 1 00:00:00 1970 From: Dario Faggioli Subject: [PATCH 3 of 3] xl: allow for node-wise specification of vcpu pinning Date: Tue, 16 Oct 2012 19:26:28 +0200 Message-ID: <6d7a403305dd057f61bd.1350408388@Solace> References: Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: xen-devel@lists.xen.org Cc: Andre Przywara , Ian Jackson , Ian Campbell List-Id: xen-devel@lists.xenproject.org Making it possible to use something like the following: * "nodes:0-3": all pCPUs of nodes 0,1,2,3; * "nodes:0-3,^node:2": all pCPUS of nodes 0,1,3; * "1,nodes:1-2,^6": pCPU 1 plus all pCPUs of nodes 1,2 but not pCPU 6; * ... In both domain config file and `xl vcpu-pin'. Signed-off-by: Dario Faggioli diff --git a/docs/man/xl.cfg.pod.5 b/docs/man/xl.cfg.pod.5 --- a/docs/man/xl.cfg.pod.5 +++ b/docs/man/xl.cfg.pod.5 @@ -109,7 +109,7 @@ some cpus on its own (see below). A C cpuidb) { + idb = strtoul(tokb, &endptr, 10); + if (endptr == tokb || ida > idb) { fprintf(stderr, "Error: Invalid argument.\n"); rc = EINVAL; goto vcpp_out; } } - while (cpuida <= cpuidb) { - rmcpu == 0 ? libxl_bitmap_set(cpumap, cpuida) : - libxl_bitmap_set(&exclude_cpumap, cpuida); - cpuida++; - } - } - - /* Clear all the cpus from the removal list */ + while (ida <= idb) { + if (!isnode) + isnot == 0 ? libxl_bitmap_set(cpumap, ida) : + libxl_bitmap_set(&exclude_cpumap, ida); + else + isnot == 0 ? libxl_bitmap_set(&nodemap, ida) : + libxl_bitmap_set(&exclude_nodemap, ida); + ida++; + } + } + + /* Add the cpus that have been specified via "node:" items */ + rc = libxl_nodemap_to_cpumap(ctx, &nodemap, &cpu_nodemap); + if (rc) + goto vcpp_out; + libxl_for_each_set_bit(i, cpu_nodemap) { + libxl_bitmap_set(cpumap, i); + } + + /* Clear all the cpus from the removal cpu and node lists */ libxl_for_each_set_bit(i, exclude_cpumap) { libxl_bitmap_reset(cpumap, i); } + rc = libxl_nodemap_to_cpumap(ctx, &exclude_nodemap, &cpu_nodemap); + if (rc) + goto vcpp_out; + libxl_for_each_set_bit(i, cpu_nodemap) { + libxl_bitmap_reset(cpumap, i); + } vcpp_out: libxl_bitmap_dispose(&exclude_cpumap); + libxl_bitmap_dispose(&exclude_nodemap); + libxl_bitmap_dispose(&nodemap); + libxl_bitmap_dispose(&cpu_nodemap); return rc; }