Re: [PATCH v2 bpf-next 03/14] bpf: pass a pointer to a cgroup storage using pcpu variable

From: kbuild test robot
Date: Fri Jul 06 2018 - 03:51:13 EST


Hi Roman,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on bpf-next/master]

url: https://github.com/0day-ci/linux/commits/Roman-Gushchin/bpf-cgroup-local-storage/20180706-055938
base: https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git master
config: powerpc-defconfig (attached as .config)
compiler: powerpc64-linux-gnu-gcc (Debian 7.2.0-11) 7.2.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
GCC_VERSION=7.2.0 make.cross ARCH=powerpc

All errors (new ones prefixed by >>):

In file included from include/linux/bpf-cgroup.h:6:0,
from kernel/bpf/local_storage.c:2:
include/linux/percpu-defs.h:49:34: error: 'PER_CPU_BASE_SECTION' undeclared here (not in a function); did you mean 'PER_CPU_FIRST_SECTION'?
__percpu __attribute__((section(PER_CPU_BASE_SECTION sec))) \
^
include/linux/percpu-defs.h:101:9: note: in expansion of macro '__PCPU_ATTRS'
extern __PCPU_ATTRS(sec) __typeof__(type) name
^~~~~~~~~~~~
include/linux/percpu-defs.h:113:2: note: in expansion of macro 'DECLARE_PER_CPU_SECTION'
DECLARE_PER_CPU_SECTION(type, name, "")
^~~~~~~~~~~~~~~~~~~~~~~
include/linux/bpf-cgroup.h:24:1: note: in expansion of macro 'DECLARE_PER_CPU'
DECLARE_PER_CPU(void*, bpf_cgroup_storage);
^~~~~~~~~~~~~~~
include/linux/percpu-defs.h:113:38: error: expected ')' before string constant
DECLARE_PER_CPU_SECTION(type, name, "")
^
include/linux/percpu-defs.h:49:55: note: in definition of macro '__PCPU_ATTRS'
__percpu __attribute__((section(PER_CPU_BASE_SECTION sec))) \
^~~
include/linux/percpu-defs.h:113:2: note: in expansion of macro 'DECLARE_PER_CPU_SECTION'
DECLARE_PER_CPU_SECTION(type, name, "")
^~~~~~~~~~~~~~~~~~~~~~~
include/linux/bpf-cgroup.h:24:1: note: in expansion of macro 'DECLARE_PER_CPU'
DECLARE_PER_CPU(void*, bpf_cgroup_storage);
^~~~~~~~~~~~~~~
include/linux/percpu-defs.h:49:59: error: expected identifier or '(' before ')' token
__percpu __attribute__((section(PER_CPU_BASE_SECTION sec))) \
^
include/linux/percpu-defs.h:101:9: note: in expansion of macro '__PCPU_ATTRS'
extern __PCPU_ATTRS(sec) __typeof__(type) name
^~~~~~~~~~~~
include/linux/percpu-defs.h:113:2: note: in expansion of macro 'DECLARE_PER_CPU_SECTION'
DECLARE_PER_CPU_SECTION(type, name, "")
^~~~~~~~~~~~~~~~~~~~~~~
include/linux/bpf-cgroup.h:24:1: note: in expansion of macro 'DECLARE_PER_CPU'
DECLARE_PER_CPU(void*, bpf_cgroup_storage);
^~~~~~~~~~~~~~~
include/linux/bpf-cgroup.h: In function 'bpf_cgroup_storage_set':
>> include/linux/bpf-cgroup.h:110:17: error: 'bpf_cgroup_storage' undeclared (first use in this function)
this_cpu_write(bpf_cgroup_storage, &buf->data[0]);
^
include/linux/percpu-defs.h:221:47: note: in definition of macro '__verify_pcpu_ptr'
const void __percpu *__vpp_verify = (typeof((ptr) + 0))NULL; \
^~~
include/linux/percpu-defs.h:510:34: note: in expansion of macro '__pcpu_size_call'
#define this_cpu_write(pcp, val) __pcpu_size_call(this_cpu_write_, pcp, val)
^~~~~~~~~~~~~~~~
include/linux/bpf-cgroup.h:110:2: note: in expansion of macro 'this_cpu_write'
this_cpu_write(bpf_cgroup_storage, &buf->data[0]);
^~~~~~~~~~~~~~
include/linux/bpf-cgroup.h:110:17: note: each undeclared identifier is reported only once for each function it appears in
this_cpu_write(bpf_cgroup_storage, &buf->data[0]);
^
include/linux/percpu-defs.h:221:47: note: in definition of macro '__verify_pcpu_ptr'
const void __percpu *__vpp_verify = (typeof((ptr) + 0))NULL; \
^~~
include/linux/percpu-defs.h:510:34: note: in expansion of macro '__pcpu_size_call'
#define this_cpu_write(pcp, val) __pcpu_size_call(this_cpu_write_, pcp, val)
^~~~~~~~~~~~~~~~
include/linux/bpf-cgroup.h:110:2: note: in expansion of macro 'this_cpu_write'
this_cpu_write(bpf_cgroup_storage, &buf->data[0]);
^~~~~~~~~~~~~~
include/linux/percpu-defs.h:510:51: error: implicit declaration of function 'this_cpu_write_1'; did you mean 'this_cpu_write'? [-Werror=implicit-function-declaration]
#define this_cpu_write(pcp, val) __pcpu_size_call(this_cpu_write_, pcp, val)
^
include/linux/percpu-defs.h:379:11: note: in definition of macro '__pcpu_size_call'
case 1: stem##1(variable, __VA_ARGS__);break; \
^~~~
include/linux/bpf-cgroup.h:110:2: note: in expansion of macro 'this_cpu_write'
this_cpu_write(bpf_cgroup_storage, &buf->data[0]);
^~~~~~~~~~~~~~
include/linux/percpu-defs.h:510:51: error: implicit declaration of function 'this_cpu_write_2'; did you mean 'this_cpu_write'? [-Werror=implicit-function-declaration]
#define this_cpu_write(pcp, val) __pcpu_size_call(this_cpu_write_, pcp, val)
^
include/linux/percpu-defs.h:380:11: note: in definition of macro '__pcpu_size_call'
case 2: stem##2(variable, __VA_ARGS__);break; \
^~~~
include/linux/bpf-cgroup.h:110:2: note: in expansion of macro 'this_cpu_write'
this_cpu_write(bpf_cgroup_storage, &buf->data[0]);
^~~~~~~~~~~~~~
include/linux/percpu-defs.h:510:51: error: implicit declaration of function 'this_cpu_write_4'; did you mean 'this_cpu_write'? [-Werror=implicit-function-declaration]
#define this_cpu_write(pcp, val) __pcpu_size_call(this_cpu_write_, pcp, val)
^
include/linux/percpu-defs.h:381:11: note: in definition of macro '__pcpu_size_call'
case 4: stem##4(variable, __VA_ARGS__);break; \
^~~~
include/linux/bpf-cgroup.h:110:2: note: in expansion of macro 'this_cpu_write'
this_cpu_write(bpf_cgroup_storage, &buf->data[0]);
^~~~~~~~~~~~~~
include/linux/percpu-defs.h:510:51: error: implicit declaration of function 'this_cpu_write_8'; did you mean 'this_cpu_write'? [-Werror=implicit-function-declaration]
#define this_cpu_write(pcp, val) __pcpu_size_call(this_cpu_write_, pcp, val)
^
include/linux/percpu-defs.h:382:11: note: in definition of macro '__pcpu_size_call'
case 8: stem##8(variable, __VA_ARGS__);break; \
^~~~
include/linux/bpf-cgroup.h:110:2: note: in expansion of macro 'this_cpu_write'
this_cpu_write(bpf_cgroup_storage, &buf->data[0]);
^~~~~~~~~~~~~~
cc1: some warnings being treated as errors

vim +/bpf_cgroup_storage +110 include/linux/bpf-cgroup.h

23
> 24 DECLARE_PER_CPU(void*, bpf_cgroup_storage);
25
26 struct bpf_cgroup_storage_map;
27
28 struct bpf_storage_buffer {
29 struct rcu_head rcu;
30 char data[0];
31 };
32
33 struct bpf_cgroup_storage {
34 struct bpf_storage_buffer *buf;
35 struct bpf_cgroup_storage_map *map;
36 struct bpf_cgroup_storage_key key;
37 struct list_head list;
38 struct rb_node node;
39 struct rcu_head rcu;
40 };
41
42 struct bpf_prog_list {
43 struct list_head node;
44 struct bpf_prog *prog;
45 };
46
47 struct bpf_prog_array;
48
49 struct cgroup_bpf {
50 /* array of effective progs in this cgroup */
51 struct bpf_prog_array __rcu *effective[MAX_BPF_ATTACH_TYPE];
52
53 /* attached progs to this cgroup and attach flags
54 * when flags == 0 or BPF_F_ALLOW_OVERRIDE the progs list will
55 * have either zero or one element
56 * when BPF_F_ALLOW_MULTI the list can have up to BPF_CGROUP_MAX_PROGS
57 */
58 struct list_head progs[MAX_BPF_ATTACH_TYPE];
59 u32 flags[MAX_BPF_ATTACH_TYPE];
60
61 /* temp storage for effective prog array used by prog_attach/detach */
62 struct bpf_prog_array __rcu *inactive;
63 };
64
65 void cgroup_bpf_put(struct cgroup *cgrp);
66 int cgroup_bpf_inherit(struct cgroup *cgrp);
67
68 int __cgroup_bpf_attach(struct cgroup *cgrp, struct bpf_prog *prog,
69 enum bpf_attach_type type, u32 flags);
70 int __cgroup_bpf_detach(struct cgroup *cgrp, struct bpf_prog *prog,
71 enum bpf_attach_type type, u32 flags);
72 int __cgroup_bpf_query(struct cgroup *cgrp, const union bpf_attr *attr,
73 union bpf_attr __user *uattr);
74
75 /* Wrapper for __cgroup_bpf_*() protected by cgroup_mutex */
76 int cgroup_bpf_attach(struct cgroup *cgrp, struct bpf_prog *prog,
77 enum bpf_attach_type type, u32 flags);
78 int cgroup_bpf_detach(struct cgroup *cgrp, struct bpf_prog *prog,
79 enum bpf_attach_type type, u32 flags);
80 int cgroup_bpf_query(struct cgroup *cgrp, const union bpf_attr *attr,
81 union bpf_attr __user *uattr);
82
83 int __cgroup_bpf_run_filter_skb(struct sock *sk,
84 struct sk_buff *skb,
85 enum bpf_attach_type type);
86
87 int __cgroup_bpf_run_filter_sk(struct sock *sk,
88 enum bpf_attach_type type);
89
90 int __cgroup_bpf_run_filter_sock_addr(struct sock *sk,
91 struct sockaddr *uaddr,
92 enum bpf_attach_type type,
93 void *t_ctx);
94
95 int __cgroup_bpf_run_filter_sock_ops(struct sock *sk,
96 struct bpf_sock_ops_kern *sock_ops,
97 enum bpf_attach_type type);
98
99 int __cgroup_bpf_check_dev_permission(short dev_type, u32 major, u32 minor,
100 short access, enum bpf_attach_type type);
101
102 static inline void bpf_cgroup_storage_set(struct bpf_cgroup_storage *storage)
103 {
104 struct bpf_storage_buffer *buf;
105
106 if (!storage)
107 return;
108
109 buf = rcu_dereference(storage->buf);
> 110 this_cpu_write(bpf_cgroup_storage, &buf->data[0]);
111 }
112

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation

Attachment: .config.gz
Description: application/gzip