From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 3wYbxt5MBGzDqky for ; Fri, 26 May 2017 03:35:14 +1000 (AEST) Received: from pps.filterd (m0098404.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.20/8.16.0.20) with SMTP id v4PHSfBY076093 for ; Thu, 25 May 2017 13:35:12 -0400 Received: from e35.co.us.ibm.com (e35.co.us.ibm.com [32.97.110.153]) by mx0a-001b2d01.pphosted.com with ESMTP id 2ans8y7r24-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Thu, 25 May 2017 13:35:11 -0400 Received: from localhost by e35.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 25 May 2017 11:35:10 -0600 To: linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, Paul Mackerras Cc: Benjamin Herrenschmidt , Michael Ellerman , Reza Arbab , Thomas Gleixner , Bharata B Rao , Balbir Singh , Michael Bringmann , Shailendra Singh , "Aneesh Kumar K.V" , Sebastian Andrzej Siewior , Nathan Fontenot , Andrew Donnellan , John Allen , Tyrel Datwyler , Sahil Mehta , Rashmica Gupta , Ingo Molnar In-Reply-To: <20170525171932.29159.89311.stgit@ltcalpine2-lp20.aus.stglabs.ibm.com> From: Michael Bringmann Subject: [PATCH V2 1/2] powerpc/numa: Update CPU topology when VPHN enabled Date: Thu, 25 May 2017 12:35:04 -0500 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Message-Id: <6d5f8438-094b-41b4-a95b-97f89c4d6a08@linux.vnet.ibm.com> List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , 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 --- 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 #include #include +#include #include #include #include @@ -42,6 +43,8 @@ #include 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; }