qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH 3/3] pc: improve error message on invalid topologies


From: Radim Krčmář
Subject: [Qemu-devel] [PATCH 3/3] pc: improve error message on invalid topologies
Date: Wed, 5 Nov 2014 22:53:33 +0100

VCPU topologies, whose number of cores or hyperthreads doesn't equal
a power of two, won't assign all APIC IDs.
We require an APIC ID for every CPU, so the number of wasted APIC IDs
lowers our maximal CPU count.

We exited while printing how high APIC ID of last CPU is, while users
are likely interested about the maximal maxcpus, so use that instead.

Signed-off-by: Radim Krčmář <address@hidden>
---
 hw/i386/pc.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/hw/i386/pc.c b/hw/i386/pc.c
index 61aba9f..557b3cc 100644
--- a/hw/i386/pc.c
+++ b/hw/i386/pc.c
@@ -41,6 +41,7 @@
 #include "hw/pci/msi.h"
 #include "hw/sysbus.h"
 #include "sysemu/sysemu.h"
+#include "sysemu/cpus.h"
 #include "sysemu/kvm.h"
 #include "kvm_i386.h"
 #include "hw/xen/xen.h"
@@ -1026,7 +1027,7 @@ void pc_cpus_init(const char *cpu_model, DeviceState 
*icc_bridge)
     int i;
     X86CPU *cpu = NULL;
     Error *error = NULL;
-    unsigned long apic_id_limit;
+    unsigned apic_maxcpus;
 
     /* init CPUs */
     if (cpu_model == NULL) {
@@ -1038,10 +1039,11 @@ void pc_cpus_init(const char *cpu_model, DeviceState 
*icc_bridge)
     }
     current_cpu_model = cpu_model;
 
-    apic_id_limit = pc_apic_id_limit(max_cpus);
-    if (apic_id_limit > ACPI_CPU_HOTPLUG_ID_LIMIT) {
-        error_report("max_cpus is too large. APIC ID of last CPU is %lu",
-                     apic_id_limit - 1);
+    apic_maxcpus = x86_cpu_nr_apic_ids(ACPI_CPU_HOTPLUG_ID_LIMIT);
+    if (apic_maxcpus < max_cpus) {
+        error_report("invalid CPU topology: maxcpus can't exceed %u"
+                     " if cores=%u and threads=%u",
+                     apic_maxcpus, smp_cores, smp_threads);
         exit(1);
     }
 
-- 
2.1.0




reply via email to

[Prev in Thread] Current Thread [Next in Thread]