linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC PATCH] arch_topology: Use llc_id instead of package_id
@ 2022-05-13  8:34 Dietmar Eggemann
  2022-05-13  9:03 ` Sudeep Holla
  0 siblings, 1 reply; 12+ messages in thread
From: Dietmar Eggemann @ 2022-05-13  8:34 UTC (permalink / raw)
  To: Sudeep Holla, Qing Wang
  Cc: Greg Kroah-Hartman, Rafael J . Wysocki, Vincent Guittot,
	Morten Rasmussen, linux-kernel

package_id should represent socket in DT. Free it for possible socket
dts parsing and use the so far unused llc_id / llc_sibling cpumask to
decode 1. level clusters used in pre-DynamIQ big/little systems.

cpu_coregroup_mask() will return llc_sibling isntead of core_mask in
this case.

This will let the cluster_id / cluster_sibling cpumask be available for
2. level clusters (e.g. to map L2 sharing in Armv9 A510 complexes).

The corresponding sched domain CLS is similarly used in ACPI (servers)
to map e.g. Kunpeng920 L3-tags or Ampere Altra's SCU bounderies.

Lighlty tested on qemu-system-aarch64 with 1x8 (cluster-x-core) and
2x4 cpu-map.

Signed-off-by: Dietmar Eggemann <dietmar.eggemann@arm.com>
---

Related to: https://lkml.kernel.org/r/1652361692-13196-1-git-send-email-wangqing@vivo.com

 drivers/base/arch_topology.c | 24 ++++++++++++------------
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/drivers/base/arch_topology.c b/drivers/base/arch_topology.c
index f73b836047cf..ac1488990cc8 100644
--- a/drivers/base/arch_topology.c
+++ b/drivers/base/arch_topology.c
@@ -490,7 +490,7 @@ static int __init get_cpu_for_node(struct device_node *node)
 	return cpu;
 }
 
-static int __init parse_core(struct device_node *core, int package_id,
+static int __init parse_core(struct device_node *core, int llc_id,
 			     int core_id)
 {
 	char name[20];
@@ -506,7 +506,8 @@ static int __init parse_core(struct device_node *core, int package_id,
 			leaf = false;
 			cpu = get_cpu_for_node(t);
 			if (cpu >= 0) {
-				cpu_topology[cpu].package_id = package_id;
+				cpu_topology[cpu].package_id = 0;
+				cpu_topology[cpu].llc_id = llc_id;
 				cpu_topology[cpu].core_id = core_id;
 				cpu_topology[cpu].thread_id = i;
 			} else if (cpu != -ENODEV) {
@@ -527,7 +528,8 @@ static int __init parse_core(struct device_node *core, int package_id,
 			return -EINVAL;
 		}
 
-		cpu_topology[cpu].package_id = package_id;
+		cpu_topology[cpu].package_id = 0;
+		cpu_topology[cpu].llc_id = llc_id;
 		cpu_topology[cpu].core_id = core_id;
 	} else if (leaf && cpu != -ENODEV) {
 		pr_err("%pOF: Can't get CPU for leaf core\n", core);
@@ -543,7 +545,7 @@ static int __init parse_cluster(struct device_node *cluster, int depth)
 	bool leaf = true;
 	bool has_cores = false;
 	struct device_node *c;
-	static int package_id __initdata;
+	static int llc_id __initdata;
 	int core_id = 0;
 	int i, ret;
 
@@ -582,7 +584,7 @@ static int __init parse_cluster(struct device_node *cluster, int depth)
 			}
 
 			if (leaf) {
-				ret = parse_core(c, package_id, core_id++);
+				ret = parse_core(c, llc_id, core_id++);
 			} else {
 				pr_err("%pOF: Non-leaf cluster with core %s\n",
 				       cluster, name);
@@ -600,7 +602,7 @@ static int __init parse_cluster(struct device_node *cluster, int depth)
 		pr_warn("%pOF: empty cluster\n", cluster);
 
 	if (leaf)
-		package_id++;
+		llc_id++;
 
 	return 0;
 }
@@ -693,14 +695,12 @@ void update_siblings_masks(unsigned int cpuid)
 	for_each_online_cpu(cpu) {
 		cpu_topo = &cpu_topology[cpu];
 
-		if (cpu_topo->llc_id != -1 && cpuid_topo->llc_id == cpu_topo->llc_id) {
-			cpumask_set_cpu(cpu, &cpuid_topo->llc_sibling);
-			cpumask_set_cpu(cpuid, &cpu_topo->llc_sibling);
-		}
-
-		if (cpuid_topo->package_id != cpu_topo->package_id)
+		if (cpuid_topo->llc_id != cpu_topo->llc_id)
 			continue;
 
+		cpumask_set_cpu(cpu, &cpuid_topo->llc_sibling);
+		cpumask_set_cpu(cpuid, &cpu_topo->llc_sibling);
+
 		if (cpuid_topo->cluster_id == cpu_topo->cluster_id &&
 		    cpuid_topo->cluster_id != -1) {
 			cpumask_set_cpu(cpu, &cpuid_topo->cluster_sibling);
-- 
2.25.1


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

end of thread, other threads:[~2022-05-19  9:22 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-13  8:34 [RFC PATCH] arch_topology: Use llc_id instead of package_id Dietmar Eggemann
2022-05-13  9:03 ` Sudeep Holla
2022-05-13 10:42   ` Dietmar Eggemann
2022-05-13 11:03     ` Sudeep Holla
2022-05-13 12:04       ` Dietmar Eggemann
2022-05-16 10:35         ` Sudeep Holla
2022-05-17  9:14           ` Dietmar Eggemann
2022-05-17 10:57             ` Sudeep Holla
2022-05-18 10:23               ` Dietmar Eggemann
2022-05-18 10:43                 ` Sudeep Holla
2022-05-18 15:54                   ` Dietmar Eggemann
2022-05-19  9:21                     ` Sudeep Holla

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).