aboutsummaryrefslogtreecommitdiff
path: root/numa.c
diff options
context:
space:
mode:
authorIgor Mammedov <imammedo@redhat.com>2017-05-30 18:23:58 +0200
committerEduardo Habkost <ehabkost@redhat.com>2017-06-05 14:59:08 -0300
commitd41f3e750d2c06c613cb1b8db7724f0fbc0a2b14 (patch)
tree2e95f755031d4b6d73c31ad404eaa30855ad3347 /numa.c
parent60bed6a30aa8341cbc8fae4bdc53b9eb99d80586 (diff)
numa: make sure that all cpus have has_node_id set if numa is enabled
It fixes/add missing _PXM object for non mapped CPU (x86) and missing fdt node (virt-arm). It ensures that possible_cpus contains complete mapping if numa is enabled by the time machine_init() is executed. As result non completely mapped CPUs: 1) appear in ACPI/fdt blobs 2) QMP query-hotpluggable-cpus command shows bound nodes for such CPUs 3) allows to drop checks for has_node_id in numa only code, reducing number of invariants incomplete mapping could produce 4) moves fixup/implicit node init from runtime numa_cpu_pre_plug() (when CPU object is created) to machine_numa_finish_init() which helps to fix [1, 2] and make possible_cpus complete source of numa mapping available even before CPUs are created. Signed-off-by: Igor Mammedov <imammedo@redhat.com> Message-Id: <1496161442-96665-4-git-send-email-imammedo@redhat.com> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Diffstat (limited to 'numa.c')
-rw-r--r--numa.c16
1 files changed, 5 insertions, 11 deletions
diff --git a/numa.c b/numa.c
index 4ec3eaf687..65701cb6c8 100644
--- a/numa.c
+++ b/numa.c
@@ -509,22 +509,16 @@ void parse_numa_opts(MachineState *ms)
void numa_cpu_pre_plug(const CPUArchId *slot, DeviceState *dev, Error **errp)
{
- int mapped_node_id; /* set by -numa option */
int node_id = object_property_get_int(OBJECT(dev), "node-id", &error_abort);
- /* by default CPUState::numa_node was 0 if it wasn't set explicitly
- * TODO: make it error when incomplete numa mapping support is removed
- */
- mapped_node_id = slot->props.node_id;
- if (!slot->props.has_node_id) {
- mapped_node_id = 0;
- }
-
if (node_id == CPU_UNSET_NUMA_NODE_ID) {
/* due to bug in libvirt, it doesn't pass node-id from props on
* device_add as expected, so we have to fix it up here */
- object_property_set_int(OBJECT(dev), mapped_node_id, "node-id", errp);
- } else if (node_id != mapped_node_id) {
+ if (slot->props.has_node_id) {
+ object_property_set_int(OBJECT(dev), slot->props.node_id,
+ "node-id", errp);
+ }
+ } else if (node_id != slot->props.node_id) {
error_setg(errp, "node-id=%d must match numa node specified "
"with -numa option", node_id);
}