From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43274) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WzFEC-0003zY-0M for qemu-devel@nongnu.org; Mon, 23 Jun 2014 21:09:01 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WzFE0-0003Qi-RO for qemu-devel@nongnu.org; Mon, 23 Jun 2014 21:08:51 -0400 Received: from e9.ny.us.ibm.com ([32.97.182.139]:49322) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WzFE0-0003QJ-LW for qemu-devel@nongnu.org; Mon, 23 Jun 2014 21:08:40 -0400 Received: from /spool/local by e9.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 23 Jun 2014 21:08:40 -0400 Received: from b01cxnp23034.gho.pok.ibm.com (b01cxnp23034.gho.pok.ibm.com [9.57.198.29]) by d01dlp03.pok.ibm.com (Postfix) with ESMTP id 86EEEC90026 for ; Mon, 23 Jun 2014 21:08:31 -0400 (EDT) Received: from d01av04.pok.ibm.com (d01av04.pok.ibm.com [9.56.224.64]) by b01cxnp23034.gho.pok.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id s5O18bn461603914 for ; Tue, 24 Jun 2014 01:08:37 GMT Received: from d01av04.pok.ibm.com (localhost [127.0.0.1]) by d01av04.pok.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id s5O18bvG021789 for ; Mon, 23 Jun 2014 21:08:37 -0400 Date: Mon, 23 Jun 2014 18:08:34 -0700 From: Nishanth Aravamudan Message-ID: <20140624010833.GF4323@linux.vnet.ibm.com> References: <20140623193310.GD4323@linux.vnet.ibm.com> <20140624004825.GE4323@linux.vnet.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20140624004825.GE4323@linux.vnet.ibm.com> Subject: [Qemu-devel] [RFC PATCH] ppc/spapr: support sparse NUMA node numbering List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Michael S. Tsirkin" Cc: Alexey Kardashevskiy , Eduardo Habkost , anton@samba.org, qemu-devel@nongnu.org With generic sparse NUMA node parsing in place ("numa: enable sparse node numbering"), ppc can be updated to iterate over only the user-specified nodes. qemu-system-ppc64 -machine pseries,accel=kvm,usb=off -m 4096 -realtime mlock=off -numa node,nodeid=3 -numa node,nodeid=2 -smp 4 Before: info numa: node 0 cpus: 0 2 node 0 size: 2048 MB node 1 cpus: 1 3 node 1 size: 2048 MB numactl --hardware: available: 2 nodes (0-1) node 0 cpus: 0 2 node 0 size: 2027 MB node 0 free: 1875 MB node 1 cpus: 1 3 node 1 size: 2045 MB node 1 free: 1980 MB node distances: node 0 1 0: 10 40 1: 40 10 After: info numa: node 2 cpus: 0 2 node 2 size: 2048 MB node 3 cpus: 1 3 node 3 size: 2048 MB numactl --hardware: available: 3 nodes (0,2-3) node 0 cpus: node 0 size: 0 MB node 0 free: 0 MB node 2 cpus: 0 2 node 2 size: 2027 MB node 2 free: 1943 MB node 3 cpus: 1 3 node 3 size: 2045 MB node 3 free: 1904 MB node distances: node 0 2 3 0: 10 40 40 2: 40 10 40 3: 40 40 10 Note, the empty node 0 is due to the Linux kernel. Signed-off-by: Nishanth Aravamudan diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index 82f183f..d07857a 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -707,7 +707,10 @@ static int spapr_populate_memory(sPAPREnvironment *spapr, void *fdt) /* RAM: Node 1 and beyond */ mem_start = node0_size; - for (i = 1; i < nb_numa_nodes; i++) { + for (i = 1; i < max_numa_node; i++) { + if (!numa_info[i].present) { + continue; + } mem_reg_property[0] = cpu_to_be64(mem_start); if (mem_start >= ram_size) { node_size = 0;