From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40593) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xm8X2-00040b-PL for qemu-devel@nongnu.org; Wed, 05 Nov 2014 16:54:30 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Xm8Ww-00078E-Lj for qemu-devel@nongnu.org; Wed, 05 Nov 2014 16:54:24 -0500 Received: from mx1.redhat.com ([209.132.183.28]:59109) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xm8Ww-000782-DD for qemu-devel@nongnu.org; Wed, 05 Nov 2014 16:54:18 -0500 From: =?UTF-8?q?Radim=20Kr=C4=8Dm=C3=A1=C5=99?= Date: Wed, 5 Nov 2014 22:53:33 +0100 Message-Id: <1415224413-13972-4-git-send-email-rkrcmar@redhat.com> In-Reply-To: <1415224413-13972-1-git-send-email-rkrcmar@redhat.com> References: <1415224413-13972-1-git-send-email-rkrcmar@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: [Qemu-devel] [PATCH 3/3] pc: improve error message on invalid topologies List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Paolo Bonzini , Richard Henderson , Eduardo Habkost , =?UTF-8?q?Andreas=20F=C3=A4rber?= 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=C4=8Dm=C3=A1=C5=99 --- 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, DeviceStat= e *icc_bridge) int i; X86CPU *cpu =3D NULL; Error *error =3D NULL; - unsigned long apic_id_limit; + unsigned apic_maxcpus; =20 /* init CPUs */ if (cpu_model =3D=3D NULL) { @@ -1038,10 +1039,11 @@ void pc_cpus_init(const char *cpu_model, DeviceSt= ate *icc_bridge) } current_cpu_model =3D cpu_model; =20 - apic_id_limit =3D 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 =3D 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=3D%u and threads=3D%u", + apic_maxcpus, smp_cores, smp_threads); exit(1); } =20 --=20 2.1.0