summaryrefslogtreecommitdiffstats
path: root/hw/ppc
diff options
context:
space:
mode:
authorDavid Gibson <david@gibson.dropbear.id.au>2015-09-08 11:21:52 +1000
committerDavid Gibson <david@gibson.dropbear.id.au>2015-09-23 10:51:11 +1000
commit20bb648dca6d7fe8cdd1941194e7851950b25dc5 (patch)
treef8ed18f058df077c496c7bdf08bc845d620969b3 /hw/ppc
parent0a4178692c2375a4516da7b71629bd08ee8697ee (diff)
downloadhqemu-20bb648dca6d7fe8cdd1941194e7851950b25dc5.zip
hqemu-20bb648dca6d7fe8cdd1941194e7851950b25dc5.tar.gz
spapr: Fix default NUMA node allocation for threads
At present, if guest numa nodes are requested, but the cpus in each node are not specified, spapr just uses the default behaviour or assigning each vcpu round-robin to nodes. If smp_threads != 1, that will assign adjacent threads in a core to different NUMA nodes. As well as being just weird, that's a configuration that can't be represented in the device tree we give to the guest, which means the guest and qemu end up with different ideas of the NUMA topology. This patch implements mc->cpu_index_to_socket_id in the spapr code to make sure vcpus get assigned to nodes only at the socket granularity. Signed-off-by: David Gibson <david@gibson.dropbear.id.au> Reviewed-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Diffstat (limited to 'hw/ppc')
-rw-r--r--hw/ppc/spapr.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
index 533c7ad..59fc814 100644
--- a/hw/ppc/spapr.c
+++ b/hw/ppc/spapr.c
@@ -2162,6 +2162,13 @@ static HotplugHandler *spapr_get_hotpug_handler(MachineState *machine,
return NULL;
}
+static unsigned spapr_cpu_index_to_socket_id(unsigned cpu_index)
+{
+ /* Allocate to NUMA nodes on a "socket" basis (not that concept of
+ * socket means much for the paravirtualized PAPR platform) */
+ return cpu_index / smp_threads / smp_cores;
+}
+
static void spapr_machine_class_init(ObjectClass *oc, void *data)
{
MachineClass *mc = MACHINE_CLASS(oc);
@@ -2183,6 +2190,7 @@ static void spapr_machine_class_init(ObjectClass *oc, void *data)
mc->get_hotplug_handler = spapr_get_hotpug_handler;
hc->plug = spapr_machine_device_plug;
hc->unplug = spapr_machine_device_unplug;
+ mc->cpu_index_to_socket_id = spapr_cpu_index_to_socket_id;
smc->dr_lmb_enabled = false;
fwc->get_dev_path = spapr_get_fw_dev_path;
OpenPOWER on IntegriCloud