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

From: kbuild test robot
Date: Thu Jun 28 2018 - 17:09:22 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/20180629-031527
base: https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git master
config: arm-allmodconfig (attached as .config)
compiler: arm-linux-gnueabi-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=arm

All errors (new ones prefixed by >>):

In file included from kernel/bpf/local_storage.c:2:0:
>> include/linux/bpf-cgroup.h:23:24: error: unknown type name 'bpf_cgroup_storage'
DECLARE_PER_CPU(void*, bpf_cgroup_storage);
^~~~~~~~~~~~~~~~~~
include/linux/bpf-cgroup.h: In function 'bpf_cgroup_storage_set':
>> include/linux/bpf-cgroup.h:109:2: error: implicit declaration of function 'this_cpu_write'; did you mean 'init_cpu_online'? [-Werror=implicit-function-declaration]
this_cpu_write(bpf_cgroup_storage, &buf->data[0]);
^~~~~~~~~~~~~~
init_cpu_online
>> include/linux/bpf-cgroup.h:109:17: error: 'bpf_cgroup_storage' undeclared (first use in this function)
this_cpu_write(bpf_cgroup_storage, &buf->data[0]);
^~~~~~~~~~~~~~~~~~
include/linux/bpf-cgroup.h:109:17: note: each undeclared identifier is reported only once for each function it appears in
cc1: some warnings being treated as errors

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

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

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

Attachment: .config.gz
Description: application/gzip