* [PATCH] cpufreq: Judging new_policy before update related_cpus
@ 2021-02-02 9:36 Xuewen Yan
2021-02-02 9:41 ` Viresh Kumar
0 siblings, 1 reply; 2+ messages in thread
From: Xuewen Yan @ 2021-02-02 9:36 UTC (permalink / raw)
To: rjw, viresh.kumar; +Cc: linux-pm, linux-kernel, xuewyan, Xuewen.Yan
From: Xuewen Yan <xuewen.yan@unisoc.com>
When the policy->related_cpus are all offline, and then
bring up one cpu, this time, if the ->online is NULL,
the code would update the ->related_cpus with ->cpus,
and now ->cpus is only one online cpu, as a result, the
->related_cpus is different from the origion ->related_cpus.
Signed-off-by: Xuewen Yan <xuewen.yan@unisoc.com>
---
drivers/cpufreq/cpufreq.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
index d0a3525ce27f..3d512ac463a5 100644
--- a/drivers/cpufreq/cpufreq.c
+++ b/drivers/cpufreq/cpufreq.c
@@ -1374,8 +1374,10 @@ static int cpufreq_online(unsigned int cpu)
if (ret)
goto out_exit_policy;
- /* related_cpus should at least include policy->cpus. */
- cpumask_copy(policy->related_cpus, policy->cpus);
+ if (new_policy) {
+ /* related_cpus should at least include policy->cpus. */
+ cpumask_copy(policy->related_cpus, policy->cpus);
+ }
}
down_write(&policy->rwsem);
--
2.29.0
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] cpufreq: Judging new_policy before update related_cpus
2021-02-02 9:36 [PATCH] cpufreq: Judging new_policy before update related_cpus Xuewen Yan
@ 2021-02-02 9:41 ` Viresh Kumar
0 siblings, 0 replies; 2+ messages in thread
From: Viresh Kumar @ 2021-02-02 9:41 UTC (permalink / raw)
To: Xuewen Yan; +Cc: rjw, linux-pm, linux-kernel, xuewyan, Xuewen.Yan
On 02-02-21, 17:36, Xuewen Yan wrote:
> From: Xuewen Yan <xuewen.yan@unisoc.com>
>
> When the policy->related_cpus are all offline, and then
> bring up one cpu, this time, if the ->online is NULL,
> the code would update the ->related_cpus with ->cpus,
> and now ->cpus is only one online cpu, as a result, the
> ->related_cpus is different from the origion ->related_cpus.
>
> Signed-off-by: Xuewen Yan <xuewen.yan@unisoc.com>
> ---
> drivers/cpufreq/cpufreq.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
> index d0a3525ce27f..3d512ac463a5 100644
> --- a/drivers/cpufreq/cpufreq.c
> +++ b/drivers/cpufreq/cpufreq.c
> @@ -1374,8 +1374,10 @@ static int cpufreq_online(unsigned int cpu)
> if (ret)
> goto out_exit_policy;
>
> - /* related_cpus should at least include policy->cpus. */
> - cpumask_copy(policy->related_cpus, policy->cpus);
> + if (new_policy) {
> + /* related_cpus should at least include policy->cpus. */
> + cpumask_copy(policy->related_cpus, policy->cpus);
> + }
> }
The driver's ->init() callback is responsible for filling policy->cpus
here.
--
viresh
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-02-02 9:44 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-02 9:36 [PATCH] cpufreq: Judging new_policy before update related_cpus Xuewen Yan
2021-02-02 9:41 ` Viresh Kumar
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®