Received: from eggs.gnu.org ([208.118.235.92]:43256) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UfRDC-0008DX-3K for qemu-devel@nongnu.org; Thu, 23 May 2013 04:49:28 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UfRDA-0002PJ-Op for qemu-devel@nongnu.org; Thu, 23 May 2013 04:49:25 -0400 Received: from [222.73.24.84] (port=30059 helo=song.cn.fujitsu.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UfRDA-0002Oo-C3 for qemu-devel@nongnu.org; Thu, 23 May 2013 04:49:24 -0400 Received: from fnstmail02.fnst.cn.fujitsu.com (tang.cn.fujitsu.com [127.0.0.1]) by tang.cn.fujitsu.com (8.14.3/8.13.1) with ESMTP id r4N8nAWu026969 for ; Thu, 23 May 2013 16:49:10 +0800 From: Wanlong Gao Date: Thu, 23 May 2013 16:47:19 +0800 Message-Id: <1369298842-6295-2-git-send-email-gaowanlong@cn.fujitsu.com> In-Reply-To: <1369298842-6295-1-git-send-email-gaowanlong@cn.fujitsu.com> References: <1369298842-6295-1-git-send-email-gaowanlong@cn.fujitsu.com> Subject: [Qemu-devel] [PATCH 2/5] memory: check if the total numa memory size is equal to ram_size List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Wanlong Gao If the total number of the assigned numa nodes memory is not equal to the assigned total ram size, the guest will recognize all memory to one node. eg: -m 1024 -smp sockets=2,cores=1,threads=1 -numa node,cpus=0,nodeid=0,mem=512 \ -numa node,nodeid=1,cpus=1,mem=256 (qemu) info numa 2 nodes node 0 cpus: 0 node 0 size: 512 MB node 1 cpus: 1 node 1 size: 256 MB $ numactl -H avaliable: 1 nodes (0) node 0 cpus: 0 1 node 0 size: 1023 MB node 0 free: 821 MB node distances: node 0 0: 10 Signed-off-by: Wanlong Gao --- vl.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/vl.c b/vl.c index 59dc0b4..ce24bcd 100644 --- a/vl.c +++ b/vl.c @@ -4238,6 +4238,15 @@ int main(int argc, char **argv, char **envp) node_mem[i] = ram_size - usedmem; } + uint64_t numa_total = 0; + for (i = 0; i < nb_numa_nodes; i++) + numa_total += node_mem[i]; + if (numa_total != ram_size) { + fprintf(stderr, "qemu: numa nodes total memory size " + "should equal ram size\n"); + exit(1); + } + for (i = 0; i < nb_numa_nodes; i++) { if (!bitmap_empty(node_cpumask[i], MAX_CPUMASK_BITS)) { break; -- 1.8.3.rc2.10.g0c2b1cf