|
Michal Suchanek |
52eba8 |
From f9f130ff2ec93c5949576bbfb168cc9530c23649 Mon Sep 17 00:00:00 2001
|
|
Michal Suchanek |
52eba8 |
From: Srikar Dronamraju <srikar@linux.vnet.ibm.com>
|
|
Michal Suchanek |
52eba8 |
Date: Mon, 10 Aug 2020 12:48:31 +0530
|
|
Michal Suchanek |
52eba8 |
Subject: [PATCH] powerpc/numa: Detect support for coregroup
|
|
Michal Suchanek |
52eba8 |
|
|
Michal Suchanek |
52eba8 |
References: bsc#1209999 ltc#202140 bsc#1142685 ltc#179509 FATE#327775 git-fixes
|
|
Michal Suchanek |
52eba8 |
Patch-mainline: v5.10-rc1
|
|
Michal Suchanek |
52eba8 |
Git-commit: f9f130ff2ec93c5949576bbfb168cc9530c23649
|
|
Michal Suchanek |
52eba8 |
|
|
Michal Suchanek |
52eba8 |
Add support for grouping cores based on the device-tree classification.
|
|
Michal Suchanek |
52eba8 |
- The last domain in the associativity domains always refers to the
|
|
Michal Suchanek |
52eba8 |
core.
|
|
Michal Suchanek |
52eba8 |
- If primary reference domain happens to be the penultimate domain in
|
|
Michal Suchanek |
52eba8 |
the associativity domains device-tree property, then there are no
|
|
Michal Suchanek |
52eba8 |
coregroups. However if its not a penultimate domain, then there are
|
|
Michal Suchanek |
52eba8 |
coregroups. There can be more than one coregroup. For now we would be
|
|
Michal Suchanek |
52eba8 |
interested in the last or the smallest coregroups, i.e one sub-group
|
|
Michal Suchanek |
52eba8 |
per DIE.
|
|
Michal Suchanek |
52eba8 |
|
|
Michal Suchanek |
52eba8 |
Currently there are no firmwares that are exposing this grouping. Hence
|
|
Michal Suchanek |
52eba8 |
allow the basis for grouping to be abstract. Once the firmware starts
|
|
Michal Suchanek |
52eba8 |
using this grouping, code would be added to detect the type of grouping
|
|
Michal Suchanek |
52eba8 |
and adjust the sd domain flags accordingly.
|
|
Michal Suchanek |
52eba8 |
|
|
Michal Suchanek |
52eba8 |
Signed-off-by: Srikar Dronamraju <srikar@linux.vnet.ibm.com>
|
|
Michal Suchanek |
52eba8 |
Reviewed-by: Gautham R. Shenoy <ego@linux.vnet.ibm.com>
|
|
Michal Suchanek |
52eba8 |
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
|
|
Michal Suchanek |
52eba8 |
Link: https://lore.kernel.org/r/20200810071834.92514-8-srikar@linux.vnet.ibm.com
|
|
Michal Suchanek |
52eba8 |
Acked-by: Michal Suchanek <msuchanek@suse.de>
|
|
Michal Suchanek |
52eba8 |
---
|
|
Michal Suchanek |
52eba8 |
arch/powerpc/include/asm/smp.h | 1 +
|
|
Michal Suchanek |
52eba8 |
arch/powerpc/kernel/smp.c | 1 +
|
|
Michal Suchanek |
52eba8 |
arch/powerpc/mm/numa.c | 34 +++++++++++++++++++++-------------
|
|
Michal Suchanek |
52eba8 |
3 files changed, 23 insertions(+), 13 deletions(-)
|
|
Michal Suchanek |
52eba8 |
|
|
Michal Suchanek |
52eba8 |
diff --git a/arch/powerpc/include/asm/smp.h b/arch/powerpc/include/asm/smp.h
|
|
Michal Suchanek |
52eba8 |
index b727f5f7b8f9..041f0b97c45b 100644
|
|
Michal Suchanek |
52eba8 |
--- a/arch/powerpc/include/asm/smp.h
|
|
Michal Suchanek |
52eba8 |
+++ b/arch/powerpc/include/asm/smp.h
|
|
Michal Suchanek |
52eba8 |
@@ -28,6 +28,7 @@
|
|
Michal Suchanek |
52eba8 |
extern int boot_cpuid;
|
|
Michal Suchanek |
52eba8 |
extern int spinning_secondaries;
|
|
Michal Suchanek |
52eba8 |
extern u32 *cpu_to_phys_id;
|
|
Michal Suchanek |
52eba8 |
+extern bool coregroup_enabled;
|
|
Michal Suchanek |
52eba8 |
|
|
Michal Suchanek |
52eba8 |
extern void cpu_die(void);
|
|
Michal Suchanek |
52eba8 |
extern int cpu_to_chip_id(int cpu);
|
|
Michal Suchanek |
52eba8 |
diff --git a/arch/powerpc/kernel/smp.c b/arch/powerpc/kernel/smp.c
|
|
Michal Suchanek |
52eba8 |
--- a/arch/powerpc/kernel/smp.c
|
|
Michal Suchanek |
52eba8 |
+++ b/arch/powerpc/kernel/smp.c
|
|
Michal Suchanek |
52eba8 |
@@ -75,6 +75,7 @@ static DEFINE_PER_CPU(int, cpu_state) = { 0 };
|
|
Michal Suchanek |
52eba8 |
|
|
Michal Suchanek |
52eba8 |
struct thread_info *secondary_ti;
|
|
Michal Suchanek |
52eba8 |
bool has_big_cores;
|
|
Michal Suchanek |
52eba8 |
+bool coregroup_enabled;
|
|
Michal Suchanek |
52eba8 |
|
|
Michal Suchanek |
52eba8 |
DEFINE_PER_CPU(cpumask_var_t, cpu_sibling_map);
|
|
Michal Suchanek |
52eba8 |
DEFINE_PER_CPU(cpumask_var_t, cpu_smallcore_map);
|
|
Michal Suchanek |
52eba8 |
diff --git a/arch/powerpc/mm/numa.c b/arch/powerpc/mm/numa.c
|
|
Michal Suchanek |
52eba8 |
index 481951ac3e55..b2c44c5a81fb 100644
|
|
Michal Suchanek |
52eba8 |
--- a/arch/powerpc/mm/numa.c
|
|
Michal Suchanek |
52eba8 |
+++ b/arch/powerpc/mm/numa.c
|
|
Michal Suchanek |
52eba8 |
@@ -897,7 +897,9 @@ static void __init setup_node_data(int nid, u64 start_pfn, u64 end_pfn)
|
|
Michal Suchanek |
52eba8 |
static void __init find_possible_nodes(void)
|
|
Michal Suchanek |
52eba8 |
{
|
|
Michal Suchanek |
52eba8 |
struct device_node *rtas;
|
|
Michal Suchanek |
52eba8 |
- u32 numnodes, i;
|
|
Michal Suchanek |
52eba8 |
+ const __be32 *domains;
|
|
Michal Suchanek |
52eba8 |
+ int prop_length, max_nodes;
|
|
Michal Suchanek |
52eba8 |
+ u32 i;
|
|
Michal Suchanek |
52eba8 |
|
|
Michal Suchanek |
52eba8 |
if (!numa_enabled)
|
|
Michal Suchanek |
52eba8 |
return;
|
|
Michal Suchanek |
52eba8 |
@@ -906,25 +908,31 @@ static void __init find_possible_nodes(void)
|
|
Michal Suchanek |
52eba8 |
if (!rtas)
|
|
Michal Suchanek |
52eba8 |
return;
|
|
Michal Suchanek |
52eba8 |
|
|
Michal Suchanek |
52eba8 |
- if (of_property_read_u32_index(rtas, "ibm,current-associativity-domains",
|
|
Michal Suchanek |
52eba8 |
- min_common_depth, &numnodes)) {
|
|
Michal Suchanek |
52eba8 |
- /*
|
|
Michal Suchanek |
52eba8 |
- * ibm,current-associativity-domains is a fairly recent
|
|
Michal Suchanek |
52eba8 |
- * property. If it doesn't exist, then fallback on
|
|
Michal Suchanek |
52eba8 |
- * ibm,max-associativity-domains. Current denotes what the
|
|
Michal Suchanek |
52eba8 |
- * platform can support compared to max which denotes what the
|
|
Michal Suchanek |
52eba8 |
- * Hypervisor can support.
|
|
Michal Suchanek |
52eba8 |
- */
|
|
Michal Suchanek |
52eba8 |
- if (of_property_read_u32_index(rtas, "ibm,max-associativity-domains",
|
|
Michal Suchanek |
52eba8 |
- min_common_depth, &numnodes))
|
|
Michal Suchanek |
52eba8 |
+ /*
|
|
Michal Suchanek |
52eba8 |
+ * ibm,current-associativity-domains is a fairly recent property. If
|
|
Michal Suchanek |
52eba8 |
+ * it doesn't exist, then fallback on ibm,max-associativity-domains.
|
|
Michal Suchanek |
52eba8 |
+ * Current denotes what the platform can support compared to max
|
|
Michal Suchanek |
52eba8 |
+ * which denotes what the Hypervisor can support.
|
|
Michal Suchanek |
52eba8 |
+ */
|
|
Michal Suchanek |
52eba8 |
+ domains = of_get_property(rtas, "ibm,current-associativity-domains",
|
|
Michal Suchanek |
52eba8 |
+ &prop_length);
|
|
Michal Suchanek |
52eba8 |
+ if (!domains) {
|
|
Michal Suchanek |
52eba8 |
+ domains = of_get_property(rtas, "ibm,max-associativity-domains",
|
|
Michal Suchanek |
52eba8 |
+ &prop_length);
|
|
Michal Suchanek |
52eba8 |
+ if (!domains)
|
|
Michal Suchanek |
52eba8 |
goto out;
|
|
Michal Suchanek |
52eba8 |
}
|
|
Michal Suchanek |
52eba8 |
|
|
Michal Suchanek |
52eba8 |
- for (i = 0; i < numnodes; i++) {
|
|
Michal Suchanek |
52eba8 |
+ max_nodes = of_read_number(&domains[min_common_depth], 1);
|
|
Michal Suchanek |
52eba8 |
+ for (i = 0; i < max_nodes; i++) {
|
|
Michal Suchanek |
52eba8 |
if (!node_possible(i))
|
|
Michal Suchanek |
52eba8 |
node_set(i, node_possible_map);
|
|
Michal Suchanek |
52eba8 |
}
|
|
Michal Suchanek |
52eba8 |
|
|
Michal Suchanek |
52eba8 |
+ prop_length /= sizeof(int);
|
|
Michal Suchanek |
52eba8 |
+ if (prop_length > min_common_depth + 2)
|
|
Michal Suchanek |
52eba8 |
+ coregroup_enabled = 1;
|
|
Michal Suchanek |
52eba8 |
+
|
|
Michal Suchanek |
52eba8 |
out:
|
|
Michal Suchanek |
52eba8 |
of_node_put(rtas);
|
|
Michal Suchanek |
52eba8 |
}
|
|
Michal Suchanek |
52eba8 |
--
|
|
Michal Suchanek |
52eba8 |
2.40.0
|
|
Michal Suchanek |
52eba8 |
|