Skip to contentSkip to conversation

mm/bpf_memcontrol.c:125:27: sparse: sparse: symbol 'bpf_mem_cgroup_memory_events' was not declared. Should it be static?

DISCUSSION kernel test robot 2 participants 2 messages Jun 14 – Jun 17

lore
Share & tools
lore

kernel test robot

author build bot
#0 lore raw
tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   8cd9520d35a6c38db6567e97dd93b1f11f185dc6
commit: 99430ab8b804c26b8a0dec93fcbfe75469f3edc7 mm: introduce BPF kfuncs to access memcg statistics and events
date:   6 months ago
config: powerpc-randconfig-r134-20260614 (https://download.01.org/0day-ci/archive/20260615/[email protected]/config)
compiler: clang version 23.0.0git (https://github.com/llvm/llvm-project 305faf498a4e0b52b40742c927af63ab2082e1a9)
sparse: v0.6.5-rc1
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260615/[email protected]/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

| Fixes: 99430ab8b804 ("mm: introduce BPF kfuncs to access memcg statistics and events")
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

sparse warnings: (new ones prefixed by >>)

>> mm/bpf_memcontrol.c:125:27: sparse: sparse: symbol 'bpf_mem_cgroup_memory_events' was not declared. Should it be static?

mm/bpf_memcontrol.c:68:9: sparse: sparse: context imbalance in 'bpf_get_mem_cgroup' - different lock contexts for basic block

vim +/bpf_mem_cgroup_memory_events +125 mm/bpf_memcontrol.c

117
118 /**
119 * bpf_mem_cgroup_memory_events - Read memory cgroup's memory event value
120 * @memcg: memory cgroup
121 * @event: memory event id
122 *
123 * Return: The current value of the memory event counter.
124 */

 > 125	__bpf_kfunc unsigned long bpf_mem_cgroup_memory_events(struct mem_cgroup *memcg,

126 enum memcg_memory_event event)
127 {
128 if (unlikely(event >= MEMCG_NR_MEMORY_EVENTS))
129 return (unsigned long)-1;
130
131 return atomic_long_read(&memcg->memory_events[event]);
132 }
133

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

#1 lore raw
Quoted 29 lines · kernel test robot
tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   8cd9520d35a6c38db6567e97dd93b1f11f185dc6
commit: 99430ab8b804c26b8a0dec93fcbfe75469f3edc7 mm: introduce BPF kfuncs to access memcg statistics and events
date:   6 months ago
config: powerpc-randconfig-r134-20260614 (https://download.01.org/0day-ci/archive/20260615/[email protected]/config)
compiler: clang version 23.0.0git (https://github.com/llvm/llvm-project 305faf498a4e0b52b40742c927af63ab2082e1a9)
sparse: v0.6.5-rc1
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260615/[email protected]/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

| Fixes: 99430ab8b804 ("mm: introduce BPF kfuncs to access memcg statistics and events")
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

sparse warnings: (new ones prefixed by >>)

Quoted 1 line
Quoted 1 line

mm/bpf_memcontrol.c:125:27: sparse: sparse: symbol 'bpf_mem_cgroup_memory_events' was not declared. Should it be static?

mm/bpf_memcontrol.c:68:9: sparse: sparse: context imbalance in 'bpf_get_mem_cgroup' - different lock contexts for basic block

vim +/bpf_mem_cgroup_memory_events +125 mm/bpf_memcontrol.c

117
118 /**
119 * bpf_mem_cgroup_memory_events - Read memory cgroup's memory event value
120 * @memcg: memory cgroup
121 * @event: memory event id
122 *
123 * Return: The current value of the memory event counter.
124 */

Quoted 2 lines
Quoted 1 line

125 __bpf_kfunc unsigned long bpf_mem_cgroup_memory_events(struct mem_cgroup *memcg,

126 enum memcg_memory_event event)

Roman, it looks like the kfuncs added for bpfoom can safely be made static since they get resolved through BTF. I'll send a patch to update where applicable.