From: Bharata B Rao <bharata@linux.vnet.ibm.com>
To: qemu-devel@nongnu.org
Cc: aik@ozlabs.ru, Bharata B Rao <bharata@linux.vnet.ibm.com>,
mdroth@linux.vnet.ibm.com, agraf@suse.de, qemu-ppc@nongnu.org,
tyreld@linux.vnet.ibm.com, nfont@linux.vnet.ibm.com,
imammedo@redhat.com, afaerber@suse.de,
david@gibson.dropbear.id.au
Subject: [Qemu-devel] [RFC PATCH v4 09/11] spapr: Support topologies with unfilled cores
Date: Thu, 6 Aug 2015 10:57:15 +0530 [thread overview]
Message-ID: <1438838837-28504-10-git-send-email-bharata@linux.vnet.ibm.com> (raw)
In-Reply-To: <1438838837-28504-1-git-send-email-bharata@linux.vnet.ibm.com>
QEMU currently supports CPU topologies where there can be cores
which are not completely filled with all the threads as per the
specifed SMT mode.
Restore support for such topologies (Eg -smp 15,cores=4,threads=4)
The last core will always have the deficit even when -device options are
used to cold-plug the cores.
Signed-off-by: Bharata B Rao <bharata@linux.vnet.ibm.com>
---
hw/ppc/spapr.c | 20 +++++++++++++++++++-
1 file changed, 19 insertions(+), 1 deletion(-)
diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
index 74637b3..004a8e1 100644
--- a/hw/ppc/spapr.c
+++ b/hw/ppc/spapr.c
@@ -94,6 +94,8 @@
#define HTAB_SIZE(spapr) (1ULL << ((spapr)->htab_shift))
+static int smp_remaining_cpus;
+
static XICSState *try_create_xics(const char *type, int nr_servers,
int nr_irqs, Error **errp)
{
@@ -1700,6 +1702,7 @@ static void ppc_spapr_init(MachineState *machine)
int smp_max_cores = DIV_ROUND_UP(max_cpus, smp_threads);
int smp_cores = DIV_ROUND_UP(smp_cpus, smp_threads);
+ smp_remaining_cpus = smp_cpus;
msi_supported = true;
QLIST_INIT(&spapr->phbs);
@@ -2202,6 +2205,7 @@ static void spapr_cpu_plug(HotplugHandler *hotplug_dev, DeviceState *dev,
Error *local_err = NULL;
void *fdt = NULL;
int i, fdt_offset = 0;
+ int threads_per_core;
/* Set NUMA node for the added CPUs */
for (i = 0; i < nb_numa_nodes; i++) {
@@ -2224,8 +2228,22 @@ static void spapr_cpu_plug(HotplugHandler *hotplug_dev, DeviceState *dev,
return;
}
+ /* Create SMT threads of the core.
+ *
+ * Support topologies like -smp 15,cores=4,threads=4 where one core
+ * will have less than the specified SMT threads. The last core will
+ * always have the deficit even when -device options are used to
+ * cold-plug the cores.
+ */
+ if ((smp_remaining_cpus > 0) && (smp_remaining_cpus < smp_threads)) {
+ threads_per_core = smp_remaining_cpus;
+ } else {
+ threads_per_core = smp_threads;
+ }
+ smp_remaining_cpus -= threads_per_core;
+
/* Create SMT threads of the core. */
- for (i = 1; i < smp_threads; i++) {
+ for (i = 1; i < threads_per_core; i++) {
cpu = cpu_ppc_init(current_machine->cpu_model);
if (!cpu) {
error_report("Unable to find PowerPC CPU definition: %s",
--
2.1.0
next prev parent reply other threads:[~2015-08-06 5:27 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-08-06 5:27 [Qemu-devel] [RFC PATCH v4 00/11] sPAPR CPU hotplug Bharata B Rao
2015-08-06 5:27 ` [Qemu-devel] [RFC PATCH v4 01/11] exec: Remove cpu from cpus list during cpu_exec_exit() Bharata B Rao
2015-09-04 5:31 ` David Gibson
2015-09-09 5:52 ` Bharata B Rao
2015-09-09 7:41 ` Zhu Guihua
2015-09-09 7:56 ` Bharata B Rao
2015-11-12 9:11 ` Zhu Guihua
2015-11-12 9:30 ` Bharata B Rao
2015-11-12 9:41 ` Zhu Guihua
2015-11-12 9:56 ` Andreas Färber
2015-11-12 11:40 ` Bharata B Rao
2015-08-06 5:27 ` [Qemu-devel] [RFC PATCH v4 02/11] exec: Do vmstate unregistration from cpu_exec_exit() Bharata B Rao
2015-09-04 6:03 ` David Gibson
2015-09-09 5:56 ` Bharata B Rao
2015-08-06 5:27 ` [Qemu-devel] [RFC PATCH v4 03/11] cpus: Reclaim vCPU objects Bharata B Rao
2015-09-04 6:09 ` David Gibson
2015-08-06 5:27 ` [Qemu-devel] [RFC PATCH v4 04/11] cpus: Add a sync version of cpu_remove() Bharata B Rao
2015-09-04 6:11 ` David Gibson
2015-09-09 5:57 ` Bharata B Rao
2015-08-06 5:27 ` [Qemu-devel] [RFC PATCH v4 05/11] xics_kvm: Add cpu_destroy method to XICS Bharata B Rao
2015-08-07 11:33 ` Bharata B Rao
2015-08-06 5:27 ` [Qemu-devel] [RFC PATCH v4 06/11] spapr: Create pseries-2.5 machine Bharata B Rao
2015-08-06 5:27 ` [Qemu-devel] [RFC PATCH v4 07/11] spapr: Enable CPU hotplug for pseries-2.5 and add CPU DRC DT entries Bharata B Rao
2015-09-04 6:28 ` David Gibson
2015-08-06 5:27 ` [Qemu-devel] [RFC PATCH v4 08/11] spapr: CPU hotplug support Bharata B Rao
2015-09-04 6:58 ` David Gibson
2015-09-09 6:52 ` Bharata B Rao
2015-08-06 5:27 ` Bharata B Rao [this message]
2015-09-04 7:01 ` [Qemu-devel] [RFC PATCH v4 09/11] spapr: Support topologies with unfilled cores David Gibson
2015-09-04 8:44 ` Thomas Huth
2015-09-09 6:58 ` Bharata B Rao
2015-08-06 5:27 ` [Qemu-devel] [RFC PATCH v4 10/11] spapr: CPU hot unplug support Bharata B Rao
2015-08-06 5:27 ` [Qemu-devel] [RFC PATCH v4 11/11] target-ppc: Enable CPU hotplug for POWER8 CPU family Bharata B Rao
2015-08-06 8:42 ` [Qemu-devel] [RFC PATCH v4 00/11] sPAPR CPU hotplug Zhu Guihua
2015-08-10 3:31 ` Bharata B Rao
2015-08-12 2:56 ` David Gibson
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=1438838837-28504-10-git-send-email-bharata@linux.vnet.ibm.com \
--to=bharata@linux.vnet.ibm.com \
--cc=afaerber@suse.de \
--cc=agraf@suse.de \
--cc=aik@ozlabs.ru \
--cc=david@gibson.dropbear.id.au \
--cc=imammedo@redhat.com \
--cc=mdroth@linux.vnet.ibm.com \
--cc=nfont@linux.vnet.ibm.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-ppc@nongnu.org \
--cc=tyreld@linux.vnet.ibm.com \
/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).