Re: [PATCH bpf-next v2 2/6] bpf: Implement cgroup storage available to non-cgroup-attached bpf progs

Yonghong Song
2022-10-21T16:51:37Z

On 10/20/22 6:29 PM, kernel test robot wrote:
> Hi Yonghong,
>
> I love your patch! Yet something to improve:
>
> [auto build test ERROR on bpf-next/master]
>
> url: https://github.com/intel-lab-lkp/linux/commits/Yonghong-Song/bpf-Implement-cgroup-local-storage-available-to-non-cgroup-attached-bpf-progs/20221021-061520
> base: https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git master
> patch link: https://lore.kernel.org/r/20221020221306.3554250-1-yhs%40fb.com
> patch subject: [PATCH bpf-next v2 2/6] bpf: Implement cgroup storage available to non-cgroup-attached bpf progs
> config: mips-randconfig-r021-20221019
> compiler: mipsel-linux-gcc (GCC) 12.1.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/intel-lab-lkp/linux/commit/444d94c5601ec8650f49598c284571e1bc81a43d
> git remote add linux-review https://github.com/intel-lab-lkp/linux
> git fetch --no-tags linux-review Yonghong-Song/bpf-Implement-cgroup-local-storage-available-to-non-cgroup-attached-bpf-progs/20221021-061520
> git checkout 444d94c5601ec8650f49598c284571e1bc81a43d
> # save the config file
> mkdir build_dir && cp config build_dir/.config
> COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=mips SHELL=/bin/bash kernel/bpf/
>
> If you fix the issue, kindly add following tag where applicable
> | Reported-by: kernel test robot <lkp@intel.com>
>
> All errors (new ones prefixed by >>):
>
> kernel/bpf/bpf_cgrp_storage.c: In function 'cgroup_storage_ptr':
>>> kernel/bpf/bpf_cgrp_storage.c:43:19: error: 'struct cgroup' has no member named 'bpf_cgrp_storage'
> 43 | return &cg->bpf_cgrp_storage;

I used CONFIG_CGROUP_BPF to guard this field in cgroup-defs.h.
But it is possible that CONFIG_CGROUPS=y and CONFIG_BPF_SYSCALL=y, but
CONFIG_CGROUP_BPF=n.
I will change to guard the bpf_cgrp_storage field in cgroup-defs.h
with CONFIG_BPF_SYSCALL=y and it should fix the issue.

> | ^~
> In file included from include/linux/workqueue.h:16,
> from include/linux/bpf.h:10,
> from kernel/bpf/bpf_cgrp_storage.c:7:
> kernel/bpf/bpf_cgrp_storage.c: In function 'bpf_cgrp_storage_free':
> kernel/bpf/bpf_cgrp_storage.c:55:47: error: 'struct cgroup' has no member named 'bpf_cgrp_storage'
> 55 | local_storage = rcu_dereference(cgroup->bpf_cgrp_storage);
> | ^~
> include/linux/rcupdate.h:439:17: note: in definition of macro '__rcu_dereference_check'
> 439 | typeof(*p) *local = (typeof(*p) *__force)READ_ONCE(p); \
> | ^
> include/linux/rcupdate.h:659:28: note: in expansion of macro 'rcu_dereference_check'
> 659 | #define rcu_dereference(p) rcu_dereference_check(p, 0)
> | ^~~~~~~~~~~~~~~~~~~~~
> kernel/bpf/bpf_cgrp_storage.c:55:25: note: in expansion of macro 'rcu_dereference'
> 55 | local_storage = rcu_dereference(cgroup->bpf_cgrp_storage);
> | ^~~~~~~~~~~~~~~
> kernel/bpf/bpf_cgrp_storage.c:55:47: error: 'struct cgroup' has no member named 'bpf_cgrp_storage'
> 55 | local_storage = rcu_dereference(cgroup->bpf_cgrp_storage);
> | ^~
> include/linux/rcupdate.h:439:38: note: in definition of macro '__rcu_dereference_check'
> 439 | typeof(*p) *local = (typeof(*p) *__force)READ_ONCE(p); \
> | ^
> include/linux/rcupdate.h:659:28: note: in expansion of macro 'rcu_dereference_check'
> 659 | #define rcu_dereference(p) rcu_dereference_check(p, 0)
> | ^~~~~~~~~~~~~~~~~~~~~
> kernel/bpf/bpf_cgrp_storage.c:55:25: note: in expansion of macro 'rcu_dereference'
> 55 | local_storage = rcu_dereference(cgroup->bpf_cgrp_storage);
> | ^~~~~~~~~~~~~~~
> In file included from <command-line>:
> kernel/bpf/bpf_cgrp_storage.c:55:47: error: 'struct cgroup' has no member named 'bpf_cgrp_storage'
> 55 | local_storage = rcu_dereference(cgroup->bpf_cgrp_storage);
> | ^~
> include/linux/compiler_types.h:337:23: note: in definition of macro '__compiletime_assert'
> 337 | if (!(condition)) \
> | ^~~~~~~~~
> include/linux/compiler_types.h:357:9: note: in expansion of macro '_compiletime_assert'
> 357 | _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
> | ^~~~~~~~~~~~~~~~~~~
> include/asm-generic/rwonce.h:36:9: note: in expansion of macro 'compiletime_assert'
> 36 | compiletime_assert(__native_word(t) || sizeof(t) == sizeof(long long), \
> | ^~~~~~~~~~~~~~~~~~
> include/asm-generic/rwonce.h:36:28: note: in expansion of macro '__native_word'
> 36 | compiletime_assert(__native_word(t) || sizeof(t) == sizeof(long long), \
> | ^~~~~~~~~~~~~
> include/asm-generic/rwonce.h:49:9: note: in expansion of macro 'compiletime_assert_rwonce_type'
> 49 | compiletime_assert_rwonce_type(x); \
> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> include/linux/rcupdate.h:439:50: note: in expansion of macro 'READ_ONCE'
> 439 | typeof(*p) *local = (typeof(*p) *__force)READ_ONCE(p); \
> | ^~~~~~~~~
> include/linux/rcupdate.h:587:9: note: in expansion of macro '__rcu_dereference_check'
> 587 | __rcu_dereference_check((p), __UNIQUE_ID(rcu), \
> | ^~~~~~~~~~~~~~~~~~~~~~~
> include/linux/rcupdate.h:659:28: note: in expansion of macro 'rcu_dereference_check'
> 659 | #define rcu_dereference(p) rcu_dereference_check(p, 0)
> | ^~~~~~~~~~~~~~~~~~~~~
> kernel/bpf/bpf_cgrp_storage.c:55:25: note: in expansion of macro 'rcu_dereference'
> 55 | local_storage = rcu_dereference(cgroup->bpf_cgrp_storage);
> | ^~~~~~~~~~~~~~~
> kernel/bpf/bpf_cgrp_storage.c:55:47: error: 'struct cgroup' has no member named 'bpf_cgrp_storage'
> 55 | local_storage = rcu_dereference(cgroup->bpf_cgrp_storage);
> | ^~
> include/linux/compiler_types.h:337:23: note: in definition of macro '__compiletime_assert'
> 337 | if (!(condition)) \
> | ^~~~~~~~~
> include/linux/compiler_types.h:357:9: note: in expansion of macro '_compiletime_assert'
> 357 | _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
> | ^~~~~~~~~~~~~~~~~~~
> include/asm-generic/rwonce.h:36:9: note: in expansion of macro 'compiletime_assert'
> 36 | compiletime_assert(__native_word(t) || sizeof(t) == sizeof(long long), \
> | ^~~~~~~~~~~~~~~~~~
> include/asm-generic/rwonce.h:36:28: note: in expansion of macro '__native_word'
> 36 | compiletime_assert(__native_word(t) || sizeof(t) == sizeof(long long), \
> | ^~~~~~~~~~~~~
> include/asm-generic/rwonce.h:49:9: note: in expansion of macro 'compiletime_assert_rwonce_type'
> 49 | compiletime_assert_rwonce_type(x); \
> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> include/linux/rcupdate.h:439:50: note: in expansion of macro 'READ_ONCE'
> 439 | typeof(*p) *local = (typeof(*p) *__force)READ_ONCE(p); \
> | ^~~~~~~~~
> include/linux/rcupdate.h:587:9: note: in expansion of macro '__rcu_dereference_check'
> 587 | __rcu_dereference_check((p), __UNIQUE_ID(rcu), \
> | ^~~~~~~~~~~~~~~~~~~~~~~
> include/linux/rcupdate.h:659:28: note: in expansion of macro 'rcu_dereference_check'
> 659 | #define rcu_dereference(p) rcu_dereference_check(p, 0)
> | ^~~~~~~~~~~~~~~~~~~~~
> kernel/bpf/bpf_cgrp_storage.c:55:25: note: in expansion of macro 'rcu_dereference'
> 55 | local_storage = rcu_dereference(cgroup->bpf_cgrp_storage);
> | ^~~~~~~~~~~~~~~
> kernel/bpf/bpf_cgrp_storage.c:55:47: error: 'struct cgroup' has no member named 'bpf_cgrp_storage'
> 55 | local_storage = rcu_dereference(cgroup->bpf_cgrp_storage);
> | ^~
> include/linux/compiler_types.h:337:23: note: in definition of macro '__compiletime_assert'
> 337 | if (!(condition)) \
> | ^~~~~~~~~
> include/linux/compiler_types.h:357:9: note: in expansion of macro '_compiletime_assert'
> 357 | _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
> | ^~~~~~~~~~~~~~~~~~~
>
>
> vim +43 kernel/bpf/bpf_cgrp_storage.c
>
> 38
> 39 static struct bpf_local_storage __rcu **cgroup_storage_ptr(void *owner)
> 40 {
> 41 struct cgroup *cg = owner;
> 42
> > 43 return &cg->bpf_cgrp_storage;
> 44 }
> 45
>