From: "Radim Krčmář" <rkrcmar@redhat.com>
To: qemu-devel@nongnu.org
Cc: "Paolo Bonzini" <pbonzini@redhat.com>,
"Richard Henderson" <rth@twiddle.net>,
"Eduardo Habkost" <ehabkost@redhat.com>,
"Andreas Färber" <afaerber@suse.de>
Subject: [Qemu-devel] [PATCH 3/3] pc: improve error message on invalid topologies
Date: Wed, 5 Nov 2014 22:53:33 +0100 [thread overview]
Message-ID: <1415224413-13972-4-git-send-email-rkrcmar@redhat.com> (raw)
In-Reply-To: <1415224413-13972-1-git-send-email-rkrcmar@redhat.com>
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ář <rkrcmar@redhat.com>
---
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
prev parent reply other threads:[~2014-11-05 21:54 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-11-05 21:53 [Qemu-devel] [PATCH 0/3] Improve error message on invalid CPU topologies Radim Krčmář
2014-11-05 21:53 ` [Qemu-devel] [PATCH 1/3] target-i386: add apicid_pkg_width to topology.h Radim Krčmář
2014-11-05 21:53 ` [Qemu-devel] [PATCH 2/3] target-i386: introduce x86_cpu_nr_apic_ids Radim Krčmář
2014-11-05 21:53 ` Radim Krčmář [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1415224413-13972-4-git-send-email-rkrcmar@redhat.com \
--to=rkrcmar@redhat.com \
--cc=afaerber@suse.de \
--cc=ehabkost@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=rth@twiddle.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).