Re: [PATCH bpf-next v4 4/8] bpf: Introduce css open-coded iterator kfuncs

From: kernel test robot
Date: Sat Oct 07 2023 - 12:06:19 EST


Hi Chuyi,

kernel test robot noticed the following build warnings:

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

url: https://github.com/intel-lab-lkp/linux/commits/Chuyi-Zhou/cgroup-Prepare-for-using-css_task_iter_-in-BPF/20231007-204750
base: https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git master
patch link: https://lore.kernel.org/r/20231007124522.34834-5-zhouchuyi%40bytedance.com
patch subject: [PATCH bpf-next v4 4/8] bpf: Introduce css open-coded iterator kfuncs
config: m68k-allyesconfig (https://download.01.org/0day-ci/archive/20231007/202310072337.CzRlbffm-lkp@xxxxxxxxx/config)
compiler: m68k-linux-gcc (GCC) 13.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20231007/202310072337.CzRlbffm-lkp@xxxxxxxxx/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@xxxxxxxxx>
| Closes: https://lore.kernel.org/oe-kbuild-all/202310072337.CzRlbffm-lkp@xxxxxxxxx/

All warnings (new ones prefixed by >>):

>> kernel/bpf/cgroup_iter.c:308:17: warning: no previous prototype for 'bpf_iter_css_new' [-Wmissing-prototypes]
308 | __bpf_kfunc int bpf_iter_css_new(struct bpf_iter_css *it,
| ^~~~~~~~~~~~~~~~
>> kernel/bpf/cgroup_iter.c:332:41: warning: no previous prototype for 'bpf_iter_css_next' [-Wmissing-prototypes]
332 | __bpf_kfunc struct cgroup_subsys_state *bpf_iter_css_next(struct bpf_iter_css *it)
| ^~~~~~~~~~~~~~~~~
>> kernel/bpf/cgroup_iter.c:353:18: warning: no previous prototype for 'bpf_iter_css_destroy' [-Wmissing-prototypes]
353 | __bpf_kfunc void bpf_iter_css_destroy(struct bpf_iter_css *it)
| ^~~~~~~~~~~~~~~~~~~~
In file included from <command-line>:
kernel/bpf/cgroup_iter.c: In function 'bpf_iter_css_new':
include/linux/compiler_types.h:425:45: error: call to '__compiletime_assert_320' declared with attribute error: BUILD_BUG_ON failed: sizeof(struct bpf_iter_css_kern) != sizeof(struct bpf_iter_css)
425 | _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
| ^
include/linux/compiler_types.h:406:25: note: in definition of macro '__compiletime_assert'
406 | prefix ## suffix(); \
| ^~~~~~
include/linux/compiler_types.h:425:9: note: in expansion of macro '_compiletime_assert'
425 | _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
| ^~~~~~~~~~~~~~~~~~~
include/linux/build_bug.h:39:37: note: in expansion of macro 'compiletime_assert'
39 | #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
| ^~~~~~~~~~~~~~~~~~
include/linux/build_bug.h:50:9: note: in expansion of macro 'BUILD_BUG_ON_MSG'
50 | BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: " #condition)
| ^~~~~~~~~~~~~~~~
kernel/bpf/cgroup_iter.c:313:9: note: in expansion of macro 'BUILD_BUG_ON'
313 | BUILD_BUG_ON(sizeof(struct bpf_iter_css_kern) != sizeof(struct bpf_iter_css));
| ^~~~~~~~~~~~


vim +/bpf_iter_css_new +308 kernel/bpf/cgroup_iter.c

307
> 308 __bpf_kfunc int bpf_iter_css_new(struct bpf_iter_css *it,
309 struct cgroup_subsys_state *start, unsigned int flags)
310 {
311 struct bpf_iter_css_kern *kit = (void *)it;
312
313 BUILD_BUG_ON(sizeof(struct bpf_iter_css_kern) != sizeof(struct bpf_iter_css));
314 BUILD_BUG_ON(__alignof__(struct bpf_iter_css_kern) != __alignof__(struct bpf_iter_css));
315
316 kit->start = NULL;
317 switch (flags) {
318 case BPF_CGROUP_ITER_DESCENDANTS_PRE:
319 case BPF_CGROUP_ITER_DESCENDANTS_POST:
320 case BPF_CGROUP_ITER_ANCESTORS_UP:
321 break;
322 default:
323 return -EINVAL;
324 }
325
326 kit->start = start;
327 kit->pos = NULL;
328 kit->flags = flags;
329 return 0;
330 }
331
> 332 __bpf_kfunc struct cgroup_subsys_state *bpf_iter_css_next(struct bpf_iter_css *it)
333 {
334 struct bpf_iter_css_kern *kit = (void *)it;
335
336 if (!kit->start)
337 return NULL;
338
339 switch (kit->flags) {
340 case BPF_CGROUP_ITER_DESCENDANTS_PRE:
341 kit->pos = css_next_descendant_pre(kit->pos, kit->start);
342 break;
343 case BPF_CGROUP_ITER_DESCENDANTS_POST:
344 kit->pos = css_next_descendant_post(kit->pos, kit->start);
345 break;
346 case BPF_CGROUP_ITER_ANCESTORS_UP:
347 kit->pos = kit->pos ? kit->pos->parent : kit->start;
348 }
349
350 return kit->pos;
351 }
352
> 353 __bpf_kfunc void bpf_iter_css_destroy(struct bpf_iter_css *it)

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki