mirror of https://github.com/xqemu/xqemu.git
vl: fix max_cpus check
We should confirm max_cpus, which is >= smp_cpus, is <= the machine's true max_cpus, not just smp_cpus. Signed-off-by: Andrew Jones <drjones@redhat.com> Reviewed-by: Eduardo Habkost <ehabkost@redhat.com> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
parent
719cac1ce2
commit
c00cd99527
4
vl.c
4
vl.c
|
@ -3850,9 +3850,9 @@ int main(int argc, char **argv, char **envp)
|
||||||
smp_parse(qemu_opts_find(qemu_find_opts("smp-opts"), NULL));
|
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->max_cpus = machine_class->max_cpus ?: 1; /* Default to UP */
|
||||||
if (smp_cpus > machine_class->max_cpus) {
|
if (max_cpus > machine_class->max_cpus) {
|
||||||
fprintf(stderr, "Number of SMP cpus requested (%d), exceeds max cpus "
|
fprintf(stderr, "Number of SMP cpus requested (%d), exceeds max cpus "
|
||||||
"supported by machine `%s' (%d)\n", smp_cpus,
|
"supported by machine `%s' (%d)\n", max_cpus,
|
||||||
machine_class->name, machine_class->max_cpus);
|
machine_class->name, machine_class->max_cpus);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue