ANDROID: arm: Enable dynamic sched_domain flag setting
authorMorten Rasmussen <morten.rasmussen@arm.com>
Thu, 19 Oct 2017 12:50:06 +0000 (13:50 +0100)
committerChris Redpath <chris.redpath@arm.com>
Thu, 14 Dec 2017 21:41:07 +0000 (21:41 +0000)
The patch lets the arch_topology driver take over setting of
sched_domain flags that should be detected dynamically based on the
actual system topology.

cc: Russell King <linux@armlinux.org.uk>
Signed-off-by: Morten Rasmussen <morten.rasmussen@arm.com>
Change-Id: I5bc17383c5666e8ff35d5109016dec98474997ce
Signed-off-by: Chris Redpath <chris.redpath@arm.com>
arch/arm/include/asm/topology.h
arch/arm/kernel/topology.c

index 5d88d2f22b2cc5d62ccc883cded7693605134084..2a786f54d8b8b26af5b17f00c3373e09da3e30f8 100644 (file)
@@ -33,6 +33,9 @@ const struct cpumask *cpu_coregroup_mask(int cpu);
 /* Replace task scheduler's default cpu-invariant accounting */
 #define arch_scale_cpu_capacity topology_get_cpu_scale
 
+/* Enable topology flag updates */
+#define arch_update_cpu_topology topology_update_cpu_topology
+
 #else
 
 static inline void init_cpu_topology(void) { }
index 24ac3cab411d94a186390aa1fedb16b53e1d3a73..ce1a8026c8c484784d988225f9ac40c9be3976c1 100644 (file)
@@ -278,23 +278,38 @@ void store_cpu_topology(unsigned int cpuid)
 
        update_cpu_capacity(cpuid);
 
+       topology_detect_flags();
+
        pr_info("CPU%u: thread %d, cpu %d, socket %d, mpidr %x\n",
                cpuid, cpu_topology[cpuid].thread_id,
                cpu_topology[cpuid].core_id,
                cpu_topology[cpuid].socket_id, mpidr);
 }
 
+#ifdef CONFIG_SCHED_MC
+static int core_flags(void)
+{
+       return cpu_core_flags() | topology_core_flags();
+}
+
 static inline int cpu_corepower_flags(void)
 {
-       return SD_SHARE_PKG_RESOURCES  | SD_SHARE_POWERDOMAIN;
+       return topology_core_flags()
+               | SD_SHARE_PKG_RESOURCES | SD_SHARE_POWERDOMAIN;
+}
+#endif
+
+static int cpu_flags(void)
+{
+       return topology_cpu_flags();
 }
 
 static struct sched_domain_topology_level arm_topology[] = {
 #ifdef CONFIG_SCHED_MC
        { cpu_corepower_mask, cpu_corepower_flags, SD_INIT_NAME(GMC) },
-       { cpu_coregroup_mask, cpu_core_flags, SD_INIT_NAME(MC) },
+       { cpu_coregroup_mask, core_flags, SD_INIT_NAME(MC) },
 #endif
-       { cpu_cpu_mask, SD_INIT_NAME(DIE) },
+       { cpu_cpu_mask, cpu_flags, SD_INIT_NAME(DIE) },
        { NULL, },
 };