All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH -stable] MIPS: Fix build for LTS kernel caused by backporting lpj adjustment
@ 2020-07-16  9:39 Huacai Chen
  2020-07-19  3:24 ` Huacai Chen
  2020-07-20 20:54 ` Serge Semin
  0 siblings, 2 replies; 7+ messages in thread
From: Huacai Chen @ 2020-07-16  9:39 UTC (permalink / raw)
  To: Thomas Bogendoerfer
  Cc: linux-mips, Fuxin Zhang, Zhangjin Wu, Huacai Chen, Jiaxun Yang,
	Huacai Chen, Serge Semin, Stable # 4 . 4/4 . 9/4 . 14/4 . 19

Commit ed26aacfb5f71eecb20a ("mips: Add udelay lpj numbers adjustment")
has backported to 4.4~5.4, but the "struct cpufreq_freqs" (and also the
cpufreq notifier machanism) of 4.4~4.19 are different from the upstream
kernel. These differences cause build errors, and this patch can fix the
build.

Cc: Serge Semin <Sergey.Semin@baikalelectronics.ru>
Cc: Stable <stable@vger.kernel.org> # 4.4/4.9/4.14/4.19
Signed-off-by: Huacai Chen <chenhc@lemote.com>
---
 arch/mips/kernel/time.c | 13 ++++---------
 1 file changed, 4 insertions(+), 9 deletions(-)

diff --git a/arch/mips/kernel/time.c b/arch/mips/kernel/time.c
index b7f7e08..b15ee12 100644
--- a/arch/mips/kernel/time.c
+++ b/arch/mips/kernel/time.c
@@ -40,10 +40,8 @@ static unsigned long glb_lpj_ref_freq;
 static int cpufreq_callback(struct notifier_block *nb,
 			    unsigned long val, void *data)
 {
-	struct cpufreq_freqs *freq = data;
-	struct cpumask *cpus = freq->policy->cpus;
-	unsigned long lpj;
 	int cpu;
+	struct cpufreq_freqs *freq = data;
 
 	/*
 	 * Skip lpj numbers adjustment if the CPU-freq transition is safe for
@@ -64,6 +62,7 @@ static int cpufreq_callback(struct notifier_block *nb,
 		}
 	}
 
+	cpu = freq->cpu;
 	/*
 	 * Adjust global lpj variable and per-CPU udelay_val number in
 	 * accordance with the new CPU frequency.
@@ -74,12 +73,8 @@ static int cpufreq_callback(struct notifier_block *nb,
 						glb_lpj_ref_freq,
 						freq->new);
 
-		for_each_cpu(cpu, cpus) {
-			lpj = cpufreq_scale(per_cpu(pcp_lpj_ref, cpu),
-					    per_cpu(pcp_lpj_ref_freq, cpu),
-					    freq->new);
-			cpu_data[cpu].udelay_val = (unsigned int)lpj;
-		}
+		cpu_data[cpu].udelay_val = cpufreq_scale(per_cpu(pcp_lpj_ref, cpu),
+					   per_cpu(pcp_lpj_ref_freq, cpu), freq->new);
 	}
 
 	return NOTIFY_OK;
-- 
2.7.0


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH -stable] MIPS: Fix build for LTS kernel caused by backporting lpj adjustment
  2020-07-16  9:39 [PATCH -stable] MIPS: Fix build for LTS kernel caused by backporting lpj adjustment Huacai Chen
@ 2020-07-19  3:24 ` Huacai Chen
  2020-07-19 14:51   ` Jiaxun Yang
  2020-07-20 20:54 ` Serge Semin
  1 sibling, 1 reply; 7+ messages in thread
From: Huacai Chen @ 2020-07-19  3:24 UTC (permalink / raw)
  To: Thomas Bogendoerfer
  Cc: open list:MIPS, Fuxin Zhang, Zhangjin Wu, Jiaxun Yang,
	Serge Semin, Stable # 4 . 4/4 . 9/4 . 14/4 . 19

Hi, Serge,

Could you please have a look at this patch?

Huacai

On Thu, Jul 16, 2020 at 5:37 PM Huacai Chen <chenhc@lemote.com> wrote:
>
> Commit ed26aacfb5f71eecb20a ("mips: Add udelay lpj numbers adjustment")
> has backported to 4.4~5.4, but the "struct cpufreq_freqs" (and also the
> cpufreq notifier machanism) of 4.4~4.19 are different from the upstream
> kernel. These differences cause build errors, and this patch can fix the
> build.
>
> Cc: Serge Semin <Sergey.Semin@baikalelectronics.ru>
> Cc: Stable <stable@vger.kernel.org> # 4.4/4.9/4.14/4.19
> Signed-off-by: Huacai Chen <chenhc@lemote.com>
> ---
>  arch/mips/kernel/time.c | 13 ++++---------
>  1 file changed, 4 insertions(+), 9 deletions(-)
>
> diff --git a/arch/mips/kernel/time.c b/arch/mips/kernel/time.c
> index b7f7e08..b15ee12 100644
> --- a/arch/mips/kernel/time.c
> +++ b/arch/mips/kernel/time.c
> @@ -40,10 +40,8 @@ static unsigned long glb_lpj_ref_freq;
>  static int cpufreq_callback(struct notifier_block *nb,
>                             unsigned long val, void *data)
>  {
> -       struct cpufreq_freqs *freq = data;
> -       struct cpumask *cpus = freq->policy->cpus;
> -       unsigned long lpj;
>         int cpu;
> +       struct cpufreq_freqs *freq = data;
>
>         /*
>          * Skip lpj numbers adjustment if the CPU-freq transition is safe for
> @@ -64,6 +62,7 @@ static int cpufreq_callback(struct notifier_block *nb,
>                 }
>         }
>
> +       cpu = freq->cpu;
>         /*
>          * Adjust global lpj variable and per-CPU udelay_val number in
>          * accordance with the new CPU frequency.
> @@ -74,12 +73,8 @@ static int cpufreq_callback(struct notifier_block *nb,
>                                                 glb_lpj_ref_freq,
>                                                 freq->new);
>
> -               for_each_cpu(cpu, cpus) {
> -                       lpj = cpufreq_scale(per_cpu(pcp_lpj_ref, cpu),
> -                                           per_cpu(pcp_lpj_ref_freq, cpu),
> -                                           freq->new);
> -                       cpu_data[cpu].udelay_val = (unsigned int)lpj;
> -               }
> +               cpu_data[cpu].udelay_val = cpufreq_scale(per_cpu(pcp_lpj_ref, cpu),
> +                                          per_cpu(pcp_lpj_ref_freq, cpu), freq->new);
>         }
>
>         return NOTIFY_OK;
> --
> 2.7.0
>

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH -stable] MIPS: Fix build for LTS kernel caused by backporting lpj adjustment
  2020-07-19  3:24 ` Huacai Chen
@ 2020-07-19 14:51   ` Jiaxun Yang
  2020-07-19 15:13     ` Greg KH
  0 siblings, 1 reply; 7+ messages in thread
From: Jiaxun Yang @ 2020-07-19 14:51 UTC (permalink / raw)
  To: Huacai Chen, gregkh
  Cc: open list:MIPS, Serge Semin, Stable # 4 . 4/4 . 9/4 . 14/4 . 19


在 2020/7/19 上午11:24, Huacai Chen 写道:
> Hi, Serge,
>
> Could you please have a look at this patch?


+ Gregkh

This is urgent for next stable release, please take a look.

Thanks


>
> Huacai
>
> On Thu, Jul 16, 2020 at 5:37 PM Huacai Chen <chenhc@lemote.com> wrote:
>> Commit ed26aacfb5f71eecb20a ("mips: Add udelay lpj numbers adjustment")
>> has backported to 4.4~5.4, but the "struct cpufreq_freqs" (and also the
>> cpufreq notifier machanism) of 4.4~4.19 are different from the upstream
>> kernel. These differences cause build errors, and this patch can fix the
>> build.
>>
>> Cc: Serge Semin <Sergey.Semin@baikalelectronics.ru>
>> Cc: Stable <stable@vger.kernel.org> # 4.4/4.9/4.14/4.19
>> Signed-off-by: Huacai Chen <chenhc@lemote.com>
>> ---
>>   arch/mips/kernel/time.c | 13 ++++---------
>>   1 file changed, 4 insertions(+), 9 deletions(-)
>>
>> diff --git a/arch/mips/kernel/time.c b/arch/mips/kernel/time.c
>> index b7f7e08..b15ee12 100644
>> --- a/arch/mips/kernel/time.c
>> +++ b/arch/mips/kernel/time.c
>> @@ -40,10 +40,8 @@ static unsigned long glb_lpj_ref_freq;
>>   static int cpufreq_callback(struct notifier_block *nb,
>>                              unsigned long val, void *data)
>>   {
>> -       struct cpufreq_freqs *freq = data;
>> -       struct cpumask *cpus = freq->policy->cpus;
>> -       unsigned long lpj;
>>          int cpu;
>> +       struct cpufreq_freqs *freq = data;
>>
>>          /*
>>           * Skip lpj numbers adjustment if the CPU-freq transition is safe for
>> @@ -64,6 +62,7 @@ static int cpufreq_callback(struct notifier_block *nb,
>>                  }
>>          }
>>
>> +       cpu = freq->cpu;
>>          /*
>>           * Adjust global lpj variable and per-CPU udelay_val number in
>>           * accordance with the new CPU frequency.
>> @@ -74,12 +73,8 @@ static int cpufreq_callback(struct notifier_block *nb,
>>                                                  glb_lpj_ref_freq,
>>                                                  freq->new);
>>
>> -               for_each_cpu(cpu, cpus) {
>> -                       lpj = cpufreq_scale(per_cpu(pcp_lpj_ref, cpu),
>> -                                           per_cpu(pcp_lpj_ref_freq, cpu),
>> -                                           freq->new);
>> -                       cpu_data[cpu].udelay_val = (unsigned int)lpj;
>> -               }
>> +               cpu_data[cpu].udelay_val = cpufreq_scale(per_cpu(pcp_lpj_ref, cpu),
>> +                                          per_cpu(pcp_lpj_ref_freq, cpu), freq->new);
>>          }
>>
>>          return NOTIFY_OK;
>> --
>> 2.7.0
>>

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH -stable] MIPS: Fix build for LTS kernel caused by backporting lpj adjustment
  2020-07-19 14:51   ` Jiaxun Yang
@ 2020-07-19 15:13     ` Greg KH
  2020-07-20  1:42       ` Huacai Chen
  0 siblings, 1 reply; 7+ messages in thread
From: Greg KH @ 2020-07-19 15:13 UTC (permalink / raw)
  To: Jiaxun Yang
  Cc: Huacai Chen, open list:MIPS, Serge Semin,
	Stable # 4 . 4/4 . 9/4 . 14/4 . 19

On Sun, Jul 19, 2020 at 10:51:11PM +0800, Jiaxun Yang wrote:
> 
> 在 2020/7/19 上午11:24, Huacai Chen 写道:
> > Hi, Serge,
> > 
> > Could you please have a look at this patch?
> 
> 
> + Gregkh
> 
> This is urgent for next stable release, please take a look.

Relax, it was only sent 3 days ago, we will get to this...

Also, why was this not caught by any of the testing systems that we
have?  That might be good to determine so we don't mess up again in the
future.

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH -stable] MIPS: Fix build for LTS kernel caused by backporting lpj adjustment
  2020-07-19 15:13     ` Greg KH
@ 2020-07-20  1:42       ` Huacai Chen
  2020-07-20  4:58         ` Jiaxun Yang
  0 siblings, 1 reply; 7+ messages in thread
From: Huacai Chen @ 2020-07-20  1:42 UTC (permalink / raw)
  To: Greg KH
  Cc: Jiaxun Yang, open list:MIPS, Serge Semin,
	Stable # 4 . 4/4 . 9/4 . 14/4 . 19

Hi, Greg,

On Sun, Jul 19, 2020 at 11:13 PM Greg KH <gregkh@linuxfoundation.org> wrote:
>
> On Sun, Jul 19, 2020 at 10:51:11PM +0800, Jiaxun Yang wrote:
> >
> > 在 2020/7/19 上午11:24, Huacai Chen 写道:
> > > Hi, Serge,
> > >
> > > Could you please have a look at this patch?
> >
> >
> > + Gregkh
> >
> > This is urgent for next stable release, please take a look.
>
> Relax, it was only sent 3 days ago, we will get to this...
>
> Also, why was this not caught by any of the testing systems that we
> have?  That might be good to determine so we don't mess up again in the
> future.
I think that is because CPUFREQ is disabled by default on MIPS.

Huacai

>
> thanks,
>
> greg k-h

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH -stable] MIPS: Fix build for LTS kernel caused by backporting lpj adjustment
  2020-07-20  1:42       ` Huacai Chen
@ 2020-07-20  4:58         ` Jiaxun Yang
  0 siblings, 0 replies; 7+ messages in thread
From: Jiaxun Yang @ 2020-07-20  4:58 UTC (permalink / raw)
  To: Huacai Chen, Greg KH
  Cc: open list:MIPS, Serge Semin, Stable # 4 . 4/4 . 9/4 . 14/4 . 19


在 2020/7/20 上午9:42, Huacai Chen 写道:
> Hi, Greg,
>
> On Sun, Jul 19, 2020 at 11:13 PM Greg KH <gregkh@linuxfoundation.org> wrote:
>> On Sun, Jul 19, 2020 at 10:51:11PM +0800, Jiaxun Yang wrote:
>>> 在 2020/7/19 上午11:24, Huacai Chen 写道:
>>>> Hi, Serge,
>>>>
>>>> Could you please have a look at this patch?
>>>
>>> + Gregkh
>>>
>>> This is urgent for next stable release, please take a look.
>> Relax, it was only sent 3 days ago, we will get to this...


Ahh, sorry for the rush~


>>
>> Also, why was this not caught by any of the testing systems that we
>> have?  That might be good to determine so we don't mess up again in the
>> future.
> I think that is because CPUFREQ is disabled by default on MIPS.


Yeah, I'm working with kernel-ci to get more config covered.

Thanks.

- Jiaxun


>
> Huacai
>
>> thanks,
>>
>> greg k-h

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH -stable] MIPS: Fix build for LTS kernel caused by backporting lpj adjustment
  2020-07-16  9:39 [PATCH -stable] MIPS: Fix build for LTS kernel caused by backporting lpj adjustment Huacai Chen
  2020-07-19  3:24 ` Huacai Chen
@ 2020-07-20 20:54 ` Serge Semin
  1 sibling, 0 replies; 7+ messages in thread
From: Serge Semin @ 2020-07-20 20:54 UTC (permalink / raw)
  To: Huacai Chen
  Cc: Thomas Bogendoerfer, linux-mips, Fuxin Zhang, Zhangjin Wu,
	Huacai Chen, Jiaxun Yang, Stable # 4 . 4/4 . 9/4 . 14/4 . 19

Hello Huacai,

Thanks for the fix. The patch looks good to me except a small cleanup
comment.

On Thu, Jul 16, 2020 at 05:39:29PM +0800, Huacai Chen wrote:
> Commit ed26aacfb5f71eecb20a ("mips: Add udelay lpj numbers adjustment")
> has backported to 4.4~5.4, but the "struct cpufreq_freqs" (and also the
> cpufreq notifier machanism) of 4.4~4.19 are different from the upstream
> kernel. These differences cause build errors, and this patch can fix the
> build.
> 
> Cc: Serge Semin <Sergey.Semin@baikalelectronics.ru>
> Cc: Stable <stable@vger.kernel.org> # 4.4/4.9/4.14/4.19
> Signed-off-by: Huacai Chen <chenhc@lemote.com>
> ---
>  arch/mips/kernel/time.c | 13 ++++---------
>  1 file changed, 4 insertions(+), 9 deletions(-)
> 
> diff --git a/arch/mips/kernel/time.c b/arch/mips/kernel/time.c
> index b7f7e08..b15ee12 100644
> --- a/arch/mips/kernel/time.c
> +++ b/arch/mips/kernel/time.c
> @@ -40,10 +40,8 @@ static unsigned long glb_lpj_ref_freq;
>  static int cpufreq_callback(struct notifier_block *nb,
>  			    unsigned long val, void *data)
>  {
> -	struct cpufreq_freqs *freq = data;
> -	struct cpumask *cpus = freq->policy->cpus;
> -	unsigned long lpj;
>  	int cpu;
> +	struct cpufreq_freqs *freq = data;

Why do you want to rearrange the cpu and freq variables declarations?
IMO the order should be left as before since the change doesn't really
make the code looking or working any better. If so the change is unneeded.
Moreover reverse xmas tree-like variables declaration looks neater than any
other.

After fixing that feel free to add

Reviewed-by: Serge Semin <fancer.lancer@gmail.com>

-Sergey

>  
>  	/*
>  	 * Skip lpj numbers adjustment if the CPU-freq transition is safe for
> @@ -64,6 +62,7 @@ static int cpufreq_callback(struct notifier_block *nb,
>  		}
>  	}
>  
> +	cpu = freq->cpu;
>  	/*
>  	 * Adjust global lpj variable and per-CPU udelay_val number in
>  	 * accordance with the new CPU frequency.
> @@ -74,12 +73,8 @@ static int cpufreq_callback(struct notifier_block *nb,
>  						glb_lpj_ref_freq,
>  						freq->new);
>  
> -		for_each_cpu(cpu, cpus) {
> -			lpj = cpufreq_scale(per_cpu(pcp_lpj_ref, cpu),
> -					    per_cpu(pcp_lpj_ref_freq, cpu),
> -					    freq->new);
> -			cpu_data[cpu].udelay_val = (unsigned int)lpj;
> -		}
> +		cpu_data[cpu].udelay_val = cpufreq_scale(per_cpu(pcp_lpj_ref, cpu),
> +					   per_cpu(pcp_lpj_ref_freq, cpu), freq->new);
>  	}
>  
>  	return NOTIFY_OK;
> -- 
> 2.7.0
> 

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2020-07-20 20:54 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-16  9:39 [PATCH -stable] MIPS: Fix build for LTS kernel caused by backporting lpj adjustment Huacai Chen
2020-07-19  3:24 ` Huacai Chen
2020-07-19 14:51   ` Jiaxun Yang
2020-07-19 15:13     ` Greg KH
2020-07-20  1:42       ` Huacai Chen
2020-07-20  4:58         ` Jiaxun Yang
2020-07-20 20:54 ` Serge Semin

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.