lkml.org 
[lkml]   [2020]   [Dec]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] arm64: topology: Cleanup init_amu_fie() a bit
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@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

\
 
 \ /
  Last update: 2020-12-10 11:37    [W:0.099 / U:0.752 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site