linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Michael Bringmann <mwb@linux.vnet.ibm.com>
To: linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>,
	Paul Mackerras <paulus@samba.org>,
	Michael Ellerman <mpe@ellerman.id.au>,
	Reza Arbab <arbab@linux.vnet.ibm.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	Bharata B Rao <bharata@linux.vnet.ib>,
	Balbir Singh <bsingharora@gmail.com>,
	Michael Bringmann <mwb@linux.vnet.ibm.com>,
	Shailendra Singh <shailendras@nvidia.com>,
	"Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>,
	Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Subject: [Patch 2/2]: powerpc/hotplug/mm: Fix hot-add memory node assoc
Date: Tue, 23 May 2017 10:15:44 -0500	[thread overview]
Message-ID: <3bb44d92-b2ff-e197-4bdf-ec6d588d6dab@linux.vnet.ibm.com> (raw)


Removing or adding memory via the PowerPC hotplug interface shows
anomalies in the association between memory and nodes.  The code
was updated to initialize more possible nodes to make them available
to subsequent DLPAR hotplug-memory operations, even if they are not
needed at boot time.

Signed-off-by: Michael Bringmann <mwb@linux.vnet.ibm.com>
---
 arch/powerpc/mm/numa.c |   44 ++++++++++++++++++++++++++++++++------------
 1 file changed, 32 insertions(+), 12 deletions(-)

diff --git a/arch/powerpc/mm/numa.c b/arch/powerpc/mm/numa.c
index 15c2dd5..3d58c1f 100644
--- a/arch/powerpc/mm/numa.c
+++ b/arch/powerpc/mm/numa.c
@@ -870,7 +870,7 @@ void __init dump_numa_cpu_topology(void)
 }
 
 /* Initialize NODE_DATA for a node on the local memory */
-static void __init setup_node_data(int nid, u64 start_pfn, u64 end_pfn)
+static void setup_node_data(int nid, u64 start_pfn, u64 end_pfn)
 {
 	u64 spanned_pages = end_pfn - start_pfn;
 	const size_t nd_size = roundup(sizeof(pg_data_t), SMP_CACHE_BYTES);
@@ -878,23 +878,41 @@ static void __init setup_node_data(int nid, u64 start_pfn, u64 end_pfn)
 	void *nd;
 	int tnid;
 
-	nd_pa = memblock_alloc_try_nid(nd_size, SMP_CACHE_BYTES, nid);
-	nd = __va(nd_pa);
+	if (!node_data[nid]) {
+		nd_pa = memblock_alloc_try_nid(nd_size, SMP_CACHE_BYTES, nid);
+		nd = __va(nd_pa);
 
-	/* report and initialize */
-	pr_info("  NODE_DATA [mem %#010Lx-%#010Lx]\n",
-		nd_pa, nd_pa + nd_size - 1);
-	tnid = early_pfn_to_nid(nd_pa >> PAGE_SHIFT);
-	if (tnid != nid)
-		pr_info("    NODE_DATA(%d) on node %d\n", nid, tnid);
+		node_data[nid] = nd;
+		memset(NODE_DATA(nid), 0, sizeof(pg_data_t));
+		NODE_DATA(nid)->node_id = nid;
+
+		/* report and initialize */
+		pr_info("  NODE_DATA [mem %#010Lx-%#010Lx]\n",
+			nd_pa, nd_pa + nd_size - 1);
+		tnid = early_pfn_to_nid(nd_pa >> PAGE_SHIFT);
+		if (tnid != nid)
+			pr_info("    NODE_DATA(%d) on node %d\n", nid, tnid);
+	} else {
+		nd_pa = (u64) node_data[nid];
+		nd = __va(nd_pa);
+	}
 
-	node_data[nid] = nd;
-	memset(NODE_DATA(nid), 0, sizeof(pg_data_t));
-	NODE_DATA(nid)->node_id = nid;
 	NODE_DATA(nid)->node_start_pfn = start_pfn;
 	NODE_DATA(nid)->node_spanned_pages = spanned_pages;
 }
 
+static void setup_nodes(void)
+{
+	int i, l = 32 /* MAX_NUMNODES */;
+
+	for (i = 0; i < l; i++) {
+		if (!node_possible(i)) {
+			setup_node_data(i, 0, 0);
+			node_set(i, node_possible_map);
+		}
+	}
+}
+
 void __init initmem_init(void)
 {
 	int nid, cpu;
@@ -914,6 +932,8 @@ void __init initmem_init(void)
 	 */
 	nodes_and(node_possible_map, node_possible_map, node_online_map);
 
+	setup_nodes();
+
 	for_each_online_node(nid) {
 		unsigned long start_pfn, end_pfn;
 

             reply	other threads:[~2017-05-23 15:15 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-23 15:15 Michael Bringmann [this message]
2017-05-23 15:52 ` [Patch 2/2]: powerpc/hotplug/mm: Fix hot-add memory node assoc Reza Arbab
2017-05-23 20:05   ` Michael Bringmann
2017-05-23 21:49     ` Reza Arbab
2017-05-23 22:41       ` Michael Bringmann
2017-05-23 22:44       ` Michael Bringmann
2017-05-24 11:19         ` Michael Ellerman
2017-05-24 23:55           ` Michael Bringmann
2017-05-25  6:19             ` Michael Ellerman
2017-05-25 13:40               ` Michael Bringmann
2017-05-25 15:10               ` Reza Arbab
2017-05-25 15:26                 ` Michael Bringmann
2017-05-26  3:46                 ` Balbir Singh
2017-05-26  3:46                 ` Michael Ellerman
2017-05-26 12:31                   ` Michael Bringmann
2017-05-26 14:31                   ` Reza Arbab
2017-05-29  5:32                     ` Michael Ellerman
2017-05-31 14:05                       ` Michael Bringmann
2017-06-01  9:36                         ` Michael Ellerman
2017-06-01 21:33                           ` Reza Arbab
2017-06-07  8:06                             ` Balbir Singh
2017-06-07 12:07                             ` Michael Ellerman
2017-06-02  5:24                           ` Michael Bringmann
2017-06-06  9:48                             ` Michael Ellerman
2017-06-06 16:16                               ` Michael Bringmann
2017-06-07 12:08                                 ` Michael Ellerman
2017-06-07 17:28                                   ` RESEND " Michael Bringmann
2017-06-13 10:45                                     ` Michael Ellerman
2017-06-13 22:21                                       ` Michael Bringmann
2017-06-14  5:25                                         ` Balbir Singh
2017-06-14  5:27                                           ` Balbir Singh
2017-06-14 13:41                                             ` Michael Bringmann
2017-06-07 17:17                                 ` Michael Bringmann
2017-05-24 14:36         ` Reza Arbab
2017-05-24 23:41           ` Michael Bringmann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3bb44d92-b2ff-e197-4bdf-ec6d588d6dab@linux.vnet.ibm.com \
    --to=mwb@linux.vnet.ibm.com \
    --cc=aneesh.kumar@linux.vnet.ibm.com \
    --cc=arbab@linux.vnet.ibm.com \
    --cc=benh@kernel.crashing.org \
    --cc=bharata@linux.vnet.ib \
    --cc=bigeasy@linutronix.de \
    --cc=bsingharora@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=mpe@ellerman.id.au \
    --cc=paulus@samba.org \
    --cc=shailendras@nvidia.com \
    --cc=tglx@linutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).