From: Michael Bringmann <mwb@linux.vnet.ibm.com>
To: linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org,
Paul Mackerras <paulus@samba.org>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.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.ibm.com>,
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>,
Nathan Fontenot <nfont@linux.vnet.ibm.com>,
Andrew Donnellan <andrew.donnellan@au1.ibm.com>,
John Allen <jallen@linux.vnet.ibm.com>,
Tyrel Datwyler <tyreld@linux.vnet.ibm.com>,
Sahil Mehta <sahilmehta17@gmail.com>,
Rashmica Gupta <rashmicy@gmail.com>,
Ingo Molnar <mingo@kernel.org>
Subject: [PATCH V2 1/2] powerpc/numa: Update CPU topology when VPHN enabled
Date: Thu, 25 May 2017 12:35:04 -0500 [thread overview]
Message-ID: <6d5f8438-094b-41b4-a95b-97f89c4d6a08@linux.vnet.ibm.com> (raw)
In-Reply-To: <20170525171932.29159.89311.stgit@ltcalpine2-lp20.aus.stglabs.ibm.com>
powerpc/numa: Correct the currently broken capability to set the
topology for shared CPUs in LPARs. At boot time for shared CPU
lpars, the topology for each shared CPU is set to node zero, however,
this is now updated correctly using the Virtual Processor Home Node
(VPHN) capabilities information provided by the pHyp. The VPHN handling
in Linux is disabled, if PRRN handling is present.
Signed-off-by: Michael Bringmann <mwb@linux.vnet.ibm.com>
---
arch/powerpc/mm/numa.c | 19 ++++++++++++++++++-
arch/powerpc/platforms/pseries/dlpar.c | 2 ++
arch/powerpc/platforms/pseries/hotplug-cpu.c | 3 ++-
3 files changed, 22 insertions(+), 2 deletions(-)
diff --git a/arch/powerpc/mm/numa.c b/arch/powerpc/mm/numa.c
index 371792e..15c2dd5 100644
--- a/arch/powerpc/mm/numa.c
+++ b/arch/powerpc/mm/numa.c
@@ -29,6 +29,7 @@
#include <linux/seq_file.h>
#include <linux/uaccess.h>
#include <linux/slab.h>
+#include <linux/sched.h>
#include <asm/cputhreads.h>
#include <asm/sparsemem.h>
#include <asm/prom.h>
@@ -42,6 +43,8 @@
#include <asm/vdso.h>
static int numa_enabled = 1;
+static int topology_inited;
+static int topology_update_needed;
static char *cmdline __initdata;
@@ -1321,8 +1324,11 @@ int arch_update_cpu_topology(void)
struct device *dev;
int weight, new_nid, i = 0;
- if (!prrn_enabled && !vphn_enabled)
+ if (!prrn_enabled && !vphn_enabled) {
+ if (!topology_inited)
+ topology_update_needed = 1;
return 0;
+ }
weight = cpumask_weight(&cpu_associativity_changes_mask);
if (!weight)
@@ -1361,6 +1367,8 @@ int arch_update_cpu_topology(void)
cpumask_andnot(&cpu_associativity_changes_mask,
&cpu_associativity_changes_mask,
cpu_sibling_mask(cpu));
+ pr_info("Assoc chg gives same node %d for cpu%d\n",
+ new_nid, cpu);
cpu = cpu_last_thread_sibling(cpu);
continue;
}
@@ -1377,6 +1385,9 @@ int arch_update_cpu_topology(void)
cpu = cpu_last_thread_sibling(cpu);
}
+ if (i)
+ updates[i-1].next = NULL;
+
pr_debug("Topology update for the following CPUs:\n");
if (cpumask_weight(&updated_cpus)) {
for (ud = &updates[0]; ud; ud = ud->next) {
@@ -1423,6 +1434,7 @@ int arch_update_cpu_topology(void)
out:
kfree(updates);
+ topology_update_needed = 0;
return changed;
}
@@ -1600,6 +1612,11 @@ static int topology_update_init(void)
if (!proc_create("powerpc/topology_updates", 0644, NULL, &topology_ops))
return -ENOMEM;
+ topology_inited = 1;
+ if (topology_update_needed)
+ bitmap_fill(cpumask_bits(&cpu_associativity_changes_mask),
+ nr_cpumask_bits);
+
return 0;
}
device_initcall(topology_update_init);
diff --git a/arch/powerpc/platforms/pseries/dlpar.c b/arch/powerpc/platforms/pseries/dlpar.c
index bda18d8..5106263 100644
--- a/arch/powerpc/platforms/pseries/dlpar.c
+++ b/arch/powerpc/platforms/pseries/dlpar.c
@@ -592,6 +592,8 @@ static ssize_t dlpar_show(struct class *class, struct class_attribute *attr,
static int __init pseries_dlpar_init(void)
{
+ arch_update_cpu_topology();
+
pseries_hp_wq = alloc_workqueue("pseries hotplug workqueue",
WQ_UNBOUND, 1);
return sysfs_create_file(kernel_kobj, &class_attr_dlpar.attr);
diff --git a/arch/powerpc/platforms/pseries/hotplug-cpu.c b/arch/powerpc/platforms/pseries/hotplug-cpu.c
index 7bc0e91..b5eff35 100644
--- a/arch/powerpc/platforms/pseries/hotplug-cpu.c
+++ b/arch/powerpc/platforms/pseries/hotplug-cpu.c
@@ -619,7 +619,8 @@ static int dlpar_cpu_remove_by_index(u32 drc_index)
}
rc = dlpar_cpu_remove(dn, drc_index);
- of_node_put(dn);
+ if (rc)
+ of_node_put(dn);
return rc;
}
next parent reply other threads:[~2017-05-25 17:35 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20170525171932.29159.89311.stgit@ltcalpine2-lp20.aus.stglabs.ibm.com>
2017-05-25 17:35 ` Michael Bringmann [this message]
2017-05-25 22:05 ` [PATCH V2 1/2] powerpc/numa: Update CPU topology when VPHN enabled Tyrel Datwyler
2017-05-26 17:19 ` kbuild test robot
2017-05-25 17:37 ` [PATCH V2 2/2]: powerpc/hotplug/mm: Fix hot-add memory node assoc Michael Bringmann
2017-05-26 3:23 ` Balbir Singh
2017-05-26 12:28 ` Michael Bringmann
2017-05-26 5:38 ` Michael Ellerman
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=6d5f8438-094b-41b4-a95b-97f89c4d6a08@linux.vnet.ibm.com \
--to=mwb@linux.vnet.ibm.com \
--cc=andrew.donnellan@au1.ibm.com \
--cc=aneesh.kumar@linux.vnet.ibm.com \
--cc=arbab@linux.vnet.ibm.com \
--cc=benh@kernel.crashing.org \
--cc=bharata@linux.vnet.ibm.com \
--cc=bigeasy@linutronix.de \
--cc=bsingharora@gmail.com \
--cc=jallen@linux.vnet.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=mingo@kernel.org \
--cc=mpe@ellerman.id.au \
--cc=nfont@linux.vnet.ibm.com \
--cc=paulus@samba.org \
--cc=rashmicy@gmail.com \
--cc=sahilmehta17@gmail.com \
--cc=shailendras@nvidia.com \
--cc=tglx@linutronix.de \
--cc=tyreld@linux.vnet.ibm.com \
/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).