Skip to contentSkip to conversation

powerpc/mm: movable hotplug memory nodes

PATCH Superseded Reza Arbab 6 participants 15 messages Aug 8, 2016 – Aug 12, 2016

Subsystems (5)

v1 of 7 Superseded Latest is v7 →

lore
Share & tools
lore

Reza Arbab

author
#0 lore raw

cover powerpc/mm: movable hotplug memory nodes

These changes enable onlining memory into ZONE_MOVABLE on power, and the creation of discrete nodes of movable memory.

Node hotplug is not supported on power [1]. The approach taken instead is to create a memoryless placeholder node for the designated address range at boot. Hotplug and onlining of the memory are then done in the usual way.

The numa code on power currently prevents hotplugging to a memoryless node. This limitation has been questioned before [2], and judging by the response, there doesn't seem to be a reason we can't remove it. No issues have been found in light testing.

[1] commit 3af229f ("powerpc/numa: Reset node_possible_map to only node_online_map")
[2] http://lkml.kernel.org/r/CAGZKiBrmkSa1yyhbf5hwGxubcjsE5SmkSMY4tpANERMe2UG4bg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org

    http://lkml.kernel.org/r/20160511215051.GF22115-qNY8G7rN0TWMBe/[email protected]

Reza Arbab (4):
dt-bindings: add doc for ibm,hotplug-aperture powerpc/mm: create numa nodes for hotplug memory powerpc/mm: allow memory hotplug into a memoryless node
mm: enable CONFIG_MOVABLE_NODE on powerpc

 .../bindings/powerpc/opal/hotplug-aperture.txt     | 26 ++++++++++++++++++++++
 Documentation/kernel-parameters.txt                |  2 +-
 arch/powerpc/mm/numa.c                             | 23 ++++++++-----------
 mm/Kconfig                                         |  2 +-
 4 files changed, 37 insertions(+), 16 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/powerpc/opal/hotplug-aperture.txt
Signature · 6 lines
1.8.3.1

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
author
#1 lore raw

PATCH 1/4 dt-bindings: add doc for ibm,hotplug-aperture

---
 .../bindings/powerpc/opal/hotplug-aperture.txt     | 26 ++++++++++++++++++++++
 1 file changed, 26 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/powerpc/opal/hotplug-aperture.txt
Documentation/devicetree/bindings/powerpc/opal/hotplug-aperture.txt new file +26 -0
new file mode 100644
index 0000000..b8dffaa
@@ -0,0 +1,26 @@
+Designated hotplug memory
+-------------------------
+
+This binding describes a region of hotplug memory which is not present at boot,
+allowing its eventual NUMA associativity to be prespecified.
+
+Required properties:
+
+- compatible
+	"ibm,hotplug-aperture"
+
+- reg
+	base address and size of the region (standard definition)
+
+- ibm,associativity
+	NUMA associativity (standard definition)
+
+Example:
+
+A 2 GiB aperture at 0x100000000, to be part of nid 3 when hotplugged:
+
+	hotplug-memory@100000000 {
+		compatible = "ibm,hotplug-aperture";
+		reg = <0x0 0x100000000 0x0 0x80000000>;
+		ibm,associativity = <0x4 0x0 0x0 0x0 0x3>;
+	};
Signature · 7 lines
1.8.3.1

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected].  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
maintainer Acked-by on v1 1/4
#2 lore raw

Re: [PATCH 1/4] dt-bindings: add doc for ibm,hotplug-aperture

Quoted 5 lines · Reza Arbab
---
 .../bindings/powerpc/opal/hotplug-aperture.txt     | 26 ++++++++++++++++++++++
 1 file changed, 26 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/powerpc/opal/hotplug-aperture.txt

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

Acked-by on v1 1/4
#3 lore raw

Re: [PATCH 1/4] dt-bindings: add doc for ibm,hotplug-aperture

In reply to Reza Arbab
Quoted 29 lines · Reza Arbab
---
 .../bindings/powerpc/opal/hotplug-aperture.txt     | 26 ++++++++++++++++++++++
 1 file changed, 26 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/powerpc/opal/hotplug-aperture.txt
Documentation/devicetree/bindings/powerpc/opal/hotplug-aperture.txt new file +16 -0
new file mode 100644
index 0000000..b8dffaa
@@ -0,0 +1,26 @@
+Designated hotplug memory
+-------------------------
+
+This binding describes a region of hotplug memory which is not present at boot,
+allowing its eventual NUMA associativity to be prespecified.
+
+Required properties:
+
+- compatible
+	"ibm,hotplug-aperture"
+
+- reg
+	base address and size of the region (standard definition)
+
+- ibm,associativity
+	NUMA associativity (standard definition)

Documentation/devicetree/bindings/powerpc/opal/hotplug-aperture.txt line 26

Quoted 10 lines
Documentation/devicetree/bindings/powerpc/opal/hotplug-aperture.txt new file +10 -0
+
+Example:
+
+A 2 GiB aperture at 0x100000000, to be part of nid 3 when hotplugged:
+
+	hotplug-memory@100000000 {
+		compatible = "ibm,hotplug-aperture";
+		reg = <0x0 0x100000000 0x0 0x80000000>;
+		ibm,associativity = <0x4 0x0 0x0 0x0 0x3>;
+	};

+Stewart and Alistair

Looks good to me!

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

#4 lore raw

Re: [PATCH 1/4] dt-bindings: add doc for ibm,hotplug-aperture

Quoted 7 lines · Balbir Singh
Quoted 6 lines · Reza Arbab
---
 .../bindings/powerpc/opal/hotplug-aperture.txt     | 26 ++++++++++++++++++++++
 1 file changed, 26 insertions(+)
 create mode 100644

Documentation/devicetree/bindings/powerpc/opal/hotplug-aperture.txt

Forgive me for being absent on the whole discussion here, but is this an OPAL specific binding? If so, shouldn't the docs also appear in the skiboot tree?

Signature · 8 lines
Stewart Smith
OPAL Architect, IBM.

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected].  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
author
#5 lore raw

Re: [PATCH 1/4] dt-bindings: add doc for ibm,hotplug-aperture

Quoted 2 lines · Stewart Smith

Forgive me for being absent on the whole discussion here, but is this an OPAL specific binding? If so, shouldn't the docs also appear in the skiboot tree?

Good question. I guess it's not necessarily OPAL-specific, even though OPAL may initially be the only implementor of the binding.

Would it be more appropriate to move the file up a directory, directly under Documentation/devicetree/bindings/powerpc? I hesitated at that because the binding is tied to "ibm,associativity".

Signature · 7 lines
Reza Arbab

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected].  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
author
#6 lore raw

PATCH 2/4 powerpc/mm: create numa nodes for hotplug memory

In reply to Reza Arbab

When scanning the device tree to initialize the system NUMA topology, process dt elements with compatible id "ibm,hotplug-aperture" to create memoryless numa nodes.

These nodes will be filled when hotplug occurs within the associated address range.

---
 arch/powerpc/mm/numa.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
arch/powerpc/mm/numa.c +8 -2
index 75b9cd6..80d067d 100644
@@ -708,6 +708,12 @@ static void __init parse_drconf_memory(struct device_node *memory)
 	}
 }
 
+static const struct of_device_id memory_match[] = {
+	{ .type = "memory" },
+	{ .compatible = "ibm,hotplug-aperture" },
+	{ /* sentinel */ }
+};
+
 static int __init parse_numa_properties(void)
 {
 	struct device_node *memory;
@@ -752,7 +758,7 @@ static int __init parse_numa_properties(void)
 
 	get_n_mem_cells(&n_mem_addr_cells, &n_mem_size_cells);
 
-	for_each_node_by_type(memory, "memory") {
+	for_each_matching_node(memory, memory_match) {
 		unsigned long start;
 		unsigned long size;
 		int nid;
@@ -1080,7 +1086,7 @@ static int hot_add_node_scn_to_nid(unsigned long scn_addr)
 	struct device_node *memory;
 	int nid = -1;
 
-	for_each_node_by_type(memory, "memory") {
+	for_each_matching_node(memory, memory_match) {
 		unsigned long start, size;
 		int ranges;
 		const __be32 *memcell_buf;
Signature · 7 lines
1.8.3.1

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected].  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Acked-by on v1 2/4
#7 lore raw

Re: [PATCH 2/4] powerpc/mm: create numa nodes for hotplug memory

Quoted 9 lines · Reza Arbab

When scanning the device tree to initialize the system NUMA topology, process dt elements with compatible id "ibm,hotplug-aperture" to create memoryless numa nodes.

These nodes will be filled when hotplug occurs within the associated address range.

---

Looks good to me

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

author
#8 lore raw

PATCH 3/4 powerpc/mm: allow memory hotplug into a memoryless node

In reply to Reza Arbab

Remove the check which prevents us from hotplugging into an empty node.

---
 arch/powerpc/mm/numa.c | 13 +------------
 1 file changed, 1 insertion(+), 12 deletions(-)
arch/powerpc/mm/numa.c +1 -12
index 80d067d..bc70c4f 100644
@@ -1127,7 +1127,7 @@ static int hot_add_node_scn_to_nid(unsigned long scn_addr)
 int hot_add_scn_to_nid(unsigned long scn_addr)
 {
 	struct device_node *memory = NULL;
-	int nid, found = 0;
+	int nid;
 
 	if (!numa_enabled || (min_common_depth < 0))
 		return first_online_node;
@@ -1143,17 +1143,6 @@ int hot_add_scn_to_nid(unsigned long scn_addr)
 	if (nid < 0 || !node_online(nid))
 		nid = first_online_node;
 
-	if (NODE_DATA(nid)->node_spanned_pages)
-		return nid;
-
-	for_each_online_node(nid) {
-		if (NODE_DATA(nid)->node_spanned_pages) {
-			found = 1;
-			break;
-		}
-	}
-
-	BUG_ON(!found);
 	return nid;
 }
 
Signature · 7 lines
1.8.3.1

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected].  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Acked-by on v1 3/4
#9 lore raw

Re: [PATCH 3/4] powerpc/mm: allow memory hotplug into a memoryless node

Quoted 12 lines · Reza Arbab

Remove the check which prevents us from hotplugging into an empty node.

---
 arch/powerpc/mm/numa.c | 13 +------------
 1 file changed, 1 insertion(+), 12 deletions(-)
arch/powerpc/mm/numa.c +0 -0
index 80d067d..bc70c4f 100644

arch/powerpc/mm/numa.c static int hot_add_node_scn_to_nid(unsigned long scn_addr) · line 1131

Quoted 6 lines
arch/powerpc/mm/numa.c +1 -1
@@ -1127,7 +1127,7 @@ static int hot_add_node_scn_to_nid(unsigned long scn_addr)
 int hot_add_scn_to_nid(unsigned long scn_addr)
 {
 	struct device_node *memory = NULL;
-	int nid, found = 0;
+	int nid;
 

Do we want to do this only for ibm,hotplug-aperture compatible ranges?

I'm OK either ways

author
#10 lore raw

Re: [PATCH 3/4] powerpc/mm: allow memory hotplug into a memoryless node

Quoted 4 lines · Balbir Singh
Quoted 1 line · Reza Arbab

Remove the check which prevents us from hotplugging into an empty node.

Do we want to do this only for ibm,hotplug-aperture compatible ranges?

We could, but since past discussions and current testing have been unable to justify preventing hotplug to a memoryless node in the first place, I'm inclined to keep things simple.

If some edge case is discovered, making it conditional as you describe will be a good solution.

Thanks for your review! A v2 of this set is pending my investigation of Michael's suggestion to get node hotadd working.

Signature · 7 lines
Reza Arbab

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected].  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
author
#11 lore raw

PATCH 4/4 mm: enable CONFIG_MOVABLE_NODE on powerpc

In reply to Reza Arbab

Onlining memory into ZONE_MOVABLE requires CONFIG_MOVABLE_NODE.

Enable the use of this config option on PPC64 platforms.

---
 Documentation/kernel-parameters.txt | 2 +-
 mm/Kconfig                          | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
Documentation/kernel-parameters.txt +1 -1
index 46c030a..07fefd8 100644
@@ -2344,7 +2344,7 @@ bytes respectively. Such letter suffixes can also be entirely omitted.
 			that the amount of memory usable for all allocations
 			is not too small.
 
-	movable_node	[KNL,X86] Boot-time switch to enable the effects
+	movable_node	[KNL,X86,PPC] Boot-time switch to enable the effects
 			of CONFIG_MOVABLE_NODE=y. See mm/Kconfig for details.
 
 	MTD_Partition=	[MTD]
mm/Kconfig +1 -1
index 78a23c5..4154638 100644
@@ -153,7 +153,7 @@ config MOVABLE_NODE
 	bool "Enable to assign a node which has only movable memory"
 	depends on HAVE_MEMBLOCK
 	depends on NO_BOOTMEM
-	depends on X86_64
+	depends on X86_64 || PPC64
 	depends on NUMA
 	default n
 	help
Signature · 6 lines
1.8.3.1

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#12 lore raw
In reply to Reza Arbab
Quoted 4 lines · Reza Arbab

These changes enable onlining memory into ZONE_MOVABLE on power, and the creation of discrete nodes of movable memory.

Node hotplug is not supported on power [1].

But maybe it should be?

cheers

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

#13 lore raw
Quoted 9 lines · Michael Ellerman
Quoted 4 lines · Reza Arbab

These changes enable onlining memory into ZONE_MOVABLE on power, and the creation of discrete nodes of movable memory.

Node hotplug is not supported on power [1].

But maybe it should be?

Yes, it should be supported.

I have briefly looked into this recently only to find this will not be a simple update.

-Nathan

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

author
#14 lore raw
In reply to Michael Ellerman
Quoted 4 lines · Michael Ellerman
Quoted 1 line · Reza Arbab

Node hotplug is not supported on power [1].

But maybe it should be?

Doing so will involve, at the very least, reverting the commit I cited, 3af229f2071f ("powerpc/numa: Reset node_possible_map to only node_online_map"), and fixing that issue in a different way.

I'll look into it and see what I can do.

Signature · 7 lines
Reza Arbab

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected].  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>