qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] vl.c: Check max_cpus limit instead of smp_cpus
@ 2014-05-07 20:19 Eduardo Habkost
  2014-05-07 21:48 ` Peter Maydell
  0 siblings, 1 reply; 8+ messages in thread
From: Eduardo Habkost @ 2014-05-07 20:19 UTC (permalink / raw)
  To: qemu-devel, Anthony Liguori
  Cc: Igor Mammedov, Marcelo Tosatti, Andreas Färber

If a given machine have max_cpus set, not just smp_cpus needs to be
limited, but the total number of CPUs (considering CPU hotplug) for the
machine.

As smp_parse() already ensures smp_cpus <= max_cpus, we just need to
check if max_cpus exceeds the limit.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
 vl.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/vl.c b/vl.c
index 236f95e..e317cc9 100644
--- a/vl.c
+++ b/vl.c
@@ -4039,9 +4039,9 @@ int main(int argc, char **argv, char **envp)
     smp_parse(qemu_opts_find(qemu_find_opts("smp-opts"), NULL));
 
     machine->max_cpus = machine->max_cpus ?: 1; /* Default to UP */
-    if (smp_cpus > machine->max_cpus) {
-        fprintf(stderr, "Number of SMP cpus requested (%d), exceeds max cpus "
-                "supported by machine `%s' (%d)\n", smp_cpus,  machine->name,
+    if (max_cpus > machine->max_cpus) {
+        fprintf(stderr, "Total number of CPUs (%d), exceeds maximum "
+                "supported by machine `%s' (%d)\n", max_cpus,  machine->name,
                 machine->max_cpus);
         exit(1);
     }
-- 
1.9.0

^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2014-05-08 18:46 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-05-07 20:19 [Qemu-devel] [PATCH] vl.c: Check max_cpus limit instead of smp_cpus Eduardo Habkost
2014-05-07 21:48 ` Peter Maydell
2014-05-07 22:20   ` Andreas Färber
2014-05-08  8:26     ` Peter Maydell
2014-05-08 15:00       ` Eduardo Habkost
2014-05-08 15:07         ` Peter Maydell
2014-05-08 18:46           ` Eduardo Habkost
2014-05-08 15:10       ` Andreas Färber

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).