From: Viresh Kumar <viresh.kumar@linaro.org>
To: Shunyong Yang <shunyong.yang@hxt-semitech.com>
Cc: rjw@rjwysocki.net, linux-pm@vger.kernel.org,
linux-kernel@vger.kernel.org,
Joey Zheng <yu.zheng@hxt-semitech.com>
Subject: Re: [PATCH v2] cpufreq: cppc_cpufreq: Initialize shared cpu's perf capabilities
Date: Wed, 4 Apr 2018 16:06:00 +0530 [thread overview]
Message-ID: <20180404103600.GJ3572@vireshk-i7> (raw)
In-Reply-To: <1522833380-18438-1-git-send-email-shunyong.yang@hxt-semitech.com>
On 04-04-18, 17:16, Shunyong Yang wrote:
> When multiple cpus are related in one cpufreq policy, the first online
> cpu will be chosen by default to handle cpufreq operations. Let's take
> cpu0 and cpu1 as an example.
>
> When cpu0 is offline, policy->cpu will be shifted to cpu1. Cpu1's perf
> capabilities should be initialized. Otherwise, perf capabilities are 0s
> and speed change can not take effect.
>
> This patch copies perf capabilities of the first online cpu to other
> shared cpus when policy shared type is CPUFREQ_SHARED_TYPE_ANY.
>
> Cc: Joey Zheng <yu.zheng@hxt-semitech.com>
> Signed-off-by: Shunyong Yang <shunyong.yang@hxt-semitech.com>
> ---
>
> Changes in v2:
> -Add unlikely in cpu comparison per Kumar's comments.
> -Fix coding style per Kumar's comments.
>
> Changes in v1:
> -Drop RFC tag,
> The original RFC link,
> https://patchwork.kernel.org/patch/10299055/.
>
> This patch solves same issue as RFC above.
>
> Patch name is changed as code is too much different with RFC above.
>
> -Remove extra init() per Viresh Kumar's comments and only handle
> CPPC CPUFREQ_SHARED_TYPE_ANY case.
>
> ---
> drivers/cpufreq/cppc_cpufreq.c | 15 +++++++++++++--
> 1 file changed, 13 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/cpufreq/cppc_cpufreq.c b/drivers/cpufreq/cppc_cpufreq.c
> index 8f7b21a4d537..679e43b9c980 100644
> --- a/drivers/cpufreq/cppc_cpufreq.c
> +++ b/drivers/cpufreq/cppc_cpufreq.c
> @@ -164,9 +164,20 @@ static int cppc_cpufreq_cpu_init(struct cpufreq_policy *policy)
> policy->cpuinfo.transition_latency = cppc_get_transition_latency(cpu_num);
> policy->shared_type = cpu->shared_type;
>
> - if (policy->shared_type == CPUFREQ_SHARED_TYPE_ANY)
> + if (policy->shared_type == CPUFREQ_SHARED_TYPE_ANY) {
> + int i;
> +
> cpumask_copy(policy->cpus, cpu->shared_cpu_map);
> - else if (policy->shared_type == CPUFREQ_SHARED_TYPE_ALL) {
> +
> + for_each_cpu(i, policy->cpus) {
> + if (unlikely(i == policy->cpu))
> + continue;
> +
> + memcpy(&all_cpu_data[i]->perf_caps,
> + &cpu->perf_caps,
> + sizeof(cpu->perf_caps));
I think this can be written in two lines without violating the 80
columns rule.
> + }
> + } else if (policy->shared_type == CPUFREQ_SHARED_TYPE_ALL) {
> /* Support only SW_ANY for now. */
> pr_debug("Unsupported CPU co-ord type\n");
> return -EFAULT;
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
--
viresh
next prev parent reply other threads:[~2018-04-04 10:36 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-04-04 9:16 [PATCH v2] cpufreq: cppc_cpufreq: Initialize shared cpu's perf capabilities Shunyong Yang
2018-04-04 10:36 ` Viresh Kumar [this message]
2018-04-06 1:10 ` Yang, Shunyong
2018-04-06 1:21 ` Yang, Shunyong
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=20180404103600.GJ3572@vireshk-i7 \
--to=viresh.kumar@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=rjw@rjwysocki.net \
--cc=shunyong.yang@hxt-semitech.com \
--cc=yu.zheng@hxt-semitech.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).