[PATCH] arm64: topology: Cleanup init_amu_fie() a bit
Viresh Kumar
viresh.kumar at linaro.org
Thu Dec 10 05:34:46 EST 2020
On 10-12-20, 12:48, Viresh Kumar wrote:
> Every time I have stumbled upon this routine, I get confused with the
> way 'have_policy' is used and I have to dig in to understand why is it
> so.
>
> Here is an attempt to make it easier to understand, and hopefully it is
> an improvement. This is based on the logic that amu_fie_cpus will be
> empty if cpufreq policy wasn't available for any CPU.
>
> Signed-off-by: Viresh Kumar <viresh.kumar at linaro.org>
> ---
>
> Ionela, I think it would be even better to do this over this patch
>
> - /*
> - * If none of the CPUs have cpufreq support, we only enable
> - * the use of the AMU feature for FIE if all CPUs support AMU.
> - * Otherwise, enable_policy_freq_counters has already enabled
> - * policy cpus.
> - */
> - if (cpumask_empty(amu_fie_cpus) &&
> - cpumask_equal(valid_cpus, cpu_present_mask))
> + /* Overwrite amu_fie_cpus if all CPUs support AMU */
> + if (cpumask_equal(valid_cpus, cpu_present_mask))
> cpumask_copy(amu_fie_cpus, cpu_present_mask);
>
> This will also take care of the case where the cpufreq policy isn't
> there for a small group of CPUs, which do have AMUs enabled for them.
> (This doesn't normally happen though).
And on similar lines, this change as well as amu_fie_cpus must be set
to all the CPUs and this check (and parameter to the routine) aren't
required..
bool arch_freq_counters_available(const struct cpumask *cpus)
{
- return amu_freq_invariant() &&
- cpumask_subset(cpus, amu_fie_cpus);
+ return amu_freq_invariant();
}
--
viresh
More information about the linux-arm-kernel
mailing list