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 <drjo...@redhat.com>
---
 vl.c | 7 +++++++
 1 file changed, 7 insertions(+)

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;
-- 
1.9.3


Reply via email to