2014-04-02 04:44:34

by Viresh Kumar

[permalink] [raw]
Subject: [PATCH] cpufreq: loongson2_cpufreq: don't declare local variable as static

Earlier commit:
commit 652ed95d5fa6074b3c4ea245deb0691f1acb6656
Author: Viresh Kumar <[email protected]>
Date: Thu Jan 9 20:38:43 2014 +0530

cpufreq: introduce cpufreq_generic_get() routine

did some changes to driver and by mistake made cpuclk as a 'static' local
variable, which wasn't actually required. Fix it.

Reported-by: Alexandre Oliva <[email protected]>
Signed-off-by: Viresh Kumar <[email protected]>
---
drivers/cpufreq/loongson2_cpufreq.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/cpufreq/loongson2_cpufreq.c b/drivers/cpufreq/loongson2_cpufreq.c
index a3588d61..f0bc31f 100644
--- a/drivers/cpufreq/loongson2_cpufreq.c
+++ b/drivers/cpufreq/loongson2_cpufreq.c
@@ -69,7 +69,7 @@ static int loongson2_cpufreq_target(struct cpufreq_policy *policy,

static int loongson2_cpufreq_cpu_init(struct cpufreq_policy *policy)
{
- static struct clk *cpuclk;
+ struct clk *cpuclk;
int i;
unsigned long rate;
int ret;
--
1.7.12.rc2.18.g61b472e


2014-04-03 12:49:26

by Alexandre Oliva

[permalink] [raw]
Subject: Re: [PATCH] cpufreq: loongson2_cpufreq: don't declare local variable as static

On Apr 2, 2014, Viresh Kumar <[email protected]> wrote:

> did some changes to driver and by mistake made cpuclk as a 'static' local
> variable, which wasn't actually required. Fix it.

FWIW, the same mistake is present in at32.

I've just finished bisecting the cpufreq regression on loongson2.
Indeed, this s/static// patch does not fix it, but it was 652ed95d5fa,
the patch that moved cpuclk into loongson2_cpufreq_cpu_init, that caused
the regression.

Reverting all the changes to loongson2_cpufreq.c in 652ed95d5fa makes
cpufreq work again, as opposed to printing nan% in all cpufreq stats in
cpufreq-info's output, and freezing shortly thereafter.

> - static struct clk *cpuclk;
> + struct clk *cpuclk;

--
Alexandre Oliva, freedom fighter http://FSFLA.org/~lxoliva/
You must be the change you wish to see in the world. -- Gandhi
Be Free! -- http://FSFLA.org/ FSF Latin America board member
Free Software Evangelist|Red Hat Brasil GNU Toolchain Engineer

2014-04-03 14:44:28

by Viresh Kumar

[permalink] [raw]
Subject: Re: [PATCH] cpufreq: loongson2_cpufreq: don't declare local variable as static

On 3 April 2014 18:10, Alexandre Oliva <[email protected]> wrote:
> FWIW, the same mistake is present in at32.

I will check others as well now :)

> I've just finished bisecting the cpufreq regression on loongson2.
> Indeed, this s/static// patch does not fix it, but it was 652ed95d5fa,
> the patch that moved cpuclk into loongson2_cpufreq_cpu_init, that caused
> the regression.
>
> Reverting all the changes to loongson2_cpufreq.c in 652ed95d5fa makes
> cpufreq work again, as opposed to printing nan% in all cpufreq stats in
> cpufreq-info's output, and freezing shortly thereafter.

You must have a look at this:

https://lkml.org/lkml/2014/4/2/426 : [PATCH] MIPS/loongson2_cpufreq:
fix CPU clock rate setting

2014-04-04 14:35:49

by Alexandre Oliva

[permalink] [raw]
Subject: Re: [PATCH] cpufreq: loongson2_cpufreq: don't declare local variable as static

On Apr 3, 2014, Viresh Kumar <[email protected]> wrote:

> On 3 April 2014 18:10, Alexandre Oliva <[email protected]> wrote:
>> FWIW, the same mistake is present in at32.

> I will check others as well now :)

Thanks!

>> Reverting all the changes to loongson2_cpufreq.c in 652ed95d5fa makes
>> cpufreq work again, as opposed to printing nan% in all cpufreq stats in
>> cpufreq-info's output, and freezing shortly thereafter.

> You must have a look at this:

> https://lkml.org/lkml/2014/4/2/426 : [PATCH] MIPS/loongson2_cpufreq:
> fix CPU clock rate setting

Thanks, I confirm that patch is enough to avoid the symptoms I'd
described.

--
Alexandre Oliva, freedom fighter http://FSFLA.org/~lxoliva/
You must be the change you wish to see in the world. -- Gandhi
Be Free! -- http://FSFLA.org/ FSF Latin America board member
Free Software Evangelist|Red Hat Brasil GNU Toolchain Engineer

2014-04-08 11:56:02

by Rafael J. Wysocki

[permalink] [raw]
Subject: Re: [PATCH] cpufreq: loongson2_cpufreq: don't declare local variable as static

On Wednesday, April 02, 2014 10:14:24 AM Viresh Kumar wrote:
> Earlier commit:
> commit 652ed95d5fa6074b3c4ea245deb0691f1acb6656
> Author: Viresh Kumar <[email protected]>
> Date: Thu Jan 9 20:38:43 2014 +0530
>
> cpufreq: introduce cpufreq_generic_get() routine
>
> did some changes to driver and by mistake made cpuclk as a 'static' local
> variable, which wasn't actually required. Fix it.
>
> Reported-by: Alexandre Oliva <[email protected]>
> Signed-off-by: Viresh Kumar <[email protected]>

Queued up for the next pull request, thanks!

> ---
> drivers/cpufreq/loongson2_cpufreq.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/cpufreq/loongson2_cpufreq.c b/drivers/cpufreq/loongson2_cpufreq.c
> index a3588d61..f0bc31f 100644
> --- a/drivers/cpufreq/loongson2_cpufreq.c
> +++ b/drivers/cpufreq/loongson2_cpufreq.c
> @@ -69,7 +69,7 @@ static int loongson2_cpufreq_target(struct cpufreq_policy *policy,
>
> static int loongson2_cpufreq_cpu_init(struct cpufreq_policy *policy)
> {
> - static struct clk *cpuclk;
> + struct clk *cpuclk;
> int i;
> unsigned long rate;
> int ret;
>

--
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.