[tip:sched/core 3/8] kernel/sched/core_sched.c:278:37: sparse: sparse: incompatible types in conditional expression (different address spaces):

From: kernel test robot
Date: Tue Nov 30 2021 - 06:59:52 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git sched/core
head: 8c92606ab81086db00cbb73347d124b4eb169b7e
commit: 4feee7d12603deca8775f9f9ae5e121093837444 [3/8] sched/core: Forced idle accounting
config: i386-randconfig-s001-20211128 (https://download.01.org/0day-ci/archive/20211130/202111301958.OvjPxCJ2-lkp@xxxxxxxxx/config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
reproduce:
# apt-get install sparse
# sparse version: v0.6.4-dirty
# https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git/commit/?id=4feee7d12603deca8775f9f9ae5e121093837444
git remote add tip https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git
git fetch --no-tags tip sched/core
git checkout 4feee7d12603deca8775f9f9ae5e121093837444
# save the config file to linux build tree
make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=i386 SHELL=/bin/bash kernel/sched/

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>


sparse warnings: (new ones prefixed by >>)
>> kernel/sched/core_sched.c:278:37: sparse: sparse: incompatible types in conditional expression (different address spaces):
>> kernel/sched/core_sched.c:278:37: sparse: struct task_struct *
>> kernel/sched/core_sched.c:278:37: sparse: struct task_struct [noderef] __rcu *
kernel/sched/core_sched.c: note: in included file:
kernel/sched/sched.h:1185:30: sparse: sparse: context imbalance in 'sched_core_update_cookie' - wrong count at exit

vim +278 kernel/sched/core_sched.c

240
241 /* REQUIRES: rq->core's clock recently updated. */
242 void __sched_core_account_forceidle(struct rq *rq)
243 {
244 const struct cpumask *smt_mask = cpu_smt_mask(cpu_of(rq));
245 u64 delta, now = rq_clock(rq->core);
246 struct rq *rq_i;
247 struct task_struct *p;
248 int i;
249
250 lockdep_assert_rq_held(rq);
251
252 WARN_ON_ONCE(!rq->core->core_forceidle_count);
253
254 if (rq->core->core_forceidle_start == 0)
255 return;
256
257 delta = now - rq->core->core_forceidle_start;
258 if (unlikely((s64)delta <= 0))
259 return;
260
261 rq->core->core_forceidle_start = now;
262
263 if (WARN_ON_ONCE(!rq->core->core_forceidle_occupation)) {
264 /* can't be forced idle without a running task */
265 } else if (rq->core->core_forceidle_count > 1 ||
266 rq->core->core_forceidle_occupation > 1) {
267 /*
268 * For larger SMT configurations, we need to scale the charged
269 * forced idle amount since there can be more than one forced
270 * idle sibling and more than one running cookied task.
271 */
272 delta *= rq->core->core_forceidle_count;
273 delta = div_u64(delta, rq->core->core_forceidle_occupation);
274 }
275
276 for_each_cpu(i, smt_mask) {
277 rq_i = cpu_rq(i);
> 278 p = rq_i->core_pick ?: rq_i->curr;
279
280 if (!p->core_cookie)
281 continue;
282
283 __schedstat_add(p->stats.core_forceidle_sum, delta);
284 }
285 }
286

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx