All of lore.kernel.org
 help / color / mirror / Atom feed
From: Viresh Kumar <viresh.kumar@linaro.org>
To: Ionela Voinescu <ionela.voinescu@arm.com>,
	Catalin Marinas <catalin.marinas@arm.com>,
	Will Deacon <will@kernel.org>
Cc: Vincent Guittot <vincent.guittot@linaro.org>,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] arm64: topology: Cleanup init_amu_fie() a bit
Date: Thu, 10 Dec 2020 16:04:46 +0530	[thread overview]
Message-ID: <20201210103446.r5tlgoptc7n4r33z@vireshk-i7> (raw)
In-Reply-To: <5594c7d6756a47b473ceb6f48cc217458db32ab0.1607584435.git.viresh.kumar@linaro.org>

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

WARNING: multiple messages have this Message-ID (diff)
From: Viresh Kumar <viresh.kumar@linaro.org>
To: Ionela Voinescu <ionela.voinescu@arm.com>,
	Catalin Marinas <catalin.marinas@arm.com>,
	Will Deacon <will@kernel.org>
Cc: Vincent Guittot <vincent.guittot@linaro.org>,
	linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH] arm64: topology: Cleanup init_amu_fie() a bit
Date: Thu, 10 Dec 2020 16:04:46 +0530	[thread overview]
Message-ID: <20201210103446.r5tlgoptc7n4r33z@vireshk-i7> (raw)
In-Reply-To: <5594c7d6756a47b473ceb6f48cc217458db32ab0.1607584435.git.viresh.kumar@linaro.org>

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

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  parent reply	other threads:[~2020-12-10 10:35 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-10  7:18 [PATCH] arm64: topology: Cleanup init_amu_fie() a bit Viresh Kumar
2020-12-10  7:18 ` Viresh Kumar
2020-12-10  9:42 ` [PATCH] arm64: topology: Avoid the static_branch_{enable|disable} dance Viresh Kumar
2020-12-10  9:42   ` Viresh Kumar
2020-12-10 11:09   ` Ionela Voinescu
2020-12-10 11:09     ` Ionela Voinescu
2020-12-10 12:35     ` Viresh Kumar
2020-12-10 12:35       ` Viresh Kumar
2020-12-10 10:34 ` Viresh Kumar [this message]
2020-12-10 10:34   ` [PATCH] arm64: topology: Cleanup init_amu_fie() a bit Viresh Kumar
2020-12-10 10:38 ` Ionela Voinescu
2020-12-10 10:38   ` Ionela Voinescu
2020-12-10 10:55   ` Viresh Kumar
2020-12-10 10:55     ` Viresh Kumar
2020-12-10 11:29     ` Ionela Voinescu
2020-12-10 11:29       ` Ionela Voinescu
2020-12-10 12:34       ` Viresh Kumar
2020-12-10 12:34         ` Viresh Kumar
2020-12-10 13:26         ` Ionela Voinescu
2020-12-10 13:26           ` Ionela Voinescu
2020-12-11 11:05   ` Viresh Kumar
2020-12-11 11:05     ` Viresh Kumar
2020-12-14 16:14     ` Ionela Voinescu
2020-12-14 16:14       ` Ionela Voinescu
2020-12-10 13:22 ` Ionela Voinescu
2020-12-10 13:22   ` Ionela Voinescu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201210103446.r5tlgoptc7n4r33z@vireshk-i7 \
    --to=viresh.kumar@linaro.org \
    --cc=catalin.marinas@arm.com \
    --cc=ionela.voinescu@arm.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=vincent.guittot@linaro.org \
    --cc=will@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.