qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 3/3] numa: Initialize node initiator with respect to .has_cpu


From: Michal Privoznik
Subject: [PATCH 3/3] numa: Initialize node initiator with respect to .has_cpu
Date: Fri, 29 May 2020 15:33:48 +0200

The initiator attribute of a NUMA node is documented as the 'NUMA
node that has best performance to given NUMA node'. If a NUMA
node has at least one CPU there can hardly be a different node
with better performace and thus all NUMA nodes which have a CPU
are initiators to themselves. Reflect this fact when initializing
the attribute.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
---
 hw/core/numa.c | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/hw/core/numa.c b/hw/core/numa.c
index 338453461c..1c9bc761cc 100644
--- a/hw/core/numa.c
+++ b/hw/core/numa.c
@@ -136,11 +136,15 @@ static void parse_numa_node(MachineState *ms, 
NumaNodeOptions *node,
         numa_info[nodenr].node_memdev = MEMORY_BACKEND(o);
     }
 
-    /*
-     * If not set the initiator, set it to MAX_NODES. And if
-     * HMAT is enabled and this node has no cpus, QEMU will raise error.
-     */
-    numa_info[nodenr].initiator = MAX_NODES;
+    /* Initialize initiator to either the current NUMA node (if
+     * it has at least one CPU), or to MAX_NODES. If HMAT is
+     * enabled an error will be raised later in
+     * numa_validate_initiator(). */
+    if (numa_info[nodenr].has_cpu)
+        numa_info[nodenr].initiator = nodenr;
+    else
+        numa_info[nodenr].initiator = MAX_NODES;
+
     if (node->has_initiator) {
         if (!ms->numa_state->hmat_enabled) {
             error_setg(errp, "ACPI Heterogeneous Memory Attribute Table "
-- 
2.26.2




reply via email to

[Prev in Thread] Current Thread [Next in Thread]