mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] arch/topology: Fix variable naming
@ 2024-04-25  7:37 Vincent Guittot
  2024-04-25  8:11 ` Lukasz Luba
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Vincent Guittot @ 2024-04-25  7:37 UTC (permalink / raw)
  To: lkp, sudeep.holla, rafael, mingo, peterz, lukasz.luba, gregkh,
	linux-kernel, qyousef
  Cc: Vincent Guittot

Using hw_pressure for local variable is confusing in regard to the
per_cpu hw_pressure variable. Rename it to avoid confusion.

Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202404250740.VhQQoD7N-lkp@intel.com/
Signed-off-by: Vincent Guittot <vincent.guittot@linaro.org>
---

 drivers/base/arch_topology.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/base/arch_topology.c b/drivers/base/arch_topology.c
index 0248912ff687..c66d070207a0 100644
--- a/drivers/base/arch_topology.c
+++ b/drivers/base/arch_topology.c
@@ -179,7 +179,7 @@ DEFINE_PER_CPU(unsigned long, hw_pressure);
 void topology_update_hw_pressure(const struct cpumask *cpus,
 				      unsigned long capped_freq)
 {
-	unsigned long max_capacity, capacity, hw_pressure;
+	unsigned long max_capacity, capacity, pressure;
 	u32 max_freq;
 	int cpu;
 
@@ -196,12 +196,12 @@ void topology_update_hw_pressure(const struct cpumask *cpus,
 	else
 		capacity = mult_frac(max_capacity, capped_freq, max_freq);
 
-	hw_pressure = max_capacity - capacity;
+	pressure = max_capacity - capacity;
 
-	trace_hw_pressure_update(cpu, hw_pressure);
+	trace_hw_pressure_update(cpu, pressure);
 
 	for_each_cpu(cpu, cpus)
-		WRITE_ONCE(per_cpu(hw_pressure, cpu), hw_pressure);
+		WRITE_ONCE(per_cpu(hw_pressure, cpu), pressure);
 }
 EXPORT_SYMBOL_GPL(topology_update_hw_pressure);
 
-- 
2.34.1


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

* Re: [PATCH] arch/topology: Fix variable naming
  2024-04-25  7:37 [PATCH] arch/topology: Fix variable naming Vincent Guittot
@ 2024-04-25  8:11 ` Lukasz Luba
  2024-04-25  8:46 ` Sudeep Holla
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Lukasz Luba @ 2024-04-25  8:11 UTC (permalink / raw)
  To: Vincent Guittot
  Cc: lkp, sudeep.holla, qyousef, rafael, linux-kernel, mingo, peterz, gregkh



On 4/25/24 08:37, Vincent Guittot wrote:
> Using hw_pressure for local variable is confusing in regard to the
> per_cpu hw_pressure variable. Rename it to avoid confusion.
> 
> Reported-by: kernel test robot <lkp@intel.com>
> Closes: https://lore.kernel.org/oe-kbuild-all/202404250740.VhQQoD7N-lkp@intel.com/
> Signed-off-by: Vincent Guittot <vincent.guittot@linaro.org>
> ---
> 
>   drivers/base/arch_topology.c | 8 ++++----
>   1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/base/arch_topology.c b/drivers/base/arch_topology.c
> index 0248912ff687..c66d070207a0 100644
> --- a/drivers/base/arch_topology.c
> +++ b/drivers/base/arch_topology.c
> @@ -179,7 +179,7 @@ DEFINE_PER_CPU(unsigned long, hw_pressure);
>   void topology_update_hw_pressure(const struct cpumask *cpus,
>   				      unsigned long capped_freq)
>   {
> -	unsigned long max_capacity, capacity, hw_pressure;
> +	unsigned long max_capacity, capacity, pressure;
>   	u32 max_freq;
>   	int cpu;
>   
> @@ -196,12 +196,12 @@ void topology_update_hw_pressure(const struct cpumask *cpus,
>   	else
>   		capacity = mult_frac(max_capacity, capped_freq, max_freq);
>   
> -	hw_pressure = max_capacity - capacity;
> +	pressure = max_capacity - capacity;
>   
> -	trace_hw_pressure_update(cpu, hw_pressure);
> +	trace_hw_pressure_update(cpu, pressure);
>   
>   	for_each_cpu(cpu, cpus)
> -		WRITE_ONCE(per_cpu(hw_pressure, cpu), hw_pressure);
> +		WRITE_ONCE(per_cpu(hw_pressure, cpu), pressure);
>   }
>   EXPORT_SYMBOL_GPL(topology_update_hw_pressure);
>   

Make sense

Reviewed-by: Lukasz Luba <lukasz.luba@arm.com>

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

* Re: [PATCH] arch/topology: Fix variable naming
  2024-04-25  7:37 [PATCH] arch/topology: Fix variable naming Vincent Guittot
  2024-04-25  8:11 ` Lukasz Luba
@ 2024-04-25  8:46 ` Sudeep Holla
  2024-04-30 12:19 ` Konrad Dybcio
  2024-05-15  8:27 ` [tip: sched/urgent] arch/topology: Fix variable naming to avoid shadowing tip-bot2 for Vincent Guittot
  3 siblings, 0 replies; 5+ messages in thread
From: Sudeep Holla @ 2024-04-25  8:46 UTC (permalink / raw)
  To: Vincent Guittot
  Cc: lkp, rafael, mingo, Sudeep Holla, peterz, lukasz.luba, gregkh,
	linux-kernel, qyousef

On Thu, Apr 25, 2024 at 09:37:09AM +0200, Vincent Guittot wrote:
> Using hw_pressure for local variable is confusing in regard to the
> per_cpu hw_pressure variable. Rename it to avoid confusion.
>

Acked-by: Sudeep Holla <sudeep.holla@arm.com>

--
Regards,
Sudeep

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

* Re: [PATCH] arch/topology: Fix variable naming
  2024-04-25  7:37 [PATCH] arch/topology: Fix variable naming Vincent Guittot
  2024-04-25  8:11 ` Lukasz Luba
  2024-04-25  8:46 ` Sudeep Holla
@ 2024-04-30 12:19 ` Konrad Dybcio
  2024-05-15  8:27 ` [tip: sched/urgent] arch/topology: Fix variable naming to avoid shadowing tip-bot2 for Vincent Guittot
  3 siblings, 0 replies; 5+ messages in thread
From: Konrad Dybcio @ 2024-04-30 12:19 UTC (permalink / raw)
  To: Vincent Guittot, lkp, sudeep.holla, rafael, mingo, peterz,
	lukasz.luba, gregkh, linux-kernel, qyousef



On 25.04.2024 9:37 AM, Vincent Guittot wrote:
> Using hw_pressure for local variable is confusing in regard to the
> per_cpu hw_pressure variable. Rename it to avoid confusion.

To avoid confusing the compiler :P

> 
> Reported-by: kernel test robot <lkp@intel.com>
> Closes: https://lore.kernel.org/oe-kbuild-all/202404250740.VhQQoD7N-lkp@intel.com/
> Signed-off-by: Vincent Guittot <vincent.guittot@linaro.org>
> ---

Fixes: d4dbc991714e ("sched/cpufreq: Rename arch_update_thermal_pressure() => arch_update_hw_pressure()")
Tested-by: Konrad Dybcio <konrad.dybcio@linaro.org> # QC SM8550 QRD
Reviewed-by: Konrad Dybcio <konrad.dybcio@linaro.org>

Konrad

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

* [tip: sched/urgent] arch/topology: Fix variable naming to avoid shadowing
  2024-04-25  7:37 [PATCH] arch/topology: Fix variable naming Vincent Guittot
                   ` (2 preceding siblings ...)
  2024-04-30 12:19 ` Konrad Dybcio
@ 2024-05-15  8:27 ` tip-bot2 for Vincent Guittot
  3 siblings, 0 replies; 5+ messages in thread
From: tip-bot2 for Vincent Guittot @ 2024-05-15  8:27 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: kernel test robot, Vincent Guittot, Ingo Molnar, Lukasz Luba,
	Konrad Dybcio, Sudeep Holla, Linus Torvalds, x86, linux-kernel

The following commit has been merged into the sched/urgent branch of tip:

Commit-ID:     e5bc44e47c531860be96ac615314b1ab23d5aa2b
Gitweb:        https://git.kernel.org/tip/e5bc44e47c531860be96ac615314b1ab23d5aa2b
Author:        Vincent Guittot <vincent.guittot@linaro.org>
AuthorDate:    Thu, 25 Apr 2024 09:37:09 +02:00
Committer:     Ingo Molnar <mingo@kernel.org>
CommitterDate: Wed, 15 May 2024 10:22:16 +02:00

arch/topology: Fix variable naming to avoid shadowing

Using 'hw_pressure' for local variable name is confusing in regard to the
per-CPU 'hw_pressure' variable that uses the same name:

  include/linux/arch_topology.h:DECLARE_PER_CPU(unsigned long, hw_pressure);

... which puts it into a global scope for all code that includes
<linux/topology.h>, shadowing the local variable.

Rename it to avoid compiler confusion & Sparse warnings.

[ mingo: Expanded the changelog. ]

Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Vincent Guittot <vincent.guittot@linaro.org>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Reviewed-by: Lukasz Luba <lukasz.luba@arm.com>
Reviewed-by: Konrad Dybcio <konrad.dybcio@linaro.org>
Acked-by: Sudeep Holla <sudeep.holla@arm.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Link: https://lore.kernel.org/r/20240425073709.379016-1-vincent.guittot@linaro.org
Closes: https://lore.kernel.org/oe-kbuild-all/202404250740.VhQQoD7N-lkp@intel.com/
Fixes: d4dbc991714e ("sched/cpufreq: Rename arch_update_thermal_pressure() => arch_update_hw_pressure()")
Tested-by: Konrad Dybcio <konrad.dybcio@linaro.org> # QC SM8550 QRD
---
 drivers/base/arch_topology.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/base/arch_topology.c b/drivers/base/arch_topology.c
index 0248912..c66d070 100644
--- a/drivers/base/arch_topology.c
+++ b/drivers/base/arch_topology.c
@@ -179,7 +179,7 @@ DEFINE_PER_CPU(unsigned long, hw_pressure);
 void topology_update_hw_pressure(const struct cpumask *cpus,
 				      unsigned long capped_freq)
 {
-	unsigned long max_capacity, capacity, hw_pressure;
+	unsigned long max_capacity, capacity, pressure;
 	u32 max_freq;
 	int cpu;
 
@@ -196,12 +196,12 @@ void topology_update_hw_pressure(const struct cpumask *cpus,
 	else
 		capacity = mult_frac(max_capacity, capped_freq, max_freq);
 
-	hw_pressure = max_capacity - capacity;
+	pressure = max_capacity - capacity;
 
-	trace_hw_pressure_update(cpu, hw_pressure);
+	trace_hw_pressure_update(cpu, pressure);
 
 	for_each_cpu(cpu, cpus)
-		WRITE_ONCE(per_cpu(hw_pressure, cpu), hw_pressure);
+		WRITE_ONCE(per_cpu(hw_pressure, cpu), pressure);
 }
 EXPORT_SYMBOL_GPL(topology_update_hw_pressure);
 

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

end of thread, other threads:[~2024-05-15  8:28 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-25  7:37 [PATCH] arch/topology: Fix variable naming Vincent Guittot
2024-04-25  8:11 ` Lukasz Luba
2024-04-25  8:46 ` Sudeep Holla
2024-04-30 12:19 ` Konrad Dybcio
2024-05-15  8:27 ` [tip: sched/urgent] arch/topology: Fix variable naming to avoid shadowing tip-bot2 for Vincent Guittot

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®