diff mbox

[3/3] vl: warn on topology <-> maxcpus mismatch

Message ID 1415376280-14130-4-git-send-email-drjones@redhat.com
State New
Headers show

Commit Message

Andrew Jones Nov. 7, 2014, 4:04 p.m. UTC
Start guiding users towards making sure their topology supports the
maximum number of cpus they wish to support. A future patch series
will enforce this for new machine types.

Signed-off-by: Andrew Jones <drjones@redhat.com>
---
 vl.c | 7 +++++++
 1 file changed, 7 insertions(+)
diff mbox

Patch

diff --git a/vl.c b/vl.c
index c62fe29aa8075..72ffbffd858c5 100644
--- a/vl.c
+++ b/vl.c
@@ -1313,6 +1313,13 @@  static void smp_parse(QemuOpts *opts)
         }
 
         max_cpus = qemu_opt_get_number(opts, "maxcpus", 0);
+        max_cpus = max_cpus ?: cpus;
+
+        if (sockets * cores * threads != max_cpus) {
+            fprintf(stderr, "cpu topology: warning: "
+                    "sockets (%u) * cores (%u) * threads (%u) != max_cpus (%u)\n",
+                    sockets, cores, threads, max_cpus);
+        }
 
         smp_cpus = cpus;
         smp_cores = cores;