On Tue, Nov 07, 2017 at 18:15:45 -0200, Eduardo Habkost wrote: > On Fri, Nov 03, 2017 at 02:47:33PM -0400, Emilio G. Cota wrote: > > @@ -4330,12 +4330,34 @@ int main(int argc, char **argv, char **envp) > > smp_parse(qemu_opts_find(qemu_find_opts("smp-opts"), NULL)); > > > > machine_class->max_cpus = machine_class->max_cpus ?: 1; /* Default to > > UP */ > > + machine_class->min_cpus = machine_class->min_cpus ?: 1; > > + machine_class->default_cpus = machine_class->default_cpus ?: 1; > > + > > + /* if -smp is not set, default to mc->default_cpus */ > > + if (!smp_cpus) { > > + smp_cpus = machine_class->default_cpus; > > + max_cpus = machine_class->default_cpus; > > + } > > I suggest doing this before smp_parse(), so any validation of > smp_cpus inside smp_parse will apply to the value we're setting > here (e.g. the replay_add_blocker() call in smp_parse() will > work). (snip) > > + if (max_cpus < machine_class->min_cpus) { > > smp_parse() already ensures max_cpus >= smp_cpus, and you are > already checking if smp_cpus < machine_class->min_cpus above. Is > it really possible to trigger this error message? > > Except for that, the patch looks good to me.
Both very good points! I've modified the patch accordingly. Thanks, Emilio