[mingo-tip:sched/headers 168/2384] include/linux/sched/affinity.h:32:9: error: incomplete definition of type 'struct task_struct'

From: kernel test robot
Date: Sun Jan 16 2022 - 22:41:27 EST


tree: git://git.kernel.org/pub/scm/linux/kernel/git/mingo/tip.git sched/headers
head: 4c707c1c0de83967079b4e385012fa5b00e2cd11
commit: 92675dd8b872d91539f60f7dc7ddf7e2a1c70361 [168/2384] headers/deps: Move CPU affinity APIs from <linux/sched.h> to <linux/sched/affinity.h>
config: i386-randconfig-a014-20220109 (https://download.01.org/0day-ci/archive/20220117/202201171113.5k8tKBGY-lkp@xxxxxxxxx/config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 5f782d25a742302d25ef3c8b84b54f7483c2deb9)
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/mingo/tip.git/commit/?id=92675dd8b872d91539f60f7dc7ddf7e2a1c70361
git remote add mingo-tip git://git.kernel.org/pub/scm/linux/kernel/git/mingo/tip.git
git fetch --no-tags mingo-tip sched/headers
git checkout 92675dd8b872d91539f60f7dc7ddf7e2a1c70361
# save the config file to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=i386 SHELL=/bin/bash

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

Note: the mingo-tip/sched/headers HEAD 4c707c1c0de83967079b4e385012fa5b00e2cd11 builds fine.
It only hurts bisectability.

All errors (new ones prefixed by >>):

In file included from lib/syscall.c:2:
>> include/linux/sched/affinity.h:32:9: error: incomplete definition of type 'struct task_struct'
if (src->user_cpus_ptr)
~~~^
include/linux/compiler.h:56:47: note: expanded from macro 'if'
#define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
^~~~
include/linux/compiler.h:58:52: note: expanded from macro '__trace_if_var'
#define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
^~~~
include/linux/sched/affinity.h:8:8: note: forward declaration of 'struct task_struct'
struct task_struct;
^
>> include/linux/sched/affinity.h:32:9: error: incomplete definition of type 'struct task_struct'
if (src->user_cpus_ptr)
~~~^
include/linux/compiler.h:56:47: note: expanded from macro 'if'
#define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
^~~~
include/linux/compiler.h:58:61: note: expanded from macro '__trace_if_var'
#define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
^~~~
include/linux/sched/affinity.h:8:8: note: forward declaration of 'struct task_struct'
struct task_struct;
^
>> include/linux/sched/affinity.h:32:9: error: incomplete definition of type 'struct task_struct'
if (src->user_cpus_ptr)
~~~^
include/linux/compiler.h:56:47: note: expanded from macro 'if'
#define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
^~~~
include/linux/compiler.h:58:86: note: expanded from macro '__trace_if_var'
#define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
^~~~
include/linux/compiler.h:69:3: note: expanded from macro '__trace_if_value'
(cond) ? \
^~~~
include/linux/sched/affinity.h:8:8: note: forward declaration of 'struct task_struct'
struct task_struct;
^
include/linux/sched/affinity.h:38:11: error: incomplete definition of type 'struct task_struct'
WARN_ON(p->user_cpus_ptr);
~^
include/asm-generic/bug.h:121:25: note: expanded from macro 'WARN_ON'
int __ret_warn_on = !!(condition); \
^~~~~~~~~
include/linux/sched/affinity.h:8:8: note: forward declaration of 'struct task_struct'
struct task_struct;
^
4 errors generated.
--
>> kernel/sched/core.c:3571:9: error: implicit declaration of function 'set_cpus_allowed_ptr' [-Werror,-Wimplicit-function-declaration]
return set_cpus_allowed_ptr(p, new_mask);
^
kernel/sched/core.c:3571:9: note: did you mean '__set_cpus_allowed_ptr'?
kernel/sched/core.c:3567:19: note: '__set_cpus_allowed_ptr' declared here
static inline int __set_cpus_allowed_ptr(struct task_struct *p,
^
>> kernel/sched/core.c:8017:11: error: implicit declaration of function 'dl_task_check_affinity' [-Werror,-Wimplicit-function-declaration]
retval = dl_task_check_affinity(p, new_mask);
^
kernel/sched/core.c:9369:13: warning: no previous prototype for function 'per_task_init' [-Wmissing-prototypes]
void __init per_task_init(void)
^
kernel/sched/core.c:9369:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
void __init per_task_init(void)
^
static
1 warning and 2 errors generated.
--
In file included from arch/x86/kernel/cpu/resctrl/pseudo_lock.c:14:
>> include/linux/sched/affinity.h:32:9: error: incomplete definition of type 'struct task_struct'
if (src->user_cpus_ptr)
~~~^
include/linux/compiler.h:56:47: note: expanded from macro 'if'
#define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
^~~~
include/linux/compiler.h:58:52: note: expanded from macro '__trace_if_var'
#define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
^~~~
include/linux/sched/affinity.h:8:8: note: forward declaration of 'struct task_struct'
struct task_struct;
^
>> include/linux/sched/affinity.h:32:9: error: incomplete definition of type 'struct task_struct'
if (src->user_cpus_ptr)
~~~^
include/linux/compiler.h:56:47: note: expanded from macro 'if'
#define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
^~~~
include/linux/compiler.h:58:61: note: expanded from macro '__trace_if_var'
#define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
^~~~
include/linux/sched/affinity.h:8:8: note: forward declaration of 'struct task_struct'
struct task_struct;
^
>> include/linux/sched/affinity.h:32:9: error: incomplete definition of type 'struct task_struct'
if (src->user_cpus_ptr)
~~~^
include/linux/compiler.h:56:47: note: expanded from macro 'if'
#define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
^~~~
include/linux/compiler.h:58:86: note: expanded from macro '__trace_if_var'
#define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
^~~~
include/linux/compiler.h:69:3: note: expanded from macro '__trace_if_value'
(cond) ? \
^~~~
include/linux/sched/affinity.h:8:8: note: forward declaration of 'struct task_struct'
struct task_struct;
^
include/linux/sched/affinity.h:38:11: error: incomplete definition of type 'struct task_struct'
WARN_ON(p->user_cpus_ptr);
~^
include/asm-generic/bug.h:121:25: note: expanded from macro 'WARN_ON'
int __ret_warn_on = !!(condition); \
^~~~~~~~~
include/linux/sched/affinity.h:8:8: note: forward declaration of 'struct task_struct'
struct task_struct;
^
In file included from arch/x86/kernel/cpu/resctrl/pseudo_lock.c:20:
include/linux/mman.h:158:9: warning: division by zero is undefined [-Wdivision-by-zero]
_calc_vm_trans(flags, MAP_SYNC, VM_SYNC ) |
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/mman.h:136:21: note: expanded from macro '_calc_vm_trans'
: ((x) & (bit1)) / ((bit1) / (bit2))))
^ ~~~~~~~~~~~~~~~~~
1 warning and 4 errors generated.


vim +32 include/linux/sched/affinity.h

9
10 extern int cpuset_cpumask_can_shrink(const struct cpumask *cur, const struct cpumask *trial);
11 extern int task_can_attach(struct task_struct *p, const struct cpumask *cs_cpus_allowed);
12 #ifdef CONFIG_SMP
13 extern void do_set_cpus_allowed(struct task_struct *p, const struct cpumask *new_mask);
14 extern int set_cpus_allowed_ptr(struct task_struct *p, const struct cpumask *new_mask);
15 extern int dup_user_cpus_ptr(struct task_struct *dst, struct task_struct *src, int node);
16 extern void release_user_cpus_ptr(struct task_struct *p);
17 extern int dl_task_check_affinity(struct task_struct *p, const struct cpumask *mask);
18 extern void force_compatible_cpus_allowed_ptr(struct task_struct *p);
19 extern void relax_compatible_cpus_allowed_ptr(struct task_struct *p);
20 #else
21 static inline void do_set_cpus_allowed(struct task_struct *p, const struct cpumask *new_mask)
22 {
23 }
24 static inline int set_cpus_allowed_ptr(struct task_struct *p, const struct cpumask *new_mask)
25 {
26 if (!cpumask_test_cpu(0, new_mask))
27 return -EINVAL;
28 return 0;
29 }
30 static inline int dup_user_cpus_ptr(struct task_struct *dst, struct task_struct *src, int node)
31 {
> 32 if (src->user_cpus_ptr)
33 return -EINVAL;
34 return 0;
35 }
36 static inline void release_user_cpus_ptr(struct task_struct *p)
37 {
38 WARN_ON(p->user_cpus_ptr);
39 }
40

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