* [PATCH] CPUFREQ: Loongson2: drop set_cpus_allowed_ptr()
@ 2017-04-04 15:49 Sebastian Andrzej Siewior
2017-04-10 10:31 ` Viresh Kumar
0 siblings, 1 reply; 4+ messages in thread
From: Sebastian Andrzej Siewior @ 2017-04-04 15:49 UTC (permalink / raw
To: linux-mips
Cc: tglx, Sebastian Andrzej Siewior, Rafael J. Wysocki, Viresh Kumar,
linux-pm
It is pure mystery to me why we need to be on a specific CPU while
looking up a value in an array.
My best shot at this is that before commit d4019f0a92ab ("cpufreq: move
freq change notifications to cpufreq core") it was required to invoke
cpufreq_notify_transition() on a special CPU.
Since it looks like a waste, remove it.
Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>
Cc: Viresh Kumar <viresh.kumar@linaro.org>
Cc: linux-pm@vger.kernel.org
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
drivers/cpufreq/loongson2_cpufreq.c | 7 -------
1 file changed, 7 deletions(-)
diff --git a/drivers/cpufreq/loongson2_cpufreq.c b/drivers/cpufreq/loongson2_cpufreq.c
index 6bbdac1065ff..9ac27b22476c 100644
--- a/drivers/cpufreq/loongson2_cpufreq.c
+++ b/drivers/cpufreq/loongson2_cpufreq.c
@@ -51,19 +51,12 @@ static int loongson2_cpu_freq_notifier(struct notifier_block *nb,
static int loongson2_cpufreq_target(struct cpufreq_policy *policy,
unsigned int index)
{
- unsigned int cpu = policy->cpu;
- cpumask_t cpus_allowed;
unsigned int freq;
- cpus_allowed = current->cpus_allowed;
- set_cpus_allowed_ptr(current, cpumask_of(cpu));
-
freq =
((cpu_clock_freq / 1000) *
loongson2_clockmod_table[index].driver_data) / 8;
- set_cpus_allowed_ptr(current, &cpus_allowed);
-
/* setting the cpu frequency */
clk_set_rate(policy->clk, freq * 1000);
--
2.11.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] CPUFREQ: Loongson2: drop set_cpus_allowed_ptr()
2017-04-04 15:49 [PATCH] CPUFREQ: Loongson2: drop set_cpus_allowed_ptr() Sebastian Andrzej Siewior
@ 2017-04-10 10:31 ` Viresh Kumar
2017-04-10 11:05 ` Ralf Baechle
0 siblings, 1 reply; 4+ messages in thread
From: Viresh Kumar @ 2017-04-10 10:31 UTC (permalink / raw
To: Sebastian Andrzej Siewior, wuzhangjin
Cc: linux-mips, tglx, Rafael J. Wysocki, linux-pm
On 04-04-17, 17:49, Sebastian Andrzej Siewior wrote:
> It is pure mystery to me why we need to be on a specific CPU while
> looking up a value in an array.
> My best shot at this is that before commit d4019f0a92ab ("cpufreq: move
> freq change notifications to cpufreq core") it was required to invoke
> cpufreq_notify_transition() on a special CPU.
>
> Since it looks like a waste, remove it.
>
> Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>
> Cc: Viresh Kumar <viresh.kumar@linaro.org>
> Cc: linux-pm@vger.kernel.org
> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
> ---
> drivers/cpufreq/loongson2_cpufreq.c | 7 -------
> 1 file changed, 7 deletions(-)
>
> diff --git a/drivers/cpufreq/loongson2_cpufreq.c b/drivers/cpufreq/loongson2_cpufreq.c
> index 6bbdac1065ff..9ac27b22476c 100644
> --- a/drivers/cpufreq/loongson2_cpufreq.c
> +++ b/drivers/cpufreq/loongson2_cpufreq.c
> @@ -51,19 +51,12 @@ static int loongson2_cpu_freq_notifier(struct notifier_block *nb,
> static int loongson2_cpufreq_target(struct cpufreq_policy *policy,
> unsigned int index)
> {
> - unsigned int cpu = policy->cpu;
> - cpumask_t cpus_allowed;
> unsigned int freq;
>
> - cpus_allowed = current->cpus_allowed;
> - set_cpus_allowed_ptr(current, cpumask_of(cpu));
> -
> freq =
> ((cpu_clock_freq / 1000) *
> loongson2_clockmod_table[index].driver_data) / 8;
>
> - set_cpus_allowed_ptr(current, &cpus_allowed);
> -
> /* setting the cpu frequency */
> clk_set_rate(policy->clk, freq * 1000);
It was Zhangjin who wrote the first version and he may be able to
answer the questions we have. Anyway, it is safe to apply this patch
right now.
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
--
viresh
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] CPUFREQ: Loongson2: drop set_cpus_allowed_ptr()
2017-04-10 10:31 ` Viresh Kumar
@ 2017-04-10 11:05 ` Ralf Baechle
2017-04-10 11:11 ` Sebastian Andrzej Siewior
0 siblings, 1 reply; 4+ messages in thread
From: Ralf Baechle @ 2017-04-10 11:05 UTC (permalink / raw
To: Viresh Kumar
Cc: Sebastian Andrzej Siewior, wuzhangjin, linux-mips, tglx,
Rafael J. Wysocki, linux-pm
On Mon, Apr 10, 2017 at 04:01:53PM +0530, Viresh Kumar wrote:
> On 04-04-17, 17:49, Sebastian Andrzej Siewior wrote:
> > It is pure mystery to me why we need to be on a specific CPU while
> > looking up a value in an array.
> > My best shot at this is that before commit d4019f0a92ab ("cpufreq: move
> > freq change notifications to cpufreq core") it was required to invoke
> > cpufreq_notify_transition() on a special CPU.
> >
> > Since it looks like a waste, remove it.
> >
> > Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>
> > Cc: Viresh Kumar <viresh.kumar@linaro.org>
> > Cc: linux-pm@vger.kernel.org
> > Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
> > ---
> > drivers/cpufreq/loongson2_cpufreq.c | 7 -------
> > 1 file changed, 7 deletions(-)
> >
> > diff --git a/drivers/cpufreq/loongson2_cpufreq.c b/drivers/cpufreq/loongson2_cpufreq.c
> > index 6bbdac1065ff..9ac27b22476c 100644
> > --- a/drivers/cpufreq/loongson2_cpufreq.c
> > +++ b/drivers/cpufreq/loongson2_cpufreq.c
> > @@ -51,19 +51,12 @@ static int loongson2_cpu_freq_notifier(struct notifier_block *nb,
> > static int loongson2_cpufreq_target(struct cpufreq_policy *policy,
> > unsigned int index)
> > {
> > - unsigned int cpu = policy->cpu;
> > - cpumask_t cpus_allowed;
> > unsigned int freq;
> >
> > - cpus_allowed = current->cpus_allowed;
> > - set_cpus_allowed_ptr(current, cpumask_of(cpu));
> > -
> > freq =
> > ((cpu_clock_freq / 1000) *
> > loongson2_clockmod_table[index].driver_data) / 8;
> >
> > - set_cpus_allowed_ptr(current, &cpus_allowed);
> > -
> > /* setting the cpu frequency */
> > clk_set_rate(policy->clk, freq * 1000);
>
> It was Zhangjin who wrote the first version and he may be able to
> answer the questions we have. Anyway, it is safe to apply this patch
> right now.
>
> Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Thanks for the ack, patch applied.
I noticed some of the other cpufreq drivers seem to be using similar
constructs.
Ralf
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] CPUFREQ: Loongson2: drop set_cpus_allowed_ptr()
2017-04-10 11:05 ` Ralf Baechle
@ 2017-04-10 11:11 ` Sebastian Andrzej Siewior
0 siblings, 0 replies; 4+ messages in thread
From: Sebastian Andrzej Siewior @ 2017-04-10 11:11 UTC (permalink / raw
To: Ralf Baechle
Cc: Viresh Kumar, wuzhangjin, linux-mips, tglx, Rafael J. Wysocki,
linux-pm
On 2017-04-10 13:05:11 [+0200], Ralf Baechle wrote:
> I noticed some of the other cpufreq drivers seem to be using similar
> constructs.
Don't worry, we are working on that.
> Ralf
Sebastian
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2017-04-10 11:11 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-04-04 15:49 [PATCH] CPUFREQ: Loongson2: drop set_cpus_allowed_ptr() Sebastian Andrzej Siewior
2017-04-10 10:31 ` Viresh Kumar
2017-04-10 11:05 ` Ralf Baechle
2017-04-10 11:11 ` Sebastian Andrzej Siewior
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.