[ardb:arm32-ti-in-task-v4 4/4] arch/arm/include/asm/switch_to.h:37:56: warning: passing argument 1 of 'task_thread_info' discards 'const' qualifier from pointer target type

From: kernel test robot
Date: Sun Sep 12 2021 - 15:45:37 EST


tree: git://git.kernel.org/pub/scm/linux/kernel/git/ardb/linux.git arm32-ti-in-task-v4
head: 93cf46e56e4b898a98c156e5e0eb3233b4beea59
commit: 93cf46e56e4b898a98c156e5e0eb3233b4beea59 [4/4] ARM: enable THREAD_INFO_IN_TASK
config: arm-shmobile_defconfig (attached as .config)
compiler: arm-linux-gnueabi-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/ardb/linux.git/commit/?id=93cf46e56e4b898a98c156e5e0eb3233b4beea59
git remote add ardb git://git.kernel.org/pub/scm/linux/kernel/git/ardb/linux.git
git fetch --no-tags ardb arm32-ti-in-task-v4
git checkout 93cf46e56e4b898a98c156e5e0eb3233b4beea59
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross ARCH=arm

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

All warnings (new ones prefixed by >>):

In file included from kernel/sched/core.c:20:
arch/arm/include/asm/switch_to.h: In function '__update_ti_cpu':
>> arch/arm/include/asm/switch_to.h:37:56: warning: passing argument 1 of 'task_thread_info' discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
37 | task_thread_info(next)->cpu = task_thread_info(prev)->cpu;
| ^~~~
In file included from include/linux/kthread.h:6,
from include/trace/events/sched.h:8,
from kernel/sched/core.c:10:
include/linux/sched.h:1888:72: note: expected 'struct task_struct *' but argument is of type 'const struct task_struct *'
1888 | static inline struct thread_info *task_thread_info(struct task_struct *task)
| ~~~~~~~~~~~~~~~~~~~~^~~~
kernel/sched/core.c: At top level:
kernel/sched/core.c:3416:6: warning: no previous prototype for 'sched_set_stop_task' [-Wmissing-prototypes]
3416 | void sched_set_stop_task(int cpu, struct task_struct *stop)
| ^~~~~~~~~~~~~~~~~~~


vim +37 arch/arm/include/asm/switch_to.h

25
26 static inline void __update_ti_cpu(const struct task_struct *prev, struct task_struct *next)
27 {
28 if (!IS_ENABLED(CONFIG_THREAD_INFO_IN_TASK))
29 return;
30
31 /*
32 * The core code no longer maintains the thread_info::cpu field once
33 * CONFIG_THREAD_INFO_IN_TASK is in effect, but we rely on it for
34 * raw_smp_processor_id(), which cannot access struct task_struct*
35 * directly for reasons of circular #inclusion hell.
36 */
> 37 task_thread_info(next)->cpu = task_thread_info(prev)->cpu;
38 }
39

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

Attachment: .config.gz
Description: application/gzip