From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44199) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aQylT-00034I-FF for qemu-devel@nongnu.org; Wed, 03 Feb 2016 09:50:43 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aQylN-0003uO-CF for qemu-devel@nongnu.org; Wed, 03 Feb 2016 09:50:39 -0500 Date: Wed, 3 Feb 2016 15:50:19 +0100 From: Andrew Jones Message-ID: <20160203145019.GE4273@hawk.localdomain> References: <1454077485-242598-1-git-send-email-imammedo@redhat.com> <56AB7E54.4000608@linaro.org> <20160129152603.GG4340@hawk.localdomain> <56AB88D8.1020907@linaro.org> <20160129160731.GH4340@hawk.localdomain> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20160129160731.GH4340@hawk.localdomain> Subject: Re: [Qemu-devel] [PATCH] arm: virt-acpi: each MADT.GICC entry as enabled unconditionally List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Shannon Zhao Cc: wei@redhat.com, peter.maydell@linaro.org, mst@redhat.com, qemu-devel@nongnu.org, qemu-arm@nongnu.org, zhaoshenglong@huawei.com, Igor Mammedov On Fri, Jan 29, 2016 at 05:07:31PM +0100, Andrew Jones wrote: > On Fri, Jan 29, 2016 at 11:44:24PM +0800, Shannon Zhao wrote: > > >>>And below check in virt.c is not right while it should compare the global > > >>>max_cpus with the max_cpus GIC supports. > > >>> > > >>> if (smp_cpus > max_cpus) { > > >>> error_report("Number of SMP CPUs requested (%d) exceeds max CPUs " > > >>> "supported by machine 'mach-virt' (%d)", > > >>> smp_cpus, max_cpus); > > >>> exit(1); > > >>> } > > >max_cpus is getting set to the number the gic supports just above this > > >check. So max_cpus == gic_supported_cpus already, and this check is just > > >confirming the number of cpus the user has selected is OK. > > No, the global max_cpus (which is defined in vl.c and exported in > > sysemu/sysemu.h) is not the local variable max_cpus. > > I now see what you mean though. If we don't want something like > -smp 1,maxcpus=9 to erroneously succeed on a gicv2 machine, then we > should be checking the global max_cpus here. I agree it should be > fixed, because, even though it changes nothing atm, we don't want to > allow invalid command lines. > > Will you send the patch? I'll send one in a second. drew