linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/2] powerpc/pseries: Auto-online hotplugged memory
@ 2016-06-29 17:16 Nathan Fontenot
  2016-06-29 17:19 ` [PATCH v2 1/2] " Nathan Fontenot
  2016-06-29 17:20 ` [PATCH v2 2/2] powerpc/pseries: Remove call to memblock_add() Nathan Fontenot
  0 siblings, 2 replies; 4+ messages in thread
From: Nathan Fontenot @ 2016-06-29 17:16 UTC (permalink / raw)
  To: linuxppc-dev

Recent updates to the core mm code allow for auto-onlining of added
memory, commit id 31bc3858ea3. This update to the pseries hotplug
memory code takes advantage of this by setting the config option
CONFIG_MEMORY_HOTPLUG_DEFAULT_ONLINE=y so that we online added memory
by default, this maintains the current functionality, and removes
the code that explicitly onlines added memory.

Additionally the call to memblock_add() is removed, this is already
done in memory_add().

Changes from v1:
- The memhp_auto_online variable is no longer explicitly set.
- The patch is split into two patches
    1/2 - Update to us auto-onlining capabilities
    2/2 - Remove the call to memblock_add


-Nathan
---
 configs/pseries_defconfig          |    1 
 platforms/pseries/hotplug-memory.c |   51 +++++++------------------------------
 2 files changed, 11 insertions(+), 41 deletions(-)

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH v2 1/2] powerpc/pseries: Auto-online hotplugged memory
  2016-06-29 17:16 [PATCH v2 0/2] powerpc/pseries: Auto-online hotplugged memory Nathan Fontenot
@ 2016-06-29 17:19 ` Nathan Fontenot
  2016-07-17 10:28   ` [v2,1/2] " Michael Ellerman
  2016-06-29 17:20 ` [PATCH v2 2/2] powerpc/pseries: Remove call to memblock_add() Nathan Fontenot
  1 sibling, 1 reply; 4+ messages in thread
From: Nathan Fontenot @ 2016-06-29 17:19 UTC (permalink / raw)
  To: linuxppc-dev

A recent update (commit id 31bc3858ea3) allows for automatically
onlining memory that is added. This patch sets the config option
CONFIG_MEMORY_HOTPLUG_DEFAULT_ONLINE=y for pseries and updates the
pseries memory hotplug code so that DLPAR added memory can be
automatically onlined instead of explicitly onlining the memory.

Signed-off-by: Nathan Fontenot <nfont@linux.vnet.ibm.com>
---
 arch/powerpc/configs/pseries_defconfig          |    1 +
 arch/powerpc/platforms/pseries/hotplug-memory.c |   14 --------------
 2 files changed, 1 insertion(+), 14 deletions(-)

diff --git a/arch/powerpc/configs/pseries_defconfig b/arch/powerpc/configs/pseries_defconfig
index 36871a4..725f411 100644
--- a/arch/powerpc/configs/pseries_defconfig
+++ b/arch/powerpc/configs/pseries_defconfig
@@ -53,6 +53,7 @@ CONFIG_KEXEC=y
 CONFIG_IRQ_ALL_CPUS=y
 CONFIG_MEMORY_HOTPLUG=y
 CONFIG_MEMORY_HOTREMOVE=y
+CONFIG_MEMORY_HOTPLUG_DEFAULT_ONLINE=y
 CONFIG_KSM=y
 CONFIG_TRANSPARENT_HUGEPAGE=y
 CONFIG_PPC_64K_PAGES=y
diff --git a/arch/powerpc/platforms/pseries/hotplug-memory.c b/arch/powerpc/platforms/pseries/hotplug-memory.c
index 2ce1385..076cd7e 100644
--- a/arch/powerpc/platforms/pseries/hotplug-memory.c
+++ b/arch/powerpc/platforms/pseries/hotplug-memory.c
@@ -535,7 +535,6 @@ static int dlpar_memory_remove_by_index(u32 drc_index, struct property *prop)
 
 static int dlpar_add_lmb_memory(struct of_drconf_cell *lmb)
 {
-	struct memory_block *mem_block;
 	unsigned long block_sz;
 	int nid, rc;
 
@@ -556,19 +555,6 @@ static int dlpar_add_lmb_memory(struct of_drconf_cell *lmb)
 		return rc;
 	}
 
-	mem_block = lmb_to_memblock(lmb);
-	if (!mem_block) {
-		remove_memory(nid, lmb->base_addr, block_sz);
-		return -EINVAL;
-	}
-
-	rc = device_online(&mem_block->dev);
-	put_device(&mem_block->dev);
-	if (rc) {
-		remove_memory(nid, lmb->base_addr, block_sz);
-		return rc;
-	}
-
 	lmb->flags |= DRCONF_MEM_ASSIGNED;
 	return 0;
 }

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH v2 2/2] powerpc/pseries: Remove call to memblock_add()
  2016-06-29 17:16 [PATCH v2 0/2] powerpc/pseries: Auto-online hotplugged memory Nathan Fontenot
  2016-06-29 17:19 ` [PATCH v2 1/2] " Nathan Fontenot
@ 2016-06-29 17:20 ` Nathan Fontenot
  1 sibling, 0 replies; 4+ messages in thread
From: Nathan Fontenot @ 2016-06-29 17:20 UTC (permalink / raw)
  To: linuxppc-dev

The call to memblock_add is not needed, this is already done by
memory_add(). This patch removes this call which shrinks
dlpar_add_lmb_memory() enough that it can be merged into dlpar_add_lmb().

Signed-off-by: Nathan Fontenot <nfont@linux.vnet.ibm.com>
---
 arch/powerpc/platforms/pseries/hotplug-memory.c |   37 ++++++-----------------
 1 file changed, 10 insertions(+), 27 deletions(-)

diff --git a/arch/powerpc/platforms/pseries/hotplug-memory.c b/arch/powerpc/platforms/pseries/hotplug-memory.c
index 076cd7e..43c8691 100644
--- a/arch/powerpc/platforms/pseries/hotplug-memory.c
+++ b/arch/powerpc/platforms/pseries/hotplug-memory.c
@@ -533,36 +533,11 @@ static int dlpar_memory_remove_by_index(u32 drc_index, struct property *prop)
 
 #endif /* CONFIG_MEMORY_HOTREMOVE */
 
-static int dlpar_add_lmb_memory(struct of_drconf_cell *lmb)
+static int dlpar_add_lmb(struct of_drconf_cell *lmb)
 {
 	unsigned long block_sz;
 	int nid, rc;
 
-	block_sz = memory_block_size_bytes();
-
-	/* Find the node id for this address */
-	nid = memory_add_physaddr_to_nid(lmb->base_addr);
-
-	/* Add the memory */
-	rc = add_memory(nid, lmb->base_addr, block_sz);
-	if (rc)
-		return rc;
-
-	/* Register this block of memory */
-	rc = memblock_add(lmb->base_addr, block_sz);
-	if (rc) {
-		remove_memory(nid, lmb->base_addr, block_sz);
-		return rc;
-	}
-
-	lmb->flags |= DRCONF_MEM_ASSIGNED;
-	return 0;
-}
-
-static int dlpar_add_lmb(struct of_drconf_cell *lmb)
-{
-	int rc;
-
 	if (lmb->flags & DRCONF_MEM_ASSIGNED)
 		return -EINVAL;
 
@@ -578,10 +553,18 @@ static int dlpar_add_lmb(struct of_drconf_cell *lmb)
 		return rc;
 	}
 
-	rc = dlpar_add_lmb_memory(lmb);
+	block_sz = memory_block_size_bytes();
+
+	/* Find the node id for this address */
+	nid = memory_add_physaddr_to_nid(lmb->base_addr);
+
+	/* Add the memory */
+	rc = add_memory(nid, lmb->base_addr, block_sz);
 	if (rc) {
 		dlpar_remove_device_tree_lmb(lmb);
 		dlpar_release_drc(lmb->drc_index);
+	} else {
+		lmb->flags |= DRCONF_MEM_ASSIGNED;
 	}
 
 	return rc;

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [v2,1/2] powerpc/pseries: Auto-online hotplugged memory
  2016-06-29 17:19 ` [PATCH v2 1/2] " Nathan Fontenot
@ 2016-07-17 10:28   ` Michael Ellerman
  0 siblings, 0 replies; 4+ messages in thread
From: Michael Ellerman @ 2016-07-17 10:28 UTC (permalink / raw)
  To: Nathan Fontenot, linuxppc-dev

On Wed, 2016-29-06 at 17:19:14 UTC, Nathan Fontenot wrote:
> A recent update (commit id 31bc3858ea3) allows for automatically
> onlining memory that is added. This patch sets the config option
> CONFIG_MEMORY_HOTPLUG_DEFAULT_ONLINE=y for pseries and updates the
> pseries memory hotplug code so that DLPAR added memory can be
> automatically onlined instead of explicitly onlining the memory.
> 
> Signed-off-by: Nathan Fontenot <nfont@linux.vnet.ibm.com>

Series applied to powerpc next, thanks.

https://git.kernel.org/powerpc/c/ec999072442ad531cccbecbd6d

cheers

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-07-17 10:28 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-06-29 17:16 [PATCH v2 0/2] powerpc/pseries: Auto-online hotplugged memory Nathan Fontenot
2016-06-29 17:19 ` [PATCH v2 1/2] " Nathan Fontenot
2016-07-17 10:28   ` [v2,1/2] " Michael Ellerman
2016-06-29 17:20 ` [PATCH v2 2/2] powerpc/pseries: Remove call to memblock_add() Nathan Fontenot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).