Thread (15 messages) 15 messages, 4 authors, 2020-02-26

Re: [PATCH v4 6/7] arm64: use activity monitors for frequency invariance

From: Valentin Schneider <hidden>
Date: 2020-02-24 18:40:45
Also in: linux-doc, linux-pm, lkml

Ionela Voinescu writes:
Signed-off-by: Ionela Voinescu <redacted>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Will Deacon <will@kernel.org>
Cc: Sudeep Holla <redacted>
With the small nits below:

Reviewed-by: Valentin Schneider <redacted>
quoted hunk ↗ jump to hunk
diff --git a/arch/arm64/kernel/topology.c b/arch/arm64/kernel/topology.c
index fa9528dfd0ce..7606cbd63517 100644
--- a/arch/arm64/kernel/topology.c
+++ b/arch/arm64/kernel/topology.c
+
+static inline int
That should be bool, seeing what it returns.
quoted hunk ↗ jump to hunk
+enable_policy_freq_counters(int cpu, cpumask_var_t valid_cpus)
+{
+	struct cpufreq_policy *policy = cpufreq_cpu_get(cpu);
+
+	if (!policy) {
+		pr_debug("CPU%d: No cpufreq policy found.\n", cpu);
+		return false;
+	}
+
+	if (cpumask_subset(policy->related_cpus, valid_cpus))
+		cpumask_or(amu_fie_cpus, policy->related_cpus,
+			   amu_fie_cpus);
+
+	cpufreq_cpu_put(policy);
+
+	return true;
+}
diff --git a/drivers/base/arch_topology.c b/drivers/base/arch_topology.c
index 1eb81f113786..1ab2b7503d63 100644
--- a/drivers/base/arch_topology.c
+++ b/drivers/base/arch_topology.c
@@ -29,6 +29,14 @@ void arch_set_freq_scale(struct cpumask *cpus, unsigned long cur_freq,
      unsigned long scale;
      int i;

+	/*
+	 * If the use of counters for FIE is enabled, just return as we don't
+	 * want to update the scale factor with information from CPUFREQ.
+	 * Instead the scale factor will be updated from arch_scale_freq_tick.
+	 */
+	if (arch_cpu_freq_counters(cpus))
+		return;
+
      scale = (cur_freq << SCHED_CAPACITY_SHIFT) / max_freq;

      for_each_cpu(i, cpus)
diff --git a/include/linux/topology.h b/include/linux/topology.h
index eb2fe6edd73c..397aad6ae163 100644
--- a/include/linux/topology.h
+++ b/include/linux/topology.h
@@ -227,5 +227,12 @@ static inline const struct cpumask *cpu_cpu_mask(int cpu)
      return cpumask_of_node(cpu_to_node(cpu));
 }

+#ifndef arch_cpu_freq_counters
+static __always_inline
+bool arch_cpu_freq_counters(struct cpumask *cpus)
+{
+	return false;
+}
+#endif
Apologies for commenting on this only now, I had missed it in my earlier
round of review.

I would've liked to keep this contained within arm64 stuff until we agreed
on a more generic counter-driven FIE interface, but seems like we can't evade
it due to the arch_topology situation.

Would it make sense to relocate this stub to arch_topology.h instead, at
least for the time being? That way the only non-arm64 changes are condensed
in arch_topology (even if it doesn't change much in terms of header files,
since topology.h imports arch_topology.h)
 #endif /* _LINUX_TOPOLOGY_H */
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help