2022-01-26 22:34:41

by kernel test robot

[permalink] [raw]
Subject: [peterz-queue:sched/core 5/8] kernel/sched/sched.h:3006:32: warning: passing argument 1 of 'cpu_util_cfs' makes integer from pointer without a cast

tree: https://git.kernel.org/pub/scm/linux/kernel/git/peterz/queue.git sched/core
head: dbaafd0f1651b35e07c20e33f8c3f133fc65705e
commit: 6dd3d475cf576edd705885c66b6f1d638a6818f4 [5/8] sched/sugov: Ignore 'busy' filter when rq is capped by uclamp_max
config: ia64-allmodconfig (https://download.01.org/0day-ci/archive/20220127/[email protected]/config)
compiler: ia64-linux-gcc (GCC) 11.2.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://git.kernel.org/pub/scm/linux/kernel/git/peterz/queue.git/commit/?id=6dd3d475cf576edd705885c66b6f1d638a6818f4
git remote add peterz-queue https://git.kernel.org/pub/scm/linux/kernel/git/peterz/queue.git
git fetch --no-tags peterz-queue sched/core
git checkout 6dd3d475cf576edd705885c66b6f1d638a6818f4
# save the config file to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross O=build_dir ARCH=ia64 SHELL=/bin/bash kernel/

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <[email protected]>

All warnings (new ones prefixed by >>):

In file included from kernel/sched/core.c:13:
kernel/sched/sched.h: In function 'uclamp_rq_is_capped':
>> kernel/sched/sched.h:3006:32: warning: passing argument 1 of 'cpu_util_cfs' makes integer from pointer without a cast [-Wint-conversion]
3006 | rq_util = cpu_util_cfs(rq) + cpu_util_rt(rq);
| ^~
| |
| struct rq *
kernel/sched/sched.h:2919:46: note: expected 'int' but argument is of type 'struct rq *'
2919 | static inline unsigned long cpu_util_cfs(int cpu)
| ~~~~^~~
kernel/sched/core.c: At top level:
kernel/sched/core.c:3454:6: warning: no previous prototype for 'sched_set_stop_task' [-Wmissing-prototypes]
3454 | void sched_set_stop_task(int cpu, struct task_struct *stop)
| ^~~~~~~~~~~~~~~~~~~
--
In file included from kernel/sched/loadavg.c:9:
kernel/sched/sched.h: In function 'uclamp_rq_is_capped':
>> kernel/sched/sched.h:3006:32: warning: passing argument 1 of 'cpu_util_cfs' makes integer from pointer without a cast [-Wint-conversion]
3006 | rq_util = cpu_util_cfs(rq) + cpu_util_rt(rq);
| ^~
| |
| struct rq *
kernel/sched/sched.h:2919:46: note: expected 'int' but argument is of type 'struct rq *'
2919 | static inline unsigned long cpu_util_cfs(int cpu)
| ~~~~^~~
--
In file included from kernel/sched/fair.c:23:
kernel/sched/sched.h: In function 'uclamp_rq_is_capped':
>> kernel/sched/sched.h:3006:32: warning: passing argument 1 of 'cpu_util_cfs' makes integer from pointer without a cast [-Wint-conversion]
3006 | rq_util = cpu_util_cfs(rq) + cpu_util_rt(rq);
| ^~
| |
| struct rq *
kernel/sched/sched.h:2919:46: note: expected 'int' but argument is of type 'struct rq *'
2919 | static inline unsigned long cpu_util_cfs(int cpu)
| ~~~~^~~
kernel/sched/fair.c: At top level:
kernel/sched/fair.c:11049:6: warning: no previous prototype for 'task_vruntime_update' [-Wmissing-prototypes]
11049 | void task_vruntime_update(struct rq *rq, struct task_struct *p, bool in_fi)
| ^~~~~~~~~~~~~~~~~~~~
--
In file included from kernel/sched/rt.c:6:
kernel/sched/sched.h: In function 'uclamp_rq_is_capped':
>> kernel/sched/sched.h:3006:32: warning: passing argument 1 of 'cpu_util_cfs' makes integer from pointer without a cast [-Wint-conversion]
3006 | rq_util = cpu_util_cfs(rq) + cpu_util_rt(rq);
| ^~
| |
| struct rq *
kernel/sched/sched.h:2919:46: note: expected 'int' but argument is of type 'struct rq *'
2919 | static inline unsigned long cpu_util_cfs(int cpu)
| ~~~~^~~
kernel/sched/rt.c: At top level:
kernel/sched/rt.c:680:6: warning: no previous prototype for 'sched_rt_bandwidth_account' [-Wmissing-prototypes]
680 | bool sched_rt_bandwidth_account(struct rt_rq *rt_rq)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~


vim +/cpu_util_cfs +3006 kernel/sched/sched.h

2996
2997 /* Is the rq being capped/throttled by uclamp_max? */
2998 static inline bool uclamp_rq_is_capped(struct rq *rq)
2999 {
3000 unsigned long rq_util;
3001 unsigned long max_util;
3002
3003 if (!static_branch_likely(&sched_uclamp_used))
3004 return false;
3005
> 3006 rq_util = cpu_util_cfs(rq) + cpu_util_rt(rq);
3007 max_util = READ_ONCE(rq->uclamp[UCLAMP_MAX].value);
3008
3009 return max_util != SCHED_CAPACITY_SCALE && rq_util >= max_util;
3010 }
3011

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/[email protected]


2022-01-27 02:48:39

by Qais Yousef

[permalink] [raw]
Subject: Re: [peterz-queue:sched/core 5/8] kernel/sched/sched.h:3006:32: warning: passing argument 1 of 'cpu_util_cfs' makes integer from pointer without a cast

On 01/27/22 03:53, kernel test robot wrote:
> tree: https://git.kernel.org/pub/scm/linux/kernel/git/peterz/queue.git sched/core
> head: dbaafd0f1651b35e07c20e33f8c3f133fc65705e
> commit: 6dd3d475cf576edd705885c66b6f1d638a6818f4 [5/8] sched/sugov: Ignore 'busy' filter when rq is capped by uclamp_max
> config: ia64-allmodconfig (https://download.01.org/0day-ci/archive/20220127/[email protected]/config)
> compiler: ia64-linux-gcc (GCC) 11.2.0
> reproduce (this is a W=1 build):
> wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
> chmod +x ~/bin/make.cross
> # https://git.kernel.org/pub/scm/linux/kernel/git/peterz/queue.git/commit/?id=6dd3d475cf576edd705885c66b6f1d638a6818f4
> git remote add peterz-queue https://git.kernel.org/pub/scm/linux/kernel/git/peterz/queue.git
> git fetch --no-tags peterz-queue sched/core
> git checkout 6dd3d475cf576edd705885c66b6f1d638a6818f4
> # save the config file to linux build tree
> mkdir build_dir
> COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross O=build_dir ARCH=ia64 SHELL=/bin/bash kernel/
>
> If you fix the issue, kindly add following tag as appropriate
> Reported-by: kernel test robot <[email protected]>
>
> All warnings (new ones prefixed by >>):
>
> In file included from kernel/sched/core.c:13:
> kernel/sched/sched.h: In function 'uclamp_rq_is_capped':
> >> kernel/sched/sched.h:3006:32: warning: passing argument 1 of 'cpu_util_cfs' makes integer from pointer without a cast [-Wint-conversion]
> 3006 | rq_util = cpu_util_cfs(rq) + cpu_util_rt(rq);
> | ^~
> | |
> | struct rq *
> kernel/sched/sched.h:2919:46: note: expected 'int' but argument is of type 'struct rq *'
> 2919 | static inline unsigned long cpu_util_cfs(int cpu)

Seems cpu_utils_cfs() definition has changed since I posted my patch. Below
ought to fix it.

Thanks!

--
Qais Yousef

--->8---

diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h
index c7bf5309c162..9b33ba9c3c42 100644
--- a/kernel/sched/sched.h
+++ b/kernel/sched/sched.h
@@ -3003,7 +3003,7 @@ static inline bool uclamp_rq_is_capped(struct rq *rq)
if (!static_branch_likely(&sched_uclamp_used))
return false;

- rq_util = cpu_util_cfs(rq) + cpu_util_rt(rq);
+ rq_util = cpu_util_cfs(cpu_of(rq)) + cpu_util_rt(rq);
max_util = READ_ONCE(rq->uclamp[UCLAMP_MAX].value);

return max_util != SCHED_CAPACITY_SCALE && rq_util >= max_util;