Re: [PATCH] bpf: Allocate bpf_event_entry with node info

From: kernel test robot
Date: Wed May 29 2024 - 02:31:05 EST


Hi Namhyung,

kernel test robot noticed the following build errors:

[auto build test ERROR on bpf-next/master]
[also build test ERROR on bpf/master linus/master v6.10-rc1 next-20240528]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url: https://github.com/intel-lab-lkp/linux/commits/Namhyung-Kim/bpf-Allocate-bpf_event_entry-with-node-info/20240529-063828
base: https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git master
patch link: https://lore.kernel.org/r/20240528223643.1166776-1-namhyung%40kernel.org
patch subject: [PATCH] bpf: Allocate bpf_event_entry with node info
config: m68k-defconfig (https://download.01.org/0day-ci/archive/20240529/202405291415.6JlTkRMF-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/20240529/202405291415.6JlTkRMF-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/202405291415.6JlTkRMF-lkp@xxxxxxxxx/

All error/warnings (new ones prefixed by >>):

kernel/bpf/arraymap.c: In function 'bpf_event_entry_gen':
>> kernel/bpf/arraymap.c:1200:18: error: 'struct perf_event' has no member named 'cpu'
1200 | if (event->cpu >= 0)
| ^~
In file included from ./arch/m68k/include/generated/asm/topology.h:1,
from include/linux/topology.h:36,
from include/linux/gfp.h:8,
from include/linux/umh.h:4,
from include/linux/kmod.h:9,
from include/linux/module.h:17,
from include/linux/bpf.h:20,
from kernel/bpf/arraymap.c:5:
kernel/bpf/arraymap.c:1201:36: error: 'cpu' undeclared (first use in this function)
1201 | node = cpu_to_node(cpu);
| ^~~
include/asm-generic/topology.h:35:41: note: in definition of macro 'cpu_to_node'
35 | #define cpu_to_node(cpu) ((void)(cpu),0)
| ^~~
kernel/bpf/arraymap.c:1201:36: note: each undeclared identifier is reported only once for each function it appears in
1201 | node = cpu_to_node(cpu);
| ^~~
include/asm-generic/topology.h:35:41: note: in definition of macro 'cpu_to_node'
35 | #define cpu_to_node(cpu) ((void)(cpu),0)
| ^~~
>> include/asm-generic/topology.h:35:45: warning: left-hand operand of comma expression has no effect [-Wunused-value]
35 | #define cpu_to_node(cpu) ((void)(cpu),0)
| ^
kernel/bpf/arraymap.c:1201:24: note: in expansion of macro 'cpu_to_node'
1201 | node = cpu_to_node(cpu);
| ^~~~~~~~~~~


vim +1200 kernel/bpf/arraymap.c

1192
1193 static struct bpf_event_entry *bpf_event_entry_gen(struct file *perf_file,
1194 struct file *map_file)
1195 {
1196 struct bpf_event_entry *ee;
1197 struct perf_event *event = perf_file->private_data;
1198 int node = -1;
1199
> 1200 if (event->cpu >= 0)
1201 node = cpu_to_node(cpu);
1202
1203 ee = kzalloc_node(sizeof(*ee), GFP_KERNEL, node);
1204 if (ee) {
1205 ee->event = event;
1206 ee->perf_file = perf_file;
1207 ee->map_file = map_file;
1208 }
1209
1210 return ee;
1211 }
1212

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