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

From: kernel test robot
Date: Wed Apr 24 2024 - 19:22:46 EST


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/202404250740.VhQQoD7N-lkp@xxxxxxxxx/config)
compiler: aarch64-linux-gcc (GCC) 13.2.0
reproduce: (https://download.01.org/0day-ci/archive/20240425/202404250740.VhQQoD7N-lkp@xxxxxxxxx/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 <lkp@xxxxxxxxx>
| Closes: https://lore.kernel.org/oe-kbuild-all/202404250740.VhQQoD7N-lkp@xxxxxxxxx/

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