2024-04-24 23:22:58

by kernel test robot

[permalink] [raw]
Subject: [tip:sched/core 26/27] drivers/base/arch_topology.c:204:17: sparse: sparse: incorrect type in initializer (different address spaces)

Hi Vincent,

FYI, the error/warning was bisected to this commit, please ignore it if it's irrelevant.

tree: https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git sched/core
head: 97450eb909658573dcacc1063b06d3d08642c0c1
commit: d4dbc991714eefcbd8d54a3204bd77a0a52bd32d [26/27] sched/cpufreq: Rename arch_update_thermal_pressure() => arch_update_hw_pressure()
config: arm64-randconfig-r132-20240425 (https://download.01.org/0day-ci/archive/20240425/[email protected]/config)
compiler: aarch64-linux-gcc (GCC) 13.2.0
reproduce: (https://download.01.org/0day-ci/archive/20240425/[email protected]/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

sparse warnings: (new ones prefixed by >>)
>> drivers/base/arch_topology.c:204:17: sparse: sparse: incorrect type in initializer (different address spaces) @@ expected void const [noderef] __percpu *__vpp_verify @@ got unsigned long * @@
drivers/base/arch_topology.c:204:17: sparse: expected void const [noderef] __percpu *__vpp_verify
drivers/base/arch_topology.c:204:17: sparse: got unsigned long *
>> drivers/base/arch_topology.c:204:17: sparse: sparse: incorrect type in initializer (different address spaces) @@ expected void const [noderef] __percpu *__vpp_verify @@ got unsigned long * @@
drivers/base/arch_topology.c:204:17: sparse: expected void const [noderef] __percpu *__vpp_verify
drivers/base/arch_topology.c:204:17: sparse: got unsigned long *
>> drivers/base/arch_topology.c:204:17: sparse: sparse: incorrect type in initializer (different address spaces) @@ expected void const [noderef] __percpu *__vpp_verify @@ got unsigned long * @@
drivers/base/arch_topology.c:204:17: sparse: expected void const [noderef] __percpu *__vpp_verify
drivers/base/arch_topology.c:204:17: sparse: got unsigned long *
>> drivers/base/arch_topology.c:204:17: sparse: sparse: incorrect type in initializer (different address spaces) @@ expected void const [noderef] __percpu *__vpp_verify @@ got unsigned long * @@
drivers/base/arch_topology.c:204:17: sparse: expected void const [noderef] __percpu *__vpp_verify
drivers/base/arch_topology.c:204:17: sparse: got unsigned long *
>> drivers/base/arch_topology.c:204:17: sparse: sparse: incorrect type in initializer (different address spaces) @@ expected void const [noderef] __percpu *__vpp_verify @@ got unsigned long * @@
drivers/base/arch_topology.c:204:17: sparse: expected void const [noderef] __percpu *__vpp_verify
drivers/base/arch_topology.c:204:17: sparse: got unsigned long *
>> drivers/base/arch_topology.c:204:17: sparse: sparse: incorrect type in initializer (different address spaces) @@ expected void const [noderef] __percpu *__vpp_verify @@ got unsigned long * @@
drivers/base/arch_topology.c:204:17: sparse: expected void const [noderef] __percpu *__vpp_verify
drivers/base/arch_topology.c:204:17: sparse: got unsigned long *
>> drivers/base/arch_topology.c:204:17: sparse: sparse: incorrect type in initializer (different address spaces) @@ expected void const [noderef] __percpu *__vpp_verify @@ got unsigned long * @@
drivers/base/arch_topology.c:204:17: sparse: expected void const [noderef] __percpu *__vpp_verify
drivers/base/arch_topology.c:204:17: sparse: got unsigned long *

vim +204 drivers/base/arch_topology.c

164
165 /**
166 * topology_update_hw_pressure() - Update HW pressure for CPUs
167 * @cpus : The related CPUs for which capacity has been reduced
168 * @capped_freq : The maximum allowed frequency that CPUs can run at
169 *
170 * Update the value of HW pressure for all @cpus in the mask. The
171 * cpumask should include all (online+offline) affected CPUs, to avoid
172 * operating on stale data when hot-plug is used for some CPUs. The
173 * @capped_freq reflects the currently allowed max CPUs frequency due to
174 * HW capping. It might be also a boost frequency value, which is bigger
175 * than the internal 'capacity_freq_ref' max frequency. In such case the
176 * pressure value should simply be removed, since this is an indication that
177 * there is no HW throttling. The @capped_freq must be provided in kHz.
178 */
179 void topology_update_hw_pressure(const struct cpumask *cpus,
180 unsigned long capped_freq)
181 {
182 unsigned long max_capacity, capacity, hw_pressure;
183 u32 max_freq;
184 int cpu;
185
186 cpu = cpumask_first(cpus);
187 max_capacity = arch_scale_cpu_capacity(cpu);
188 max_freq = arch_scale_freq_ref(cpu);
189
190 /*
191 * Handle properly the boost frequencies, which should simply clean
192 * the HW pressure value.
193 */
194 if (max_freq <= capped_freq)
195 capacity = max_capacity;
196 else
197 capacity = mult_frac(max_capacity, capped_freq, max_freq);
198
199 hw_pressure = max_capacity - capacity;
200
201 trace_hw_pressure_update(cpu, hw_pressure);
202
203 for_each_cpu(cpu, cpus)
> 204 WRITE_ONCE(per_cpu(hw_pressure, cpu), hw_pressure);
205 }
206 EXPORT_SYMBOL_GPL(topology_update_hw_pressure);
207

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki


2024-04-25 06:36:55

by Vincent Guittot

[permalink] [raw]
Subject: Re: [tip:sched/core 26/27] drivers/base/arch_topology.c:204:17: sparse: sparse: incorrect type in initializer (different address spaces)

Hi,

On Thu, 25 Apr 2024 at 01:22, kernel test robot <[email protected]> wrote:
>
> Hi Vincent,
>
> FYI, the error/warning was bisected to this commit, please ignore it if it's irrelevant.
>
> tree: https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git sched/core
> head: 97450eb909658573dcacc1063b06d3d08642c0c1
> commit: d4dbc991714eefcbd8d54a3204bd77a0a52bd32d [26/27] sched/cpufreq: Rename arch_update_thermal_pressure() => arch_update_hw_pressure()

I'm going to look at this more deeply but this patch only rename
"thermal_pressure" by "hw_pressure" so unless I miss a renaming, this
should not trigger anything new.

> config: arm64-randconfig-r132-20240425 (https://download.01.org/0day-ci/archive/20240425/[email protected]/config)
> compiler: aarch64-linux-gcc (GCC) 13.2.0
> reproduce: (https://download.01.org/0day-ci/archive/20240425/[email protected]/reproduce)
>
> If you fix the issue in a separate patch/commit (i.e. not just a new version of
> the same patch/commit), kindly add following tags
> | Reported-by: kernel test robot <[email protected]>
> | Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
>
> sparse warnings: (new ones prefixed by >>)
> >> drivers/base/arch_topology.c:204:17: sparse: sparse: incorrect type in initializer (different address spaces) @@ expected void const [noderef] __percpu *__vpp_verify @@ got unsigned long * @@
> drivers/base/arch_topology.c:204:17: sparse: expected void const [noderef] __percpu *__vpp_verify
> drivers/base/arch_topology.c:204:17: sparse: got unsigned long *
> >> drivers/base/arch_topology.c:204:17: sparse: sparse: incorrect type in initializer (different address spaces) @@ expected void const [noderef] __percpu *__vpp_verify @@ got unsigned long * @@
> drivers/base/arch_topology.c:204:17: sparse: expected void const [noderef] __percpu *__vpp_verify
> drivers/base/arch_topology.c:204:17: sparse: got unsigned long *
> >> drivers/base/arch_topology.c:204:17: sparse: sparse: incorrect type in initializer (different address spaces) @@ expected void const [noderef] __percpu *__vpp_verify @@ got unsigned long * @@
> drivers/base/arch_topology.c:204:17: sparse: expected void const [noderef] __percpu *__vpp_verify
> drivers/base/arch_topology.c:204:17: sparse: got unsigned long *
> >> drivers/base/arch_topology.c:204:17: sparse: sparse: incorrect type in initializer (different address spaces) @@ expected void const [noderef] __percpu *__vpp_verify @@ got unsigned long * @@
> drivers/base/arch_topology.c:204:17: sparse: expected void const [noderef] __percpu *__vpp_verify
> drivers/base/arch_topology.c:204:17: sparse: got unsigned long *
> >> drivers/base/arch_topology.c:204:17: sparse: sparse: incorrect type in initializer (different address spaces) @@ expected void const [noderef] __percpu *__vpp_verify @@ got unsigned long * @@
> drivers/base/arch_topology.c:204:17: sparse: expected void const [noderef] __percpu *__vpp_verify
> drivers/base/arch_topology.c:204:17: sparse: got unsigned long *
> >> drivers/base/arch_topology.c:204:17: sparse: sparse: incorrect type in initializer (different address spaces) @@ expected void const [noderef] __percpu *__vpp_verify @@ got unsigned long * @@
> drivers/base/arch_topology.c:204:17: sparse: expected void const [noderef] __percpu *__vpp_verify
> drivers/base/arch_topology.c:204:17: sparse: got unsigned long *
> >> drivers/base/arch_topology.c:204:17: sparse: sparse: incorrect type in initializer (different address spaces) @@ expected void const [noderef] __percpu *__vpp_verify @@ got unsigned long * @@
> drivers/base/arch_topology.c:204:17: sparse: expected void const [noderef] __percpu *__vpp_verify
> drivers/base/arch_topology.c:204:17: sparse: got unsigned long *
>
> vim +204 drivers/base/arch_topology.c
>
> 164
> 165 /**
> 166 * topology_update_hw_pressure() - Update HW pressure for CPUs
> 167 * @cpus : The related CPUs for which capacity has been reduced
> 168 * @capped_freq : The maximum allowed frequency that CPUs can run at
> 169 *
> 170 * Update the value of HW pressure for all @cpus in the mask. The
> 171 * cpumask should include all (online+offline) affected CPUs, to avoid
> 172 * operating on stale data when hot-plug is used for some CPUs. The
> 173 * @capped_freq reflects the currently allowed max CPUs frequency due to
> 174 * HW capping. It might be also a boost frequency value, which is bigger
> 175 * than the internal 'capacity_freq_ref' max frequency. In such case the
> 176 * pressure value should simply be removed, since this is an indication that
> 177 * there is no HW throttling. The @capped_freq must be provided in kHz.
> 178 */
> 179 void topology_update_hw_pressure(const struct cpumask *cpus,
> 180 unsigned long capped_freq)
> 181 {
> 182 unsigned long max_capacity, capacity, hw_pressure;
> 183 u32 max_freq;
> 184 int cpu;
> 185
> 186 cpu = cpumask_first(cpus);
> 187 max_capacity = arch_scale_cpu_capacity(cpu);
> 188 max_freq = arch_scale_freq_ref(cpu);
> 189
> 190 /*
> 191 * Handle properly the boost frequencies, which should simply clean
> 192 * the HW pressure value.
> 193 */
> 194 if (max_freq <= capped_freq)
> 195 capacity = max_capacity;
> 196 else
> 197 capacity = mult_frac(max_capacity, capped_freq, max_freq);
> 198
> 199 hw_pressure = max_capacity - capacity;
> 200
> 201 trace_hw_pressure_update(cpu, hw_pressure);
> 202
> 203 for_each_cpu(cpu, cpus)
> > 204 WRITE_ONCE(per_cpu(hw_pressure, cpu), hw_pressure);
> 205 }
> 206 EXPORT_SYMBOL_GPL(topology_update_hw_pressure);
> 207
>
> --
> 0-DAY CI Kernel Test Service
> https://github.com/intel/lkp-tests/wiki

2024-04-25 10:57:22

by Yujie Liu

[permalink] [raw]
Subject: Re: [tip:sched/core 26/27] drivers/base/arch_topology.c:204:17: sparse: sparse: incorrect type in initializer (different address spaces)

Hi Vincent,

On Thu, Apr 25, 2024 at 08:36:31AM +0200, Vincent Guittot wrote:
> Hi,
>
> On Thu, 25 Apr 2024 at 01:22, kernel test robot <[email protected]> wrote:
> >
> > Hi Vincent,
> >
> > FYI, the error/warning was bisected to this commit, please ignore it if it's irrelevant.
> >
> > tree: https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git sched/core
> > head: 97450eb909658573dcacc1063b06d3d08642c0c1
> > commit: d4dbc991714eefcbd8d54a3204bd77a0a52bd32d [26/27] sched/cpufreq: Rename arch_update_thermal_pressure() => arch_update_hw_pressure()
>
> I'm going to look at this more deeply but this patch only rename
> "thermal_pressure" by "hw_pressure" so unless I miss a renaming, this
> should not trigger anything new.

Before renaming, there is a global "thermal_pressure", and a local
"th_pressure" inside topology_update_thermal_pressure function. They
live together peacefully since they have different names.

DEFINE_PER_CPU(unsigned long, thermal_pressure);
^____

void topology_update_thermal_pressure(const struct cpumask *cpus,
unsigned long capped_freq)
{
unsigned long max_capacity, capacity, th_pressure;
^____
..
for_each_cpu(cpu, cpus)
WRITE_ONCE(per_cpu(thermal_pressure, cpu), th_pressure);
^____ ^____
}

After renaming, the global and local variables are both given the same
name "hw_pressure", so the local one shadows the global one, causing
this sparse warning.

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;
^___
..
for_each_cpu(cpu, cpus)
WRITE_ONCE(per_cpu(hw_pressure, cpu), hw_pressure);
^____ ^____
}


We can give them different names as before to fix this warning:

---------------------------------------------------------------

diff --git a/drivers/base/arch_topology.c b/drivers/base/arch_topology.c
index 0248912ff6875..c66d070207a0e 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);

--

Thanks,
Yujie

> > config: arm64-randconfig-r132-20240425 (https://download.01.org/0day-ci/archive/20240425/[email protected]/config)
> > compiler: aarch64-linux-gcc (GCC) 13.2.0
> > reproduce: (https://download.01.org/0day-ci/archive/20240425/[email protected]/reproduce)
> >
> > If you fix the issue in a separate patch/commit (i.e. not just a new version of
> > the same patch/commit), kindly add following tags
> > | Reported-by: kernel test robot <[email protected]>
> > | Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
> >
> > sparse warnings: (new ones prefixed by >>)
> > >> drivers/base/arch_topology.c:204:17: sparse: sparse: incorrect type in initializer (different address spaces) @@ expected void const [noderef] __percpu *__vpp_verify @@ got unsigned long * @@
> > drivers/base/arch_topology.c:204:17: sparse: expected void const [noderef] __percpu *__vpp_verify
> > drivers/base/arch_topology.c:204:17: sparse: got unsigned long *
> > >> drivers/base/arch_topology.c:204:17: sparse: sparse: incorrect type in initializer (different address spaces) @@ expected void const [noderef] __percpu *__vpp_verify @@ got unsigned long * @@
> > drivers/base/arch_topology.c:204:17: sparse: expected void const [noderef] __percpu *__vpp_verify
> > drivers/base/arch_topology.c:204:17: sparse: got unsigned long *
> > >> drivers/base/arch_topology.c:204:17: sparse: sparse: incorrect type in initializer (different address spaces) @@ expected void const [noderef] __percpu *__vpp_verify @@ got unsigned long * @@
> > drivers/base/arch_topology.c:204:17: sparse: expected void const [noderef] __percpu *__vpp_verify
> > drivers/base/arch_topology.c:204:17: sparse: got unsigned long *
> > >> drivers/base/arch_topology.c:204:17: sparse: sparse: incorrect type in initializer (different address spaces) @@ expected void const [noderef] __percpu *__vpp_verify @@ got unsigned long * @@
> > drivers/base/arch_topology.c:204:17: sparse: expected void const [noderef] __percpu *__vpp_verify
> > drivers/base/arch_topology.c:204:17: sparse: got unsigned long *
> > >> drivers/base/arch_topology.c:204:17: sparse: sparse: incorrect type in initializer (different address spaces) @@ expected void const [noderef] __percpu *__vpp_verify @@ got unsigned long * @@
> > drivers/base/arch_topology.c:204:17: sparse: expected void const [noderef] __percpu *__vpp_verify
> > drivers/base/arch_topology.c:204:17: sparse: got unsigned long *
> > >> drivers/base/arch_topology.c:204:17: sparse: sparse: incorrect type in initializer (different address spaces) @@ expected void const [noderef] __percpu *__vpp_verify @@ got unsigned long * @@
> > drivers/base/arch_topology.c:204:17: sparse: expected void const [noderef] __percpu *__vpp_verify
> > drivers/base/arch_topology.c:204:17: sparse: got unsigned long *
> > >> drivers/base/arch_topology.c:204:17: sparse: sparse: incorrect type in initializer (different address spaces) @@ expected void const [noderef] __percpu *__vpp_verify @@ got unsigned long * @@
> > drivers/base/arch_topology.c:204:17: sparse: expected void const [noderef] __percpu *__vpp_verify
> > drivers/base/arch_topology.c:204:17: sparse: got unsigned long *
> >
> > vim +204 drivers/base/arch_topology.c
> >
> > 164
> > 165 /**
> > 166 * topology_update_hw_pressure() - Update HW pressure for CPUs
> > 167 * @cpus : The related CPUs for which capacity has been reduced
> > 168 * @capped_freq : The maximum allowed frequency that CPUs can run at
> > 169 *
> > 170 * Update the value of HW pressure for all @cpus in the mask. The
> > 171 * cpumask should include all (online+offline) affected CPUs, to avoid
> > 172 * operating on stale data when hot-plug is used for some CPUs. The
> > 173 * @capped_freq reflects the currently allowed max CPUs frequency due to
> > 174 * HW capping. It might be also a boost frequency value, which is bigger
> > 175 * than the internal 'capacity_freq_ref' max frequency. In such case the
> > 176 * pressure value should simply be removed, since this is an indication that
> > 177 * there is no HW throttling. The @capped_freq must be provided in kHz.
> > 178 */
> > 179 void topology_update_hw_pressure(const struct cpumask *cpus,
> > 180 unsigned long capped_freq)
> > 181 {
> > 182 unsigned long max_capacity, capacity, hw_pressure;
> > 183 u32 max_freq;
> > 184 int cpu;
> > 185
> > 186 cpu = cpumask_first(cpus);
> > 187 max_capacity = arch_scale_cpu_capacity(cpu);
> > 188 max_freq = arch_scale_freq_ref(cpu);
> > 189
> > 190 /*
> > 191 * Handle properly the boost frequencies, which should simply clean
> > 192 * the HW pressure value.
> > 193 */
> > 194 if (max_freq <= capped_freq)
> > 195 capacity = max_capacity;
> > 196 else
> > 197 capacity = mult_frac(max_capacity, capped_freq, max_freq);
> > 198
> > 199 hw_pressure = max_capacity - capacity;
> > 200
> > 201 trace_hw_pressure_update(cpu, hw_pressure);
> > 202
> > 203 for_each_cpu(cpu, cpus)
> > > 204 WRITE_ONCE(per_cpu(hw_pressure, cpu), hw_pressure);
> > 205 }
> > 206 EXPORT_SYMBOL_GPL(topology_update_hw_pressure);
> > 207
> >
> > --
> > 0-DAY CI Kernel Test Service
> > https://github.com/intel/lkp-tests/wiki
>

2024-04-25 11:14:20

by Vincent Guittot

[permalink] [raw]
Subject: Re: [tip:sched/core 26/27] drivers/base/arch_topology.c:204:17: sparse: sparse: incorrect type in initializer (different address spaces)

Hi Yujie,

On Thu, 25 Apr 2024 at 12:57, Yujie Liu <[email protected]> wrote:
>
> Hi Vincent,
>
> On Thu, Apr 25, 2024 at 08:36:31AM +0200, Vincent Guittot wrote:
> > Hi,
> >
> > On Thu, 25 Apr 2024 at 01:22, kernel test robot <[email protected]> wrote:
> > >
> > > Hi Vincent,
> > >
> > > FYI, the error/warning was bisected to this commit, please ignore it if it's irrelevant.
> > >
> > > tree: https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git sched/core
> > > head: 97450eb909658573dcacc1063b06d3d08642c0c1
> > > commit: d4dbc991714eefcbd8d54a3204bd77a0a52bd32d [26/27] sched/cpufreq: Rename arch_update_thermal_pressure() => arch_update_hw_pressure()
> >
> > I'm going to look at this more deeply but this patch only rename
> > "thermal_pressure" by "hw_pressure" so unless I miss a renaming, this
> > should not trigger anything new.
>
> Before renaming, there is a global "thermal_pressure", and a local
> "th_pressure" inside topology_update_thermal_pressure function. They
> live together peacefully since they have different names.
>
> DEFINE_PER_CPU(unsigned long, thermal_pressure);
> ^____
>
> void topology_update_thermal_pressure(const struct cpumask *cpus,
> unsigned long capped_freq)
> {
> unsigned long max_capacity, capacity, th_pressure;
> ^____
> ...
> for_each_cpu(cpu, cpus)
> WRITE_ONCE(per_cpu(thermal_pressure, cpu), th_pressure);
> ^____ ^____
> }
>
> After renaming, the global and local variables are both given the same
> name "hw_pressure", so the local one shadows the global one, causing
> this sparse warning.
>
> 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;
> ^___
> ...
> for_each_cpu(cpu, cpus)
> WRITE_ONCE(per_cpu(hw_pressure, cpu), hw_pressure);
> ^____ ^____
> }
>
>
> We can give them different names as before to fix this warning:

Yes, that's what I noticed as well. I sent the fix here:
https://lore.kernel.org/lkml/[email protected]/

>
> ---------------------------------------------------------------
>
> diff --git a/drivers/base/arch_topology.c b/drivers/base/arch_topology.c
> index 0248912ff6875..c66d070207a0e 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);
>
> --
>
> Thanks,
> Yujie
>
> > > config: arm64-randconfig-r132-20240425 (https://download.01.org/0day-ci/archive/20240425/[email protected]/config)
> > > compiler: aarch64-linux-gcc (GCC) 13.2.0
> > > reproduce: (https://download.01.org/0day-ci/archive/20240425/[email protected]/reproduce)
> > >
> > > If you fix the issue in a separate patch/commit (i.e. not just a new version of
> > > the same patch/commit), kindly add following tags
> > > | Reported-by: kernel test robot <[email protected]>
> > > | Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
> > >
> > > sparse warnings: (new ones prefixed by >>)
> > > >> drivers/base/arch_topology.c:204:17: sparse: sparse: incorrect type in initializer (different address spaces) @@ expected void const [noderef] __percpu *__vpp_verify @@ got unsigned long * @@
> > > drivers/base/arch_topology.c:204:17: sparse: expected void const [noderef] __percpu *__vpp_verify
> > > drivers/base/arch_topology.c:204:17: sparse: got unsigned long *
> > > >> drivers/base/arch_topology.c:204:17: sparse: sparse: incorrect type in initializer (different address spaces) @@ expected void const [noderef] __percpu *__vpp_verify @@ got unsigned long * @@
> > > drivers/base/arch_topology.c:204:17: sparse: expected void const [noderef] __percpu *__vpp_verify
> > > drivers/base/arch_topology.c:204:17: sparse: got unsigned long *
> > > >> drivers/base/arch_topology.c:204:17: sparse: sparse: incorrect type in initializer (different address spaces) @@ expected void const [noderef] __percpu *__vpp_verify @@ got unsigned long * @@
> > > drivers/base/arch_topology.c:204:17: sparse: expected void const [noderef] __percpu *__vpp_verify
> > > drivers/base/arch_topology.c:204:17: sparse: got unsigned long *
> > > >> drivers/base/arch_topology.c:204:17: sparse: sparse: incorrect type in initializer (different address spaces) @@ expected void const [noderef] __percpu *__vpp_verify @@ got unsigned long * @@
> > > drivers/base/arch_topology.c:204:17: sparse: expected void const [noderef] __percpu *__vpp_verify
> > > drivers/base/arch_topology.c:204:17: sparse: got unsigned long *
> > > >> drivers/base/arch_topology.c:204:17: sparse: sparse: incorrect type in initializer (different address spaces) @@ expected void const [noderef] __percpu *__vpp_verify @@ got unsigned long * @@
> > > drivers/base/arch_topology.c:204:17: sparse: expected void const [noderef] __percpu *__vpp_verify
> > > drivers/base/arch_topology.c:204:17: sparse: got unsigned long *
> > > >> drivers/base/arch_topology.c:204:17: sparse: sparse: incorrect type in initializer (different address spaces) @@ expected void const [noderef] __percpu *__vpp_verify @@ got unsigned long * @@
> > > drivers/base/arch_topology.c:204:17: sparse: expected void const [noderef] __percpu *__vpp_verify
> > > drivers/base/arch_topology.c:204:17: sparse: got unsigned long *
> > > >> drivers/base/arch_topology.c:204:17: sparse: sparse: incorrect type in initializer (different address spaces) @@ expected void const [noderef] __percpu *__vpp_verify @@ got unsigned long * @@
> > > drivers/base/arch_topology.c:204:17: sparse: expected void const [noderef] __percpu *__vpp_verify
> > > drivers/base/arch_topology.c:204:17: sparse: got unsigned long *
> > >
> > > vim +204 drivers/base/arch_topology.c
> > >
> > > 164
> > > 165 /**
> > > 166 * topology_update_hw_pressure() - Update HW pressure for CPUs
> > > 167 * @cpus : The related CPUs for which capacity has been reduced
> > > 168 * @capped_freq : The maximum allowed frequency that CPUs can run at
> > > 169 *
> > > 170 * Update the value of HW pressure for all @cpus in the mask. The
> > > 171 * cpumask should include all (online+offline) affected CPUs, to avoid
> > > 172 * operating on stale data when hot-plug is used for some CPUs. The
> > > 173 * @capped_freq reflects the currently allowed max CPUs frequency due to
> > > 174 * HW capping. It might be also a boost frequency value, which is bigger
> > > 175 * than the internal 'capacity_freq_ref' max frequency. In such case the
> > > 176 * pressure value should simply be removed, since this is an indication that
> > > 177 * there is no HW throttling. The @capped_freq must be provided in kHz.
> > > 178 */
> > > 179 void topology_update_hw_pressure(const struct cpumask *cpus,
> > > 180 unsigned long capped_freq)
> > > 181 {
> > > 182 unsigned long max_capacity, capacity, hw_pressure;
> > > 183 u32 max_freq;
> > > 184 int cpu;
> > > 185
> > > 186 cpu = cpumask_first(cpus);
> > > 187 max_capacity = arch_scale_cpu_capacity(cpu);
> > > 188 max_freq = arch_scale_freq_ref(cpu);
> > > 189
> > > 190 /*
> > > 191 * Handle properly the boost frequencies, which should simply clean
> > > 192 * the HW pressure value.
> > > 193 */
> > > 194 if (max_freq <= capped_freq)
> > > 195 capacity = max_capacity;
> > > 196 else
> > > 197 capacity = mult_frac(max_capacity, capped_freq, max_freq);
> > > 198
> > > 199 hw_pressure = max_capacity - capacity;
> > > 200
> > > 201 trace_hw_pressure_update(cpu, hw_pressure);
> > > 202
> > > 203 for_each_cpu(cpu, cpus)
> > > > 204 WRITE_ONCE(per_cpu(hw_pressure, cpu), hw_pressure);
> > > 205 }
> > > 206 EXPORT_SYMBOL_GPL(topology_update_hw_pressure);
> > > 207
> > >
> > > --
> > > 0-DAY CI Kernel Test Service
> > > https://github.com/intel/lkp-tests/wiki
> >