Re: [PATCH bpf-next v4 2/4] bpf: add bpf_cpu_cycles_to_ns helper

kernel test robot
2024-11-08T01:55:47Z

Hi Vadim,

kernel test robot noticed the following build errors:

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

url: https://github.com/intel-lab-lkp/linux/commits/Vadim-Fedorenko/bpf-add-bpf_cpu_cycles_to_ns-helper/20241108-051950
base: https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git master
patch link: https://lore.kernel.org/r/20241107211206.2814069-2-vadfed%40meta.com
patch subject: [PATCH bpf-next v4 2/4] bpf: add bpf_cpu_cycles_to_ns helper
config: sh-allmodconfig (https://download.01.org/0day-ci/archive/20241108/202411080952.bCRm4YHx-lkp@intel.com/config)
compiler: sh4-linux-gcc (GCC) 14.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20241108/202411080952.bCRm4YHx-lkp@intel.com/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@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202411080952.bCRm4YHx-lkp@intel.com/

All errors (new ones prefixed by >>):

kernel/bpf/helpers.c:3030:18: warning: extra tokens at end of #ifdef directive
3030 | #ifdef IS_ENABLED(CONFIG_GENERIC_GETTIMEOFDAY)
| ^
kernel/bpf/helpers.c: In function 'bpf_get_cpu_cycles':
kernel/bpf/helpers.c:3033:16: error: implicit declaration of function '__arch_get_hw_counter' [-Wimplicit-function-declaration]
3033 | return __arch_get_hw_counter(1, NULL);
| ^~~~~~~~~~~~~~~~~~~~~
kernel/bpf/helpers.c: In function 'bpf_cpu_cycles_to_ns':
kernel/bpf/helpers.c:3038:38: error: implicit declaration of function '__arch_get_k_vdso_data' [-Wimplicit-function-declaration]
3038 | const struct vdso_data *vd = __arch_get_k_vdso_data();
| ^~~~~~~~~~~~~~~~~~~~~~
>> kernel/bpf/helpers.c:3038:38: error: initialization of 'const struct vdso_data *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
kernel/bpf/helpers.c:3040:42: error: invalid use of undefined type 'const struct vdso_data'
3040 | return mul_u64_u32_shr(cycles, vd->mult, vd->shift);
| ^~
kernel/bpf/helpers.c:3040:52: error: invalid use of undefined type 'const struct vdso_data'
3040 | return mul_u64_u32_shr(cycles, vd->mult, vd->shift);
| ^~
kernel/bpf/helpers.c: At top level:
kernel/bpf/helpers.c:3135:18: warning: extra tokens at end of #ifdef directive
3135 | #ifdef IS_ENABLED(CONFIG_GENERIC_GETTIMEOFDAY)
| ^
kernel/bpf/helpers.c: In function 'bpf_cpu_cycles_to_ns':
kernel/bpf/helpers.c:3041:1: warning: control reaches end of non-void function [-Wreturn-type]
3041 | }
| ^

vim +3038 kernel/bpf/helpers.c

3035
3036 __bpf_kfunc u64 bpf_cpu_cycles_to_ns(u64 cycles)
3037 {
> 3038 const struct vdso_data *vd = __arch_get_k_vdso_data();
3039
3040 return mul_u64_u32_shr(cycles, vd->mult, vd->shift);
3041 }
3042 #endif
3043 __bpf_kfunc_end_defs();
3044

--
0-DAY CI Kernel Test Service