Received: from eggs.gnu.org ([2001:4830:134:3::10]:56258) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wi8K4-00070y-Ty for qemu-devel@nongnu.org; Wed, 07 May 2014 16:20:19 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Wi8Jy-0004aY-PS for qemu-devel@nongnu.org; Wed, 07 May 2014 16:20:12 -0400 Received: from mx1.redhat.com ([209.132.183.28]:64364) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wi8Jy-0004So-IG for qemu-devel@nongnu.org; Wed, 07 May 2014 16:20:06 -0400 From: Eduardo Habkost Date: Wed, 7 May 2014 17:19:47 -0300 Message-Id: <1399493987-14285-1-git-send-email-ehabkost@redhat.com> Subject: [Qemu-devel] [PATCH] vl.c: Check max_cpus limit instead of smp_cpus List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org, Anthony Liguori Cc: Igor Mammedov , Marcelo Tosatti , =?UTF-8?q?Andreas=20F=C3=A4rber?= If a given machine have max_cpus set, not just smp_cpus needs to be limited, but the total number of CPUs (considering CPU hotplug) for the machine. As smp_parse() already ensures smp_cpus <= max_cpus, we just need to check if max_cpus exceeds the limit. Signed-off-by: Eduardo Habkost --- vl.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/vl.c b/vl.c index 236f95e..e317cc9 100644 --- a/vl.c +++ b/vl.c @@ -4039,9 +4039,9 @@ int main(int argc, char **argv, char **envp) smp_parse(qemu_opts_find(qemu_find_opts("smp-opts"), NULL)); machine->max_cpus = machine->max_cpus ?: 1; /* Default to UP */ - if (smp_cpus > machine->max_cpus) { - fprintf(stderr, "Number of SMP cpus requested (%d), exceeds max cpus " - "supported by machine `%s' (%d)\n", smp_cpus, machine->name, + if (max_cpus > machine->max_cpus) { + fprintf(stderr, "Total number of CPUs (%d), exceeds maximum " + "supported by machine `%s' (%d)\n", max_cpus, machine->name, machine->max_cpus); exit(1); } -- 1.9.0