[congwang:sch_bpf 2/2] include/linux/rcupdate.h:389:9: error: invalid type argument of unary '*' (have 'struct sch_bpf_prog')

From: kernel test robot
Date: Thu Aug 12 2021 - 09:44:01 EST


tree: https://github.com/congwang/linux.git sch_bpf
head: aa61f170d88b706060a1977b7b7bef9d08e33ff1
commit: aa61f170d88b706060a1977b7b7bef9d08e33ff1 [2/2] sch_bpf: draft
config: arm-randconfig-r015-20210812 (attached as .config)
compiler: arm-linux-gnueabi-gcc (GCC) 10.3.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://github.com/congwang/linux/commit/aa61f170d88b706060a1977b7b7bef9d08e33ff1
git remote add congwang https://github.com/congwang/linux.git
git fetch --no-tags congwang sch_bpf
git checkout aa61f170d88b706060a1977b7b7bef9d08e33ff1
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-10.3.0 make.cross ARCH=arm

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

All error/warnings (new ones prefixed by >>):

In file included from include/linux/rbtree.h:22,
from include/linux/mm_types.h:10,
from include/linux/buildid.h:5,
from include/linux/module.h:14,
from net/sched/sch_bpf.c:7:
net/sched/sch_bpf.c: In function 'sch_bpf_enqueue':
>> include/linux/rcupdate.h:389:9: error: invalid type argument of unary '*' (have 'struct sch_bpf_prog')
389 | typeof(*p) *________p1 = (typeof(*p) *__force)READ_ONCE(p); \
| ^
include/linux/rcupdate.h:528:2: note: in expansion of macro '__rcu_dereference_check'
528 | __rcu_dereference_check((p), (c) || rcu_read_lock_held(), __rcu)
| ^~~~~~~~~~~~~~~~~~~~~~~
include/linux/rcupdate.h:596:28: note: in expansion of macro 'rcu_dereference_check'
596 | #define rcu_dereference(p) rcu_dereference_check(p, 0)
| ^~~~~~~~~~~~~~~~~~~~~
net/sched/sch_bpf.c:174:13: note: in expansion of macro 'rcu_dereference'
174 | enqueue = rcu_dereference(q->enqueue_prog);
| ^~~~~~~~~~~~~~~
include/linux/rcupdate.h:389:35: error: invalid type argument of unary '*' (have 'struct sch_bpf_prog')
389 | typeof(*p) *________p1 = (typeof(*p) *__force)READ_ONCE(p); \
| ^
include/linux/rcupdate.h:528:2: note: in expansion of macro '__rcu_dereference_check'
528 | __rcu_dereference_check((p), (c) || rcu_read_lock_held(), __rcu)
| ^~~~~~~~~~~~~~~~~~~~~~~
include/linux/rcupdate.h:596:28: note: in expansion of macro 'rcu_dereference_check'
596 | #define rcu_dereference(p) rcu_dereference_check(p, 0)
| ^~~~~~~~~~~~~~~~~~~~~
net/sched/sch_bpf.c:174:13: note: in expansion of macro 'rcu_dereference'
174 | enqueue = rcu_dereference(q->enqueue_prog);
| ^~~~~~~~~~~~~~~
include/linux/rcupdate.h:392:11: error: invalid type argument of unary '*' (have 'struct sch_bpf_prog')
392 | ((typeof(*p) __force __kernel *)(________p1)); \
| ^
include/linux/rcupdate.h:528:2: note: in expansion of macro '__rcu_dereference_check'
528 | __rcu_dereference_check((p), (c) || rcu_read_lock_held(), __rcu)
| ^~~~~~~~~~~~~~~~~~~~~~~
include/linux/rcupdate.h:596:28: note: in expansion of macro 'rcu_dereference_check'
596 | #define rcu_dereference(p) rcu_dereference_check(p, 0)
| ^~~~~~~~~~~~~~~~~~~~~
net/sched/sch_bpf.c:174:13: note: in expansion of macro 'rcu_dereference'
174 | enqueue = rcu_dereference(q->enqueue_prog);
| ^~~~~~~~~~~~~~~
net/sched/sch_bpf.c: In function 'sch_bpf_dequeue':
>> include/linux/rcupdate.h:389:9: error: invalid type argument of unary '*' (have 'struct sch_bpf_prog')
389 | typeof(*p) *________p1 = (typeof(*p) *__force)READ_ONCE(p); \
| ^
include/linux/rcupdate.h:528:2: note: in expansion of macro '__rcu_dereference_check'
528 | __rcu_dereference_check((p), (c) || rcu_read_lock_held(), __rcu)
| ^~~~~~~~~~~~~~~~~~~~~~~
include/linux/rcupdate.h:596:28: note: in expansion of macro 'rcu_dereference_check'
596 | #define rcu_dereference(p) rcu_dereference_check(p, 0)
| ^~~~~~~~~~~~~~~~~~~~~
net/sched/sch_bpf.c:219:12: note: in expansion of macro 'rcu_dereference'
219 | dequeue = rcu_dereference(q->dequeue_prog);
| ^~~~~~~~~~~~~~~
include/linux/rcupdate.h:389:35: error: invalid type argument of unary '*' (have 'struct sch_bpf_prog')
389 | typeof(*p) *________p1 = (typeof(*p) *__force)READ_ONCE(p); \
| ^
include/linux/rcupdate.h:528:2: note: in expansion of macro '__rcu_dereference_check'
528 | __rcu_dereference_check((p), (c) || rcu_read_lock_held(), __rcu)
| ^~~~~~~~~~~~~~~~~~~~~~~
include/linux/rcupdate.h:596:28: note: in expansion of macro 'rcu_dereference_check'
596 | #define rcu_dereference(p) rcu_dereference_check(p, 0)
| ^~~~~~~~~~~~~~~~~~~~~
net/sched/sch_bpf.c:219:12: note: in expansion of macro 'rcu_dereference'
219 | dequeue = rcu_dereference(q->dequeue_prog);
| ^~~~~~~~~~~~~~~
include/linux/rcupdate.h:392:11: error: invalid type argument of unary '*' (have 'struct sch_bpf_prog')
392 | ((typeof(*p) __force __kernel *)(________p1)); \
| ^
include/linux/rcupdate.h:528:2: note: in expansion of macro '__rcu_dereference_check'
528 | __rcu_dereference_check((p), (c) || rcu_read_lock_held(), __rcu)
| ^~~~~~~~~~~~~~~~~~~~~~~
include/linux/rcupdate.h:596:28: note: in expansion of macro 'rcu_dereference_check'
596 | #define rcu_dereference(p) rcu_dereference_check(p, 0)
| ^~~~~~~~~~~~~~~~~~~~~
net/sched/sch_bpf.c:219:12: note: in expansion of macro 'rcu_dereference'
219 | dequeue = rcu_dereference(q->dequeue_prog);
| ^~~~~~~~~~~~~~~
>> net/sched/sch_bpf.c:220:28: error: 'skb' undeclared (first use in this function)
220 | bpf_compute_data_pointers(skb);
| ^~~
net/sched/sch_bpf.c:220:28: note: each undeclared identifier is reported only once for each function it appears in
>> net/sched/sch_bpf.c:231:11: error: assignment to 'struct sk_buff *' from incompatible pointer type 'struct pq_node *' [-Werror=incompatible-pointer-types]
231 | ctx.skb = pq_pop(&cl->pq);
| ^
>> net/sched/sch_bpf.c:237:13: error: 'SCH_BPF_RET_OK' undeclared (first use in this function)
237 | if (res == SCH_BPF_RET_OK) {
| ^~~~~~~~~~~~~~
>> net/sched/sch_bpf.c:239:20: error: 'SCH_BPF_RET_REQUEUE' undeclared (first use in this function)
239 | } else if (res == SCH_BPF_RET_REQUEUE) {
| ^~~~~~~~~~~~~~~~~~~
net/sched/sch_bpf.c: In function 'sch_bpf_search':
>> net/sched/sch_bpf.c:284:37: warning: passing argument 1 of 'sch_bpf_find' makes pointer from integer without a cast [-Wint-conversion]
284 | return (unsigned long)sch_bpf_find(handle, sch);
| ^~~~~~
| |
| u32 {aka unsigned int}
net/sched/sch_bpf.c:115:57: note: expected 'struct Qdisc *' but argument is of type 'u32' {aka 'unsigned int'}
115 | static struct sch_bpf_class *sch_bpf_find(struct Qdisc *sch, u32 classid)
| ~~~~~~~~~~~~~~^~~
>> net/sched/sch_bpf.c:284:45: warning: passing argument 2 of 'sch_bpf_find' makes integer from pointer without a cast [-Wint-conversion]
284 | return (unsigned long)sch_bpf_find(handle, sch);
| ^~~
| |
| struct Qdisc *
net/sched/sch_bpf.c:115:66: note: expected 'u32' {aka 'unsigned int'} but argument is of type 'struct Qdisc *'
115 | static struct sch_bpf_class *sch_bpf_find(struct Qdisc *sch, u32 classid)
| ~~~~^~~~~~~
net/sched/sch_bpf.c: At top level:
>> net/sched/sch_bpf.c:298:3: error: 'TCA_SCH_BPF_ENQUEUE_PROG_FD' undeclared here (not in a function); did you mean 'TCA_SCH_BPF_ENQUEUE_PROG_ID'?
298 | [TCA_SCH_BPF_ENQUEUE_PROG_FD] = { .type = NLA_U32 },
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~
| TCA_SCH_BPF_ENQUEUE_PROG_ID
>> net/sched/sch_bpf.c:298:3: error: array index in initializer not of integer type
net/sched/sch_bpf.c:298:3: note: (near initialization for 'sch_bpf_policy')
>> net/sched/sch_bpf.c:301:3: error: 'TCA_SCH_BPF_DEQUEUE_PROG_FD' undeclared here (not in a function); did you mean 'TCA_SCH_BPF_DEQUEUE_PROG_ID'?
301 | [TCA_SCH_BPF_DEQUEUE_PROG_FD] = { .type = NLA_U32 },
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~
| TCA_SCH_BPF_DEQUEUE_PROG_ID
net/sched/sch_bpf.c:301:3: error: array index in initializer not of integer type
net/sched/sch_bpf.c:301:3: note: (near initialization for 'sch_bpf_policy')
net/sched/sch_bpf.c: In function 'bpf_init_prog':
>> net/sched/sch_bpf.c:314:33: error: 'BPF_PROG_TYPE_SCHED_SCH' undeclared (first use in this function); did you mean 'BPF_PROG_TYPE_SCHED_ACT'?
314 | fp = bpf_prog_get_type(bpf_fd, BPF_PROG_TYPE_SCHED_SCH);
| ^~~~~~~~~~~~~~~~~~~~~~~
| BPF_PROG_TYPE_SCHED_ACT
net/sched/sch_bpf.c: At top level:
net/sched/sch_bpf.c:331:8: error: return type defaults to 'int' [-Werror=return-type]
331 | static bpf_cleanup_prog(struct sch_bpf_prog *prog)
| ^~~~~~~~~~~~~~~~
net/sched/sch_bpf.c: In function 'sch_bpf_change':
>> net/sched/sch_bpf.c:354:11: error: incompatible type for argument 2 of 'bpf_init_prog'
354 | opt[TCA_SCH_BPF_ENQUEUE_PROG_NAME], &q->enqueue_prog);
| ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| |
| struct nlattr
net/sched/sch_bpf.c:306:60: note: expected 'struct nlattr *' but argument is of type 'struct nlattr'
306 | static int bpf_init_prog(struct nlattr *fd, struct nlattr *name, struct sch_bpf_prog *prog)
| ~~~~~~~~~~~~~~~^~~~
net/sched/sch_bpf.c:358:11: error: incompatible type for argument 2 of 'bpf_init_prog'
358 | opt[TCA_SCH_BPF_DEQUEUE_PROG_NAME], &q->dequeue_prog);
| ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| |
| struct nlattr
net/sched/sch_bpf.c:306:60: note: expected 'struct nlattr *' but argument is of type 'struct nlattr'
306 | static int bpf_init_prog(struct nlattr *fd, struct nlattr *name, struct sch_bpf_prog *prog)
| ~~~~~~~~~~~~~~~^~~~
net/sched/sch_bpf.c:343:6: warning: unused variable 'gen_flags' [-Wunused-variable]
343 | u32 gen_flags = 0;
| ^~~~~~~~~
net/sched/sch_bpf.c: In function 'sch_bpf_init':
>> net/sched/sch_bpf.c:388:3: error: 'err' undeclared (first use in this function)
388 | err = sch_bpf_change(sch, opt, extack);
| ^~~
net/sched/sch_bpf.c: In function 'sch_bpf_change_class':
net/sched/sch_bpf.c:428:3: error: 'err' undeclared (first use in this function)
428 | err = -ENOBUFS;
| ^~~
>> net/sched/sch_bpf.c:431:4: error: label 'failure' used but not defined
431 | goto failure;
| ^~~~
net/sched/sch_bpf.c:424:60: warning: unused variable 'parent' [-Wunused-variable]
424 | struct sch_bpf_class *cl = (struct sch_bpf_class *)*arg, *parent;
| ^~~~~~
net/sched/sch_bpf.c: In function 'sch_bpf_delete':
net/sched/sch_bpf.c:450:1: error: no return statement in function returning non-void [-Werror=return-type]
450 | }
| ^
net/sched/sch_bpf.c: At top level:
>> net/sched/sch_bpf.c:481:13: error: initialization of 'int (*)(struct Qdisc *, long unsigned int, struct netlink_ext_ack *)' from incompatible pointer type 'int (*)(struct Qdisc *, long unsigned int)' [-Werror=incompatible-pointer-types]
481 | .delete = sch_bpf_delete,
| ^~~~~~~~~~~~~~
net/sched/sch_bpf.c:481:13: note: (near initialization for 'sch_bpf_class_ops.delete')
>> net/sched/sch_bpf.c:485:11: error: 'sch_bpf_dump_class' undeclared here (not in a function); did you mean 'sch_bpf_dump_prog'?
485 | .dump = sch_bpf_dump_class,
| ^~~~~~~~~~~~~~~~~~
| sch_bpf_dump_prog
>> net/sched/sch_bpf.c:486:16: error: 'sch_bpf_dump_class_stats' undeclared here (not in a function)
486 | .dump_stats = sch_bpf_dump_class_stats,
| ^~~~~~~~~~~~~~~~~~~~~~~~
>> net/sched/sch_bpf.c:498:12: error: 'sch_bpf_reset' undeclared here (not in a function); did you mean 'sch_bpf_delete'?
498 | .reset = sch_bpf_reset,
| ^~~~~~~~~~~~~
| sch_bpf_delete
>> net/sched/sch_bpf.c:502:16: error: 'sch_bpf_dump_stats' undeclared here (not in a function); did you mean 'sch_bpf_dump_prog'?
502 | .dump_stats = sch_bpf_dump_stats,
| ^~~~~~~~~~~~~~~~~~
| sch_bpf_dump_prog
net/sched/sch_bpf.c:506:19: error: conflicting types for 'sch_bpf_init'
506 | static int __init sch_bpf_init(void)
| ^~~~~~~~~~~~
net/sched/sch_bpf.c:382:12: note: previous definition of 'sch_bpf_init' was here
382 | static int sch_bpf_init(struct Qdisc *sch, struct nlattr *opt,
| ^~~~~~~~~~~~
cc1: some warnings being treated as errors


vim +389 include/linux/rcupdate.h

76c8eaafe4f061 Paul E. McKenney 2021-04-21 379
ca5ecddfa8fcbd Paul E. McKenney 2010-04-28 380 #define __rcu_access_pointer(p, space) \
ca5ecddfa8fcbd Paul E. McKenney 2010-04-28 381 ({ \
7d0ae8086b8283 Paul E. McKenney 2015-03-03 382 typeof(*p) *_________p1 = (typeof(*p) *__force)READ_ONCE(p); \
423a86a610cad1 Joel Fernandes (Google 2018-12-12 383) rcu_check_sparse(p, space); \
ca5ecddfa8fcbd Paul E. McKenney 2010-04-28 384 ((typeof(*p) __force __kernel *)(_________p1)); \
ca5ecddfa8fcbd Paul E. McKenney 2010-04-28 385 })
ca5ecddfa8fcbd Paul E. McKenney 2010-04-28 386 #define __rcu_dereference_check(p, c, space) \
ca5ecddfa8fcbd Paul E. McKenney 2010-04-28 387 ({ \
ac59853c06993a Pranith Kumar 2014-11-13 388 /* Dependency order vs. p above. */ \
506458efaf153c Will Deacon 2017-10-24 @389 typeof(*p) *________p1 = (typeof(*p) *__force)READ_ONCE(p); \
f78f5b90c4ffa5 Paul E. McKenney 2015-06-18 390 RCU_LOCKDEP_WARN(!(c), "suspicious rcu_dereference_check() usage"); \
423a86a610cad1 Joel Fernandes (Google 2018-12-12 391) rcu_check_sparse(p, space); \
ac59853c06993a Pranith Kumar 2014-11-13 392 ((typeof(*p) __force __kernel *)(________p1)); \
ca5ecddfa8fcbd Paul E. McKenney 2010-04-28 393 })
ca5ecddfa8fcbd Paul E. McKenney 2010-04-28 394 #define __rcu_dereference_protected(p, c, space) \
ca5ecddfa8fcbd Paul E. McKenney 2010-04-28 395 ({ \
f78f5b90c4ffa5 Paul E. McKenney 2015-06-18 396 RCU_LOCKDEP_WARN(!(c), "suspicious rcu_dereference_protected() usage"); \
423a86a610cad1 Joel Fernandes (Google 2018-12-12 397) rcu_check_sparse(p, space); \
ca5ecddfa8fcbd Paul E. McKenney 2010-04-28 398 ((typeof(*p) __force __kernel *)(p)); \
ca5ecddfa8fcbd Paul E. McKenney 2010-04-28 399 })
995f1405610bd8 Paul E. McKenney 2016-07-01 400 #define rcu_dereference_raw(p) \
995f1405610bd8 Paul E. McKenney 2016-07-01 401 ({ \
995f1405610bd8 Paul E. McKenney 2016-07-01 402 /* Dependency order vs. p above. */ \
506458efaf153c Will Deacon 2017-10-24 403 typeof(p) ________p1 = READ_ONCE(p); \
995f1405610bd8 Paul E. McKenney 2016-07-01 404 ((typeof(*p) __force __kernel *)(________p1)); \
995f1405610bd8 Paul E. McKenney 2016-07-01 405 })
ca5ecddfa8fcbd Paul E. McKenney 2010-04-28 406

:::::: The code at line 389 was first introduced by commit
:::::: 506458efaf153c1ea480591c5602a5a3ba5a3b76 locking/barriers: Convert users of lockless_dereference() to READ_ONCE()

:::::: TO: Will Deacon <will.deacon@xxxxxxx>
:::::: CC: Ingo Molnar <mingo@xxxxxxxxxx>

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

Attachment: .config.gz
Description: application/gzip