Skip to contentSkip to conversation

numa: Add a check whether the node0 has memory or not

PATCH In review Dou Liyang 3 participants 6 messages Aug 14, 2017 – Aug 15, 2017

lore
Share & tools
lore

Dou Liyang

author
#0 lore raw

PATCH 1/1 numa: Add a check whether the node0 has memory or not

Currently, Using the fisrt node without memory on the machine makes QEMU unhappy. With this example command line:
... \
-m 1024M,slots=4,maxmem=32G \
-numa node,nodeid=0 \
-numa node,mem=1024M,nodeid=1 \
-numa node,nodeid=2 \
-numa node,nodeid=3 \
Guest reports "No NUMA configuration found" and the NUMA topology is wrong.

This is because when QEMU builds ACPI SRAT, it regards node0 as the default node to deal with the memory hole(640K-1M). this means the node0 must have some memory(>1M) firstly.

Add a check in parse_numa_opts to avoid this situation.

---
 numa.c | 4 ++++
 1 file changed, 4 insertions(+)
numa.c +4 -0
index e32af04..1d6f73f 100644
@@ -464,6 +464,10 @@ void parse_numa_opts(MachineState *ms)
         if (i == nb_numa_nodes) {
             assert(mc->numa_auto_assign_ram);
             mc->numa_auto_assign_ram(mc, numa_info, nb_numa_nodes, ram_size);
+        } else if (i != 0) {
+            error_report("The first NUMA node must have some memory"
+                          " for building ACPI SART");
+            exit(1);
         }
 
         numa_total = 0;
Signature · 1 line
2.5.5
author
#1 lore raw

I'm sorry, forgot to cc Michael S. Tsirkin

Quoted 38 lines · Dou Liyang

Currently, Using the fisrt node without memory on the machine makes QEMU unhappy. With this example command line:
... \
-m 1024M,slots=4,maxmem=32G \
-numa node,nodeid=0 \
-numa node,mem=1024M,nodeid=1 \
-numa node,nodeid=2 \
-numa node,nodeid=3 \
Guest reports "No NUMA configuration found" and the NUMA topology is wrong.

This is because when QEMU builds ACPI SRAT, it regards node0 as the default node to deal with the memory hole(640K-1M). this means the node0 must have some memory(>1M) firstly.

Add a check in parse_numa_opts to avoid this situation.

---
 numa.c | 4 ++++
 1 file changed, 4 insertions(+)
numa.c +4 -0
index e32af04..1d6f73f 100644
@@ -464,6 +464,10 @@ void parse_numa_opts(MachineState *ms)
         if (i == nb_numa_nodes) {
             assert(mc->numa_auto_assign_ram);
             mc->numa_auto_assign_ram(mc, numa_info, nb_numa_nodes, ram_size);
+        } else if (i != 0) {
+            error_report("The first NUMA node must have some memory"
+                          " for building ACPI SART");
+            exit(1);
         }
 
         numa_total = 0;
#2 lore raw
In reply to Dou Liyang
Quoted 27 lines · Dou Liyang

Currently, Using the fisrt node without memory on the machine makes QEMU unhappy. With this example command line:
... \
-m 1024M,slots=4,maxmem=32G \
-numa node,nodeid=0 \
-numa node,mem=1024M,nodeid=1 \
-numa node,nodeid=2 \
-numa node,nodeid=3 \
Guest reports "No NUMA configuration found" and the NUMA topology is wrong.

This is because when QEMU builds ACPI SRAT, it regards node0 as the default node to deal with the memory hole(640K-1M). this means the node0 must have some memory(>1M) firstly.

Add a check in parse_numa_opts to avoid this situation.

---
 numa.c | 4 ++++
 1 file changed, 4 insertions(+)
numa.c +0 -0
index e32af04..1d6f73f 100644

numa.c void parse_numa_opts(MachineState *ms) · line 470

Quoted 7 lines
numa.c +4 -0
@@ -464,6 +464,10 @@ void parse_numa_opts(MachineState *ms)
         if (i == nb_numa_nodes) {
             assert(mc->numa_auto_assign_ram);
             mc->numa_auto_assign_ram(mc, numa_info, nb_numa_nodes, ram_size);
+        } else if (i != 0) {
+            error_report("The first NUMA node must have some memory"
+                          " for building ACPI SART");
+            exit(1);

This doesn't belong to numa.c. numa.c is generic code, and the requirement you described is specific for PC.

Anyway, adding this check would make existing VM configurations refuse to run after a QEMU upgrade. I suggest fixing the bug in the ACPI code instead.

Signature · 1 line
Eduardo
author
#3 lore raw

Hi Eduardo,

Quoted 39 lines · Eduardo Habkost
Quoted 27 lines · Dou Liyang

Currently, Using the fisrt node without memory on the machine makes QEMU unhappy. With this example command line:
... \
-m 1024M,slots=4,maxmem=32G \
-numa node,nodeid=0 \
-numa node,mem=1024M,nodeid=1 \
-numa node,nodeid=2 \
-numa node,nodeid=3 \
Guest reports "No NUMA configuration found" and the NUMA topology is wrong.

This is because when QEMU builds ACPI SRAT, it regards node0 as the default node to deal with the memory hole(640K-1M). this means the node0 must have some memory(>1M) firstly.

Add a check in parse_numa_opts to avoid this situation.

---
 numa.c | 4 ++++
 1 file changed, 4 insertions(+)
numa.c +0 -0
index e32af04..1d6f73f 100644

numa.c void parse_numa_opts(MachineState *ms) · line 470

Quoted 7 lines
numa.c +4 -0
@@ -464,6 +464,10 @@ void parse_numa_opts(MachineState *ms)
         if (i == nb_numa_nodes) {
             assert(mc->numa_auto_assign_ram);
             mc->numa_auto_assign_ram(mc, numa_info, nb_numa_nodes, ram_size);
+        } else if (i != 0) {
+            error_report("The first NUMA node must have some memory"
+                          " for building ACPI SART");
+            exit(1);

This doesn't belong to numa.c. numa.c is generic code, and the requirement you described is specific for PC.

Quoted 4 lines

Anyway, adding this check would make existing VM configurations refuse to run after a QEMU upgrade. I suggest fixing the bug in the ACPI code instead.

I see.

If fixing the bug in the ACPI code, I have two solutions:

1). Add a check in build_srat(). If the first node has no memory, QEMU will exit.

2). Fix the initialization of memory affinity structure to cover this situation. Using the first node which has memory to deal with the memory hole.

I prefer solution 2. what about you?

Thanks,
dou.

#4 lore raw
Quoted 51 lines · On Tue, 15 Aug 2017 09:26:46 +0800 Dou Liyang <[email protected]> wrote:

Hi Eduardo,

Quoted 39 lines · Eduardo Habkost
Quoted 27 lines · Dou Liyang

Currently, Using the fisrt node without memory on the machine makes QEMU unhappy. With this example command line:
... \
-m 1024M,slots=4,maxmem=32G \
-numa node,nodeid=0 \
-numa node,mem=1024M,nodeid=1 \
-numa node,nodeid=2 \
-numa node,nodeid=3 \
Guest reports "No NUMA configuration found" and the NUMA topology is wrong.

This is because when QEMU builds ACPI SRAT, it regards node0 as the default node to deal with the memory hole(640K-1M). this means the node0 must have some memory(>1M) firstly.

Add a check in parse_numa_opts to avoid this situation.

---
 numa.c | 4 ++++
 1 file changed, 4 insertions(+)
numa.c +0 -0
index e32af04..1d6f73f 100644

numa.c void parse_numa_opts(MachineState *ms) · line 470

Quoted 7 lines
numa.c +4 -0
@@ -464,6 +464,10 @@ void parse_numa_opts(MachineState *ms)
         if (i == nb_numa_nodes) {
             assert(mc->numa_auto_assign_ram);
             mc->numa_auto_assign_ram(mc, numa_info, nb_numa_nodes, ram_size);
+        } else if (i != 0) {
+            error_report("The first NUMA node must have some memory"
+                          " for building ACPI SART");
+            exit(1);  

This doesn't belong to numa.c. numa.c is generic code, and the requirement you described is specific for PC.

Quoted 4 lines

Anyway, adding this check would make existing VM configurations refuse to run after a QEMU upgrade. I suggest fixing the bug in the ACPI code instead.

I see.

If fixing the bug in the ACPI code, I have two solutions:

Quoted 8 lines

1). Add a check in build_srat(). If the first node has no memory, QEMU will exit.

2). Fix the initialization of memory affinity structure to cover this situation. Using the first node which has memory to deal with the memory hole.

I prefer solution 2. what about you?

I'd go for 2nd solution

Quoted 5 lines

Thanks,
dou.

author
#5 lore raw

Hi Igor,

Quoted 57 lines · Igor Mammedov
Quoted 54 lines · On Tue, 15 Aug 2017 09:26:46 +0800 Dou Liyang <[email protected]> wrote:

Hi Eduardo,

Quoted 39 lines · Eduardo Habkost
Quoted 27 lines · Dou Liyang

Currently, Using the fisrt node without memory on the machine makes QEMU unhappy. With this example command line:
... \
-m 1024M,slots=4,maxmem=32G \
-numa node,nodeid=0 \
-numa node,mem=1024M,nodeid=1 \
-numa node,nodeid=2 \
-numa node,nodeid=3 \
Guest reports "No NUMA configuration found" and the NUMA topology is wrong.

This is because when QEMU builds ACPI SRAT, it regards node0 as the default node to deal with the memory hole(640K-1M). this means the node0 must have some memory(>1M) firstly.

Add a check in parse_numa_opts to avoid this situation.

---
 numa.c | 4 ++++
 1 file changed, 4 insertions(+)
numa.c +0 -0
index e32af04..1d6f73f 100644

numa.c void parse_numa_opts(MachineState *ms) · line 470

Quoted 7 lines
numa.c +4 -0
@@ -464,6 +464,10 @@ void parse_numa_opts(MachineState *ms)
         if (i == nb_numa_nodes) {
             assert(mc->numa_auto_assign_ram);
             mc->numa_auto_assign_ram(mc, numa_info, nb_numa_nodes, ram_size);
+        } else if (i != 0) {
+            error_report("The first NUMA node must have some memory"
+                          " for building ACPI SART");
+            exit(1);

This doesn't belong to numa.c. numa.c is generic code, and the requirement you described is specific for PC.

Quoted 4 lines

Anyway, adding this check would make existing VM configurations refuse to run after a QEMU upgrade. I suggest fixing the bug in the ACPI code instead.

I see.

If fixing the bug in the ACPI code, I have two solutions:

1). Add a check in build_srat(). If the first node has no memory, QEMU will exit.

Quoted 7 lines
Quoted 5 lines

2). Fix the initialization of memory affinity structure to cover this situation. Using the first node which has memory to deal with the memory hole.

I prefer solution 2. what about you?

I'd go for 2nd solution

Yeah, I see. And I just sent the 2nd solution, waiting for your reply.

Thanks,
dou.

Quoted 9 lines
Quoted 5 lines

Thanks,
dou.