Received: from eggs.gnu.org ([2001:4830:134:3::10]:52028) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WiTLI-0000Ea-Eg for qemu-devel@nongnu.org; Thu, 08 May 2014 14:46:57 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WiTLD-00065M-Em for qemu-devel@nongnu.org; Thu, 08 May 2014 14:46:52 -0400 Received: from mx1.redhat.com ([209.132.183.28]:60629) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WiTLD-00065C-5s for qemu-devel@nongnu.org; Thu, 08 May 2014 14:46:47 -0400 Date: Thu, 8 May 2014 15:46:40 -0300 From: Eduardo Habkost Message-ID: <20140508184640.GE3363@otherpad.lan.raisama.net> References: <1399493987-14285-1-git-send-email-ehabkost@redhat.com> <536AB1B2.4030709@suse.de> <20140508150043.GB3363@otherpad.lan.raisama.net> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline In-Reply-To: Content-Transfer-Encoding: quoted-printable Subject: Re: [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: Peter Maydell Cc: Igor Mammedov , Marcelo Tosatti , Andreas =?iso-8859-1?Q?F=E4rber?= , Anthony Liguori , QEMU Developers On Thu, May 08, 2014 at 04:07:54PM +0100, Peter Maydell wrote: > On 8 May 2014 16:00, Eduardo Habkost wrote: > > On Thu, May 08, 2014 at 09:26:36AM +0100, Peter Maydell wrote: > >> On 7 May 2014 23:20, Andreas F=E4rber wrote: > >> > Am 07.05.2014 23:48, schrieb Peter Maydell: > >> >> This is confusing. What is max_cpus > >> > > >> > Specified via -smp, defaults to actual CPUs. > >> > >> I thought that was smp_cpus ... > > > > smp_cpus is the first argument to -smp. max_cpus is the "maxcpus" opt= ion > > of -smp. >=20 > > Please don't do this. If the maxcpus value from the command-line is n= ot > > supported, QEMU should abort instead of silently ignoring the value > > provided by the user. >=20 > Ah, I see. This code is confusing because we've split the > handling of user errors in the -smp argument between > the smp_parse() function and this bit of inline code. > Ideally we should put all the error handling in one > place... The split makes sense to me: smp_parse() is just for basic parsing that doesn't depend on any state other than the provided QemuOpts parameter, and can run at any point in time. The machine->max_cpus check, on the other hand depend on the machine object to be created, and even changes the machine->max_cpus value. It is more dependent on ordering of initialization. To me, it makes sense to have it outside smp_parse(). But while looking at that code, I noticed that we can at least make the MAX_CPUMASK_BITS check and the machine->max_cpus check a single one. I will send a new patch. --=20 Eduardo