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