Skip to contentSkip to conversation

numa: Classify the numa nodes as memory initiators and memory targets

PATCH Superseded Liu Jingqi 2 participants 3 messages May 9, 2018 – May 14, 2018

lore
Share & tools
lore

Liu Jingqi

author
#0 lore raw

PATCH 4/7 numa: Classify the numa nodes as memory initiators and memory targets

An initiator proximity domain (memory initiator) is any device such as a CPU or a separate memory I/O device that can initiate a memory request. A target proximity domain (memory target) is a CPU-accessible physical address range.

---
 numa.c | 7 +++++++
 1 file changed, 7 insertions(+)
numa.c +7 -0
index 70b150e..fe0009c 100644
@@ -40,6 +40,7 @@
 #include "qemu/option.h"
 #include "qemu/config-file.h"
 #include "qemu/cutils.h"
+#include "hw/acpi/hmat.h"
 
 QemuOptsList qemu_numa_opts = {
     .name = "numa",
@@ -100,6 +101,10 @@ static void parse_numa_node(MachineState *ms, NumaNodeOptions *node,
         machine_set_cpu_numa_node(ms, &props, &error_fatal);
     }
 
+    if (node->cpus) {
+        initiator_pxm[num_initiator++] = nodenr;
+    }
+
     if (node->has_mem && node->has_memdev) {
         error_setg(errp, "cannot specify both mem= and memdev=");
         return;
@@ -116,6 +121,7 @@ static void parse_numa_node(MachineState *ms, NumaNodeOptions *node,
 
     if (node->has_mem) {
         numa_info[nodenr].node_mem = node->mem;
+        target_pxm[num_target++] = nodenr;
     }
     if (node->has_memdev) {
         Object *o;
@@ -128,6 +134,7 @@ static void parse_numa_node(MachineState *ms, NumaNodeOptions *node,
         object_ref(o);
         numa_info[nodenr].node_mem = object_property_get_uint(o, "size", NULL);
         numa_info[nodenr].node_memdev = MEMORY_BACKEND(o);
+        target_pxm[num_target++] = nodenr;
     }
     numa_info[nodenr].present = true;
     max_numa_nodeid = MAX(max_numa_nodeid, nodenr + 1);
Signature · 1 line
2.7.4
#1 lore raw
Quoted 5 lines · Liu Jingqi

An initiator proximity domain (memory initiator) is any device such as a CPU or a separate memory I/O device that can initiate a memory request. A target proximity domain (memory target) is a CPU-accessible physical address range.

[...]

Quoted 3 lines
numa.c +3 -0
+    if (node->cpus) {
+        initiator_pxm[num_initiator++] = nodenr;
+    }

[...]

Quoted 1 line

+ target_pxm[num_target++] = nodenr;

I suggest NumaNode::is_initiator and NumaNode::is_target boolean fields instead of a separate global table.

Or numa.c could simply provide
bool numa_node_is_initiator(int node) and
bool numa_node_is_target(int node)
helpers.

Signature · 1 line
Eduardo
#2 lore raw
Quoted 26 lines

-----Original Message-----
From: Eduardo Habkost [mailto:[email protected]]
Sent: Friday, May 11, 2018 10:33 PM
To: Liu, Jingqi <[email protected]>
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; qemu- [email protected]
Subject: Re: [PATCH v1 4/7] numa: Classify the numa nodes as memory initiators and memory targets

Quoted 5 lines · Liu Jingqi

An initiator proximity domain (memory initiator) is any device such as a CPU or a separate memory I/O device that can initiate a memory request. A target proximity domain (memory target) is a CPU-accessible physical address range.

[...]

Quoted 3 lines
numa.c +3 -0
+    if (node->cpus) {
+        initiator_pxm[num_initiator++] = nodenr;
+    }

[...]

Quoted 1 line

+ target_pxm[num_target++] = nodenr;

I suggest NumaNode::is_initiator and NumaNode::is_target boolean fields instead of a separate global table.

Quoted 7 lines

Or numa.c could simply provide
bool numa_node_is_initiator(int node) and
bool numa_node_is_target(int node)
helpers.

--
Eduardo

Hi Eduardo,
Thanks for your reviewing. It's a good suggestion. I will improve in the next version. Jingqi