Skip to contentSkip to conversation

ACPI, x86: fix bug in associating hot-added CPUs with corresponding NUMA node

PATCH In review Jiang Liu 4 participants 7 messages Jan 20, 2014 – Feb 21, 2014

Subsystems (2)
lore
Share & tools
lore

Jiang Liu

author
#0 lore raw

PATCH 1/1 ACPI, x86: fix bug in associating hot-added CPUs with corresponding NUMA node

Current ACPI cpu hotplug driver fails to associate hot-added CPUs with corresponding NUMA node when doing socket online. The code path to associate CPU with NUMA node is as below:
acpi_processor_add()

    ->acpi_processor_get_info()
	->acpi_processor_hotadd_init()
	    ->acpi_map_lsapic()
		->_acpi_map_lsapic()
		    ->acpi_map_cpu2node()
cpu_subsys_online()
    ->try_online_node()
	->node_set_online()

When doing socket online, a new NUMA node is introduced in addition to hot-added CPU and memory device. And the new NUMA node is marked as online when onlining hot-added CPUs through sysfs interface /sys/devices/system/cpu/cpuxx/online.

On the other hand, acpi_map_cpu2node() will only build the CPU to node map if corresponding NUMA node is already online, so it always fails to associate hot-added CPUs with corresponding NUMA node because the NUMA node is still in offline state.

For the fix, we could safely remove the "node_online(node)" check in function acpi_map_cpu2node() because it's only called for hot-added CPUs by acpi_processor_hotadd_init().

---
 arch/x86/kernel/acpi/boot.c |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
arch/x86/kernel/acpi/boot.c +4 -4
index 6c0b43b..7625de9 100644
@@ -614,10 +614,10 @@ static void acpi_map_cpu2node(acpi_handle handle, int cpu, int physid)
 	int nid;
 
 	nid = acpi_get_node(handle);
-	if (nid == -1 || !node_online(nid))
-		return;
-	set_apicid_to_node(physid, nid);
-	numa_set_node(cpu, nid);
+	if (nid != -1) {
+		set_apicid_to_node(physid, nid);
+		numa_set_node(cpu, nid);
+	}
 #endif
 }
 
Signature · 1 line
1.7.10.4
#1 lore raw
Quoted 23 lines · Jiang Liu

Current ACPI cpu hotplug driver fails to associate hot-added CPUs with corresponding NUMA node when doing socket online. The code path to associate CPU with NUMA node is as below:
acpi_processor_add()

    ->acpi_processor_get_info()
	->acpi_processor_hotadd_init()
	    ->acpi_map_lsapic()
		->_acpi_map_lsapic()
		    ->acpi_map_cpu2node()
cpu_subsys_online()
    ->try_online_node()
	->node_set_online()

When doing socket online, a new NUMA node is introduced in addition to hot-added CPU and memory device. And the new NUMA node is marked as online when onlining hot-added CPUs through sysfs interface /sys/devices/system/cpu/cpuxx/online.

On the other hand, acpi_map_cpu2node() will only build the CPU to node map if corresponding NUMA node is already online, so it always fails to associate hot-added CPUs with corresponding NUMA node because the NUMA node is still in offline state.

Quoted 5 lines

For the fix, we could safely remove the "node_online(node)" check in function acpi_map_cpu2node() because it's only called for hot-added CPUs by acpi_processor_hotadd_init().

I wonder what the status here is? Did this patch go anywhere?

Quoted 24 lines
---
 arch/x86/kernel/acpi/boot.c |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
arch/x86/kernel/acpi/boot.c +4 -4
index 6c0b43b..7625de9 100644
@@ -614,10 +614,10 @@ static void acpi_map_cpu2node(acpi_handle handle, int cpu, int physid)
 	int nid;
 
 	nid = acpi_get_node(handle);
-	if (nid == -1 || !node_online(nid))
-		return;
-	set_apicid_to_node(physid, nid);
-	numa_set_node(cpu, nid);
+	if (nid != -1) {
+		set_apicid_to_node(physid, nid);
+		numa_set_node(cpu, nid);
+	}
 #endif
 }
 
Signature · 2 lines
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.
author
#2 lore raw
Quoted 24 lines · Rafael J. Wysocki
Quoted 23 lines · Jiang Liu

Current ACPI cpu hotplug driver fails to associate hot-added CPUs with corresponding NUMA node when doing socket online. The code path to associate CPU with NUMA node is as below:
acpi_processor_add()

    ->acpi_processor_get_info()
	->acpi_processor_hotadd_init()
	    ->acpi_map_lsapic()
		->_acpi_map_lsapic()
		    ->acpi_map_cpu2node()
cpu_subsys_online()
    ->try_online_node()
	->node_set_online()

When doing socket online, a new NUMA node is introduced in addition to hot-added CPU and memory device. And the new NUMA node is marked as online when onlining hot-added CPUs through sysfs interface /sys/devices/system/cpu/cpuxx/online.

On the other hand, acpi_map_cpu2node() will only build the CPU to node map if corresponding NUMA node is already online, so it always fails to associate hot-added CPUs with corresponding NUMA node because the NUMA node is still in offline state.

Quoted 7 lines
Quoted 5 lines

For the fix, we could safely remove the "node_online(node)" check in function acpi_map_cpu2node() because it's only called for hot-added CPUs by acpi_processor_hotadd_init().

I wonder what the status here is? Did this patch go anywhere?

Hi Rafael,
It's still in review stage, hasn't been accepted by any
maintainer yet.
Thanks!
Gerry

Quoted 26 lines
Quoted 25 lines
---
 arch/x86/kernel/acpi/boot.c |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
arch/x86/kernel/acpi/boot.c +4 -4
index 6c0b43b..7625de9 100644
@@ -614,10 +614,10 @@ static void acpi_map_cpu2node(acpi_handle handle, int cpu, int physid)
 	int nid;
 
 	nid = acpi_get_node(handle);
-	if (nid = -1 || !node_online(nid))
-		return;
-	set_apicid_to_node(physid, nid);
-	numa_set_node(cpu, nid);
+	if (nid != -1) {
+		set_apicid_to_node(physid, nid);
+		numa_set_node(cpu, nid);
+	}
 #endif
 }
 
#3 lore raw
Quoted 30 lines · Jiang Liu
Quoted 28 lines · Rafael J. Wysocki
Quoted 27 lines · Jiang Liu

Current ACPI cpu hotplug driver fails to associate hot-added CPUs with corresponding NUMA node when doing socket online. The code path to associate CPU with NUMA node is as below:
acpi_processor_add()

    ->acpi_processor_get_info()
	->acpi_processor_hotadd_init()
	    ->acpi_map_lsapic()
		->_acpi_map_lsapic()
		    ->acpi_map_cpu2node()
cpu_subsys_online()
    ->try_online_node()
	->node_set_online()

When doing socket online, a new NUMA node is introduced in addition to hot-added CPU and memory device. And the new NUMA node is marked as online when onlining hot-added CPUs through sysfs interface /sys/devices/system/cpu/cpuxx/online.

On the other hand, acpi_map_cpu2node() will only build the CPU to node map if corresponding NUMA node is already online, so it always fails to associate hot-added CPUs with corresponding NUMA node because the NUMA node is still in offline state.

For the fix, we could safely remove the "node_online(node)" check in function acpi_map_cpu2node() because it's only called for hot-added CPUs by acpi_processor_hotadd_init().

Quoted 6 lines
Quoted 3 lines
Quoted 1 line

I wonder what the status here is? Did this patch go anywhere?

Hi Rafael,
It's still in review stage, hasn't been accepted by any
maintainer yet.

OK

Peter, are you fine with the patch below?

Rafael

Quoted 26 lines
Quoted 26 lines
Quoted 25 lines
---
 arch/x86/kernel/acpi/boot.c |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
arch/x86/kernel/acpi/boot.c +4 -4
index 6c0b43b..7625de9 100644
@@ -614,10 +614,10 @@ static void acpi_map_cpu2node(acpi_handle handle, int cpu, int physid)
 	int nid;
 
 	nid = acpi_get_node(handle);
-	if (nid == -1 || !node_online(nid))
-		return;
-	set_apicid_to_node(physid, nid);
-	numa_set_node(cpu, nid);
+	if (nid != -1) {
+		set_apicid_to_node(physid, nid);
+		numa_set_node(cpu, nid);
+	}
 #endif
 }
 
Signature · 2 lines
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.
author
#4 lore raw

Ping...

Quoted 72 lines · Rafael J. Wysocki
Quoted 30 lines · Jiang Liu
Quoted 28 lines · Rafael J. Wysocki
Quoted 27 lines · Jiang Liu

Current ACPI cpu hotplug driver fails to associate hot-added CPUs with corresponding NUMA node when doing socket online. The code path to associate CPU with NUMA node is as below:
acpi_processor_add()

    ->acpi_processor_get_info()
	->acpi_processor_hotadd_init()
	    ->acpi_map_lsapic()
		->_acpi_map_lsapic()
		    ->acpi_map_cpu2node()
cpu_subsys_online()
    ->try_online_node()
	->node_set_online()

When doing socket online, a new NUMA node is introduced in addition to hot-added CPU and memory device. And the new NUMA node is marked as online when onlining hot-added CPUs through sysfs interface /sys/devices/system/cpu/cpuxx/online.

On the other hand, acpi_map_cpu2node() will only build the CPU to node map if corresponding NUMA node is already online, so it always fails to associate hot-added CPUs with corresponding NUMA node because the NUMA node is still in offline state.

For the fix, we could safely remove the "node_online(node)" check in function acpi_map_cpu2node() because it's only called for hot-added CPUs by acpi_processor_hotadd_init().

Quoted 6 lines
Quoted 3 lines
Quoted 1 line

I wonder what the status here is? Did this patch go anywhere?

Hi Rafael,
It's still in review stage, hasn't been accepted by any
maintainer yet.

OK

Peter, are you fine with the patch below?

Rafael

Quoted 26 lines
Quoted 26 lines
Quoted 25 lines
---
 arch/x86/kernel/acpi/boot.c |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
arch/x86/kernel/acpi/boot.c +4 -4
index 6c0b43b..7625de9 100644
@@ -614,10 +614,10 @@ static void acpi_map_cpu2node(acpi_handle handle, int cpu, int physid)
 	int nid;
 
 	nid = acpi_get_node(handle);
-	if (nid == -1 || !node_online(nid))
-		return;
-	set_apicid_to_node(physid, nid);
-	numa_set_node(cpu, nid);
+	if (nid != -1) {
+		set_apicid_to_node(physid, nid);
+		numa_set_node(cpu, nid);
+	}
 #endif
 }
 
#5 lore raw
Quoted 1 line · Jiang Liu

Ping...

Sorry, will look at it tomorrow.

-hpa

#6 lore raw

[tip:x86/acpi] x86, acpi: Fix bug in associating hot-added CPUs with corresponding NUMA node

In reply to Jiang Liu
x86, acpi: Fix bug in associating hot-added CPUs with corresponding NUMA node
Commit-ID:  896dc5064083063981954f142e43548765199792
Gitweb:     http://git.kernel.org/tip/896dc5064083063981954f142e43548765199792
Author:     Jiang Liu <[email protected]>
AuthorDate: Mon, 20 Jan 2014 10:31:54 +0800
Committer:  H. Peter Anvin <[email protected]>
CommitDate: Thu, 20 Feb 2014 19:01:22 -0800

x86, acpi: Fix bug in associating hot-added CPUs with corresponding NUMA node

Current ACPI cpu hotplug driver fails to associate hot-added CPUs with corresponding NUMA node when doing socket online. The code path to associate CPU with NUMA node is as below:
acpi_processor_add()

    ->acpi_processor_get_info()
	->acpi_processor_hotadd_init()
	    ->acpi_map_lsapic()
		->_acpi_map_lsapic()
		    ->acpi_map_cpu2node()
cpu_subsys_online()
    ->try_online_node()
	->node_set_online()

When doing socket online, a new NUMA node is introduced in addition to hot-added CPU and memory device. And the new NUMA node is marked as online when onlining hot-added CPUs through sysfs interface /sys/devices/system/cpu/cpuxx/online.

On the other hand, acpi_map_cpu2node() will only build the CPU to node map if corresponding NUMA node is already online, so it always fails to associate hot-added CPUs with corresponding NUMA node because the NUMA node is still in offline state.

For the fix, we could safely remove the "node_online(node)" check in function acpi_map_cpu2node() because it's only called for hot-added CPUs by acpi_processor_hotadd_init().

---
 arch/x86/kernel/acpi/boot.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
arch/x86/kernel/acpi/boot.c +4 -4
index 1dac942..9f46f2b 100644
@@ -613,10 +613,10 @@ static void acpi_map_cpu2node(acpi_handle handle, int cpu, int physid)
 	int nid;
 
 	nid = acpi_get_node(handle);
-	if (nid == -1 || !node_online(nid))
-		return;
-	set_apicid_to_node(physid, nid);
-	numa_set_node(cpu, nid);
+	if (nid != -1) {
+		set_apicid_to_node(physid, nid);
+		numa_set_node(cpu, nid);
+	}
 #endif
 }