Re: [PATCH bpf-next v2 3/3] bpf: Use BPF_KFUNC macro at all kfunc definitions

From: kernel test robot
Date: Mon Jan 23 2023 - 14:02:27 EST


Hi David,

Thank you for the patch! Perhaps something to improve:

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

url: https://github.com/intel-lab-lkp/linux/commits/David-Vernet/bpf-Add-BPF_KFUNC-macro-for-defining-kfuncs/20230124-011804
base: https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git master
patch link: https://lore.kernel.org/r/20230123171506.71995-4-void%40manifault.com
patch subject: [PATCH bpf-next v2 3/3] bpf: Use BPF_KFUNC macro at all kfunc definitions
config: m68k-allyesconfig (https://download.01.org/0day-ci/archive/20230124/202301240220.RKx4Wgip-lkp@xxxxxxxxx/config)
compiler: m68k-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/760b15a8e5d45d6e9925d2439e0d052de969b361
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review David-Vernet/bpf-Add-BPF_KFUNC-macro-for-defining-kfuncs/20230124-011804
git checkout 760b15a8e5d45d6e9925d2439e0d052de969b361
# 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=m68k olddefconfig
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=m68k SHELL=/bin/bash kernel/ net/

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

All warnings (new ones prefixed by >>):

>> kernel/cgroup/rstat.c:30: warning: expecting prototype for cgroup_rstat_updated(). Prototype was for BPF_KFUNC() instead
>> kernel/cgroup/rstat.c:235: warning: expecting prototype for cgroup_rstat_flush(). Prototype was for BPF_KFUNC() instead
--
>> kernel/bpf/helpers.c:1850: warning: expecting prototype for bpf_task_acquire(). Prototype was for BPF_KFUNC() instead
>> kernel/bpf/helpers.c:1861: warning: expecting prototype for bpf_task_acquire_not_zero(). Prototype was for BPF_KFUNC() instead
>> kernel/bpf/helpers.c:1913: warning: expecting prototype for bpf_task_kptr_get(). Prototype was for BPF_KFUNC() instead
>> kernel/bpf/helpers.c:1926: warning: expecting prototype for bpf_task_release(). Prototype was for BPF_KFUNC() instead
>> kernel/bpf/helpers.c:1941: warning: expecting prototype for bpf_cgroup_acquire(). Prototype was for BPF_KFUNC() instead
>> kernel/bpf/helpers.c:1953: warning: expecting prototype for bpf_cgroup_kptr_get(). Prototype was for BPF_KFUNC() instead
>> kernel/bpf/helpers.c:1985: warning: expecting prototype for bpf_cgroup_release(). Prototype was for BPF_KFUNC() instead
>> kernel/bpf/helpers.c:2000: warning: expecting prototype for bpf_cgroup_ancestor(). Prototype was for BPF_KFUNC() instead
>> kernel/bpf/helpers.c:2019: warning: expecting prototype for bpf_task_from_pid(). Prototype was for BPF_KFUNC() instead
--
net/bpf/test_run.c:490:14: warning: no previous prototype for 'bpf_fentry_test2' [-Wmissing-prototypes]
490 | int noinline bpf_fentry_test2(int a, u64 b)
| ^~~~~~~~~~~~~~~~
net/bpf/test_run.c:495:14: warning: no previous prototype for 'bpf_fentry_test3' [-Wmissing-prototypes]
495 | int noinline bpf_fentry_test3(char a, int b, u64 c)
| ^~~~~~~~~~~~~~~~
net/bpf/test_run.c:500:14: warning: no previous prototype for 'bpf_fentry_test4' [-Wmissing-prototypes]
500 | int noinline bpf_fentry_test4(void *a, char b, int c, u64 d)
| ^~~~~~~~~~~~~~~~
net/bpf/test_run.c:505:14: warning: no previous prototype for 'bpf_fentry_test5' [-Wmissing-prototypes]
505 | int noinline bpf_fentry_test5(u64 a, void *b, short c, int d, u64 e)
| ^~~~~~~~~~~~~~~~
net/bpf/test_run.c:510:14: warning: no previous prototype for 'bpf_fentry_test6' [-Wmissing-prototypes]
510 | int noinline bpf_fentry_test6(u64 a, void *b, short c, int d, void *e, u64 f)
| ^~~~~~~~~~~~~~~~
>> net/bpf/test_run.c:519:14: warning: no previous prototype for 'bpf_fentry_test7' [-Wmissing-prototypes]
519 | int noinline bpf_fentry_test7(struct bpf_fentry_test_t *arg)
| ^~~~~~~~~~~~~~~~
>> net/bpf/test_run.c:524:14: warning: no previous prototype for 'bpf_fentry_test8' [-Wmissing-prototypes]
524 | int noinline bpf_fentry_test8(struct bpf_fentry_test_t *arg)
| ^~~~~~~~~~~~~~~~


vim +30 kernel/cgroup/rstat.c

041cd640b2f3c5 kernel/cgroup/stat.c Tejun Heo 2017-09-25 19
041cd640b2f3c5 kernel/cgroup/stat.c Tejun Heo 2017-09-25 20 /**
6162cef0f741c7 kernel/cgroup/rstat.c Tejun Heo 2018-04-26 21 * cgroup_rstat_updated - keep track of updated rstat_cpu
041cd640b2f3c5 kernel/cgroup/stat.c Tejun Heo 2017-09-25 22 * @cgrp: target cgroup
c58632b3631cb2 kernel/cgroup/rstat.c Tejun Heo 2018-04-26 23 * @cpu: cpu on which rstat_cpu was updated
041cd640b2f3c5 kernel/cgroup/stat.c Tejun Heo 2017-09-25 24 *
c58632b3631cb2 kernel/cgroup/rstat.c Tejun Heo 2018-04-26 25 * @cgrp's rstat_cpu on @cpu was updated. Put it on the parent's matching
c58632b3631cb2 kernel/cgroup/rstat.c Tejun Heo 2018-04-26 26 * rstat_cpu->updated_children list. See the comment on top of
c58632b3631cb2 kernel/cgroup/rstat.c Tejun Heo 2018-04-26 27 * cgroup_rstat_cpu definition for details.
041cd640b2f3c5 kernel/cgroup/stat.c Tejun Heo 2017-09-25 28 */
760b15a8e5d45d kernel/cgroup/rstat.c David Vernet 2023-01-23 29 BPF_KFUNC(void cgroup_rstat_updated(struct cgroup *cgrp, int cpu))
041cd640b2f3c5 kernel/cgroup/stat.c Tejun Heo 2017-09-25 @30 {
c58632b3631cb2 kernel/cgroup/rstat.c Tejun Heo 2018-04-26 31 raw_spinlock_t *cpu_lock = per_cpu_ptr(&cgroup_rstat_cpu_lock, cpu);
041cd640b2f3c5 kernel/cgroup/stat.c Tejun Heo 2017-09-25 32 unsigned long flags;
041cd640b2f3c5 kernel/cgroup/stat.c Tejun Heo 2017-09-25 33
041cd640b2f3c5 kernel/cgroup/stat.c Tejun Heo 2017-09-25 34 /*
d8ef4b38cb69d9 kernel/cgroup/rstat.c Tejun Heo 2020-04-09 35 * Speculative already-on-list test. This may race leading to
d8ef4b38cb69d9 kernel/cgroup/rstat.c Tejun Heo 2020-04-09 36 * temporary inaccuracies, which is fine.
d8ef4b38cb69d9 kernel/cgroup/rstat.c Tejun Heo 2020-04-09 37 *
041cd640b2f3c5 kernel/cgroup/stat.c Tejun Heo 2017-09-25 38 * Because @parent's updated_children is terminated with @parent
041cd640b2f3c5 kernel/cgroup/stat.c Tejun Heo 2017-09-25 39 * instead of NULL, we can tell whether @cgrp is on the list by
041cd640b2f3c5 kernel/cgroup/stat.c Tejun Heo 2017-09-25 40 * testing the next pointer for NULL.
041cd640b2f3c5 kernel/cgroup/stat.c Tejun Heo 2017-09-25 41 */
eda09706b240ca kernel/cgroup/rstat.c Michal Koutný 2021-11-03 42 if (data_race(cgroup_rstat_cpu(cgrp, cpu)->updated_next))
041cd640b2f3c5 kernel/cgroup/stat.c Tejun Heo 2017-09-25 43 return;
041cd640b2f3c5 kernel/cgroup/stat.c Tejun Heo 2017-09-25 44
041cd640b2f3c5 kernel/cgroup/stat.c Tejun Heo 2017-09-25 45 raw_spin_lock_irqsave(cpu_lock, flags);
041cd640b2f3c5 kernel/cgroup/stat.c Tejun Heo 2017-09-25 46
041cd640b2f3c5 kernel/cgroup/stat.c Tejun Heo 2017-09-25 47 /* put @cgrp and all ancestors on the corresponding updated lists */
dc26532aed0ab2 kernel/cgroup/rstat.c Johannes Weiner 2021-04-29 48 while (true) {
c58632b3631cb2 kernel/cgroup/rstat.c Tejun Heo 2018-04-26 49 struct cgroup_rstat_cpu *rstatc = cgroup_rstat_cpu(cgrp, cpu);
dc26532aed0ab2 kernel/cgroup/rstat.c Johannes Weiner 2021-04-29 50 struct cgroup *parent = cgroup_parent(cgrp);
dc26532aed0ab2 kernel/cgroup/rstat.c Johannes Weiner 2021-04-29 51 struct cgroup_rstat_cpu *prstatc;
041cd640b2f3c5 kernel/cgroup/stat.c Tejun Heo 2017-09-25 52
041cd640b2f3c5 kernel/cgroup/stat.c Tejun Heo 2017-09-25 53 /*
041cd640b2f3c5 kernel/cgroup/stat.c Tejun Heo 2017-09-25 54 * Both additions and removals are bottom-up. If a cgroup
041cd640b2f3c5 kernel/cgroup/stat.c Tejun Heo 2017-09-25 55 * is already in the tree, all ancestors are.
041cd640b2f3c5 kernel/cgroup/stat.c Tejun Heo 2017-09-25 56 */
c58632b3631cb2 kernel/cgroup/rstat.c Tejun Heo 2018-04-26 57 if (rstatc->updated_next)
041cd640b2f3c5 kernel/cgroup/stat.c Tejun Heo 2017-09-25 58 break;
041cd640b2f3c5 kernel/cgroup/stat.c Tejun Heo 2017-09-25 59
dc26532aed0ab2 kernel/cgroup/rstat.c Johannes Weiner 2021-04-29 60 /* Root has no parent to link it to, but mark it busy */
dc26532aed0ab2 kernel/cgroup/rstat.c Johannes Weiner 2021-04-29 61 if (!parent) {
dc26532aed0ab2 kernel/cgroup/rstat.c Johannes Weiner 2021-04-29 62 rstatc->updated_next = cgrp;
dc26532aed0ab2 kernel/cgroup/rstat.c Johannes Weiner 2021-04-29 63 break;
dc26532aed0ab2 kernel/cgroup/rstat.c Johannes Weiner 2021-04-29 64 }
dc26532aed0ab2 kernel/cgroup/rstat.c Johannes Weiner 2021-04-29 65
dc26532aed0ab2 kernel/cgroup/rstat.c Johannes Weiner 2021-04-29 66 prstatc = cgroup_rstat_cpu(parent, cpu);
c58632b3631cb2 kernel/cgroup/rstat.c Tejun Heo 2018-04-26 67 rstatc->updated_next = prstatc->updated_children;
c58632b3631cb2 kernel/cgroup/rstat.c Tejun Heo 2018-04-26 68 prstatc->updated_children = cgrp;
dc26532aed0ab2 kernel/cgroup/rstat.c Johannes Weiner 2021-04-29 69
dc26532aed0ab2 kernel/cgroup/rstat.c Johannes Weiner 2021-04-29 70 cgrp = parent;
041cd640b2f3c5 kernel/cgroup/stat.c Tejun Heo 2017-09-25 71 }
041cd640b2f3c5 kernel/cgroup/stat.c Tejun Heo 2017-09-25 72
041cd640b2f3c5 kernel/cgroup/stat.c Tejun Heo 2017-09-25 73 raw_spin_unlock_irqrestore(cpu_lock, flags);
041cd640b2f3c5 kernel/cgroup/stat.c Tejun Heo 2017-09-25 74 }
041cd640b2f3c5 kernel/cgroup/stat.c Tejun Heo 2017-09-25 75

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