Received: from eggs.gnu.org ([2001:4830:134:3::10]:52957) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YKuOk-0004D0-3w for qemu-devel@nongnu.org; Mon, 09 Feb 2015 14:53:35 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YKuOj-0006T7-B3 for qemu-devel@nongnu.org; Mon, 09 Feb 2015 14:53:34 -0500 Received: from mx1.redhat.com ([209.132.183.28]:46879) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YKuOj-0006T3-2r for qemu-devel@nongnu.org; Mon, 09 Feb 2015 14:53:33 -0500 From: Eduardo Habkost Date: Mon, 9 Feb 2015 17:53:16 -0200 Message-Id: <1423511596-2584-4-git-send-email-ehabkost@redhat.com> In-Reply-To: <1423511596-2584-1-git-send-email-ehabkost@redhat.com> References: <1423511596-2584-1-git-send-email-ehabkost@redhat.com> Subject: [Qemu-devel] [PATCH v2 3/3] numa: Print warning if no node is assigned to a CPU List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Paolo Bonzini , Igor Mammedov , Hu Tao , "Michael S. Tsirkin" Instead of silently assigning CPU to node 0 when it is omitted from the command-line, check if all CPUs up to max_cpus are present in the NUMA configuration. I am making this a warning and not a fatal error, to allow management software to be updated if necessary. Signed-off-by: Eduardo Habkost --- numa.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/numa.c b/numa.c index f004a74..722a7fe 100644 --- a/numa.c +++ b/numa.c @@ -190,6 +190,17 @@ static void validate_numa_cpus(void) bitmap_or(present_cpus, present_cpus, numa_info[i].node_cpu, MAX_CPUMASK_BITS); } + + cpu = find_first_zero_bit(present_cpus, MAX_CPUMASK_BITS); + if (cpu < max_cpus) { + fprintf(stderr, "warning: CPU(s) not present in any NUMA nodes:"); + for (; + cpu < max_cpus; + cpu = find_next_zero_bit(present_cpus, MAX_CPUMASK_BITS, cpu + 1)) { + fprintf(stderr, " %d", cpu); + } + fprintf(stderr, "\n"); + } } void parse_numa_opts(void) -- 2.1.0