All of lore.kernel.org
 help / color / mirror / Atom feed
* [kkdwivedi:fermata 28/49] kernel/bpf/waitq.c:399:17: error: implicit declaration of function 'cgroup_put'; did you mean 'cgroup_init'?
@ 2026-10-02  5:09 kernel test robot
  0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2026-10-02  5:09 UTC (permalink / raw)
  To: Kumar Kartikeya Dwivedi; +Cc: oe-kbuild-all

tree:   https://github.com/kkdwivedi/linux fermata
head:   babde5051be3840becf5a78de91a0b68a99f0e49
commit: d04d9b8149bf42d0f94328586f8e0ee93ed43738 [28/49] bpf: Support cgroup placement for BPF kthreads
config: csky-randconfig-r2107-20261001 (https://download.01.org/0day-ci/archive/20261002/202610020711.pgNOf135-lkp@intel.com/config)
compiler: csky-linux-gcc (GCC) 16.1.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20261002/202610020711.pgNOf135-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/202610020711.pgNOf135-lkp@intel.com/

All errors (new ones prefixed by >>):

   kernel/bpf/waitq.c: In function 'bpf_kthread_create':
>> kernel/bpf/waitq.c:399:17: error: implicit declaration of function 'cgroup_put'; did you mean 'cgroup_init'? [-Wimplicit-function-declaration]
     399 |                 cgroup_put(cgrp);
         |                 ^~~~~~~~~~
         |                 cgroup_init


vim +399 kernel/bpf/waitq.c

   311	
   312	__bpf_kfunc int bpf_kthread_create(struct bpf_kthread *kthread, void *p__const_map,
   313					   u64 cgroup_id,
   314					   int (callback_fn)(void *map, int *key, void *value),
   315					   struct bpf_prog_aux *aux)
   316	{
   317		struct bpf_kthread_opaque *opaque = (struct bpf_kthread_opaque *)kthread;
   318		struct bpf_map *map = p__const_map;
   319		struct bpf_kthread_kern *new_kthread;
   320		struct bpf_prog *prog;
   321		struct task_struct *task;
   322		struct cgroup *cgrp = NULL;
   323		int err;
   324	
   325		BUILD_BUG_ON(sizeof(struct bpf_kthread_opaque) > sizeof(struct bpf_kthread));
   326		BUILD_BUG_ON(__alignof__(struct bpf_kthread_opaque) != __alignof__(struct bpf_kthread));
   327	
   328		if (READ_ONCE(opaque->kthread))
   329			return -EBUSY;
   330	
   331		prog = bpf_prog_inc_not_zero(aux->prog);
   332		if (IS_ERR(prog))
   333			return PTR_ERR(prog);
   334	
   335		new_kthread = bpf_map_kzalloc(map, sizeof(*new_kthread), GFP_KERNEL | __GFP_NOWARN);
   336		if (!new_kthread) {
   337			bpf_prog_put(prog);
   338			return -ENOMEM;
   339		}
   340	
   341		new_kthread->map = map;
   342		new_kthread->prog = prog;
   343		new_kthread->callback_fn = callback_fn;
   344		new_kthread->value = (void *)opaque - map->record->kthread_off;
   345		init_completion(&new_kthread->initialized);
   346		spin_lock_init(&new_kthread->lock);
   347		INIT_WORK(&new_kthread->stop_work, bpf_kthread_stop_work);
   348	
   349		if (cgroup_id) {
   350	#ifdef CONFIG_CGROUPS
   351			cgrp = cgroup_get_from_id(cgroup_id);
   352			if (IS_ERR(cgrp)) {
   353				err = PTR_ERR(cgrp);
   354				goto free_kthread;
   355			}
   356			new_kthread->cgrp = cgrp;
   357	#else
   358			err = -EOPNOTSUPP;
   359			goto free_kthread;
   360	#endif
   361		}
   362	
   363		task = kthread_create(bpf_kthread_run, new_kthread, "bpf_kthread/%u", map->id);
   364		if (IS_ERR(task)) {
   365			err = PTR_ERR(task);
   366			goto put_cgroup;
   367		}
   368		get_task_struct(task);
   369		new_kthread->task = task;
   370		if (cgrp) {
   371			wake_up_process(task);
   372			wait_for_completion(&new_kthread->initialized);
   373			err = cgroup_kthread_attach(cgrp, task);
   374			if (err)
   375				goto stop_task;
   376		}
   377	
   378		if (cmpxchg(&opaque->kthread, NULL, new_kthread)) {
   379			err = -EBUSY;
   380			goto stop_task;
   381		}
   382	
   383		/*
   384		 * Order publication against the final map user-reference release. Either
   385		 * release observes the kthread or this side observes a zero user count.
   386		 */
   387		smp_mb();
   388		if (!atomic64_read(&map->usercnt)) {
   389			bpf_kthread_cancel_and_free(opaque);
   390			return -EPERM;
   391		}
   392	
   393		return 0;
   394	
   395	stop_task:
   396		kthread_stop_put(task);
   397	put_cgroup:
   398		if (cgrp)
 > 399			cgroup_put(cgrp);
   400	free_kthread:
   401		bpf_prog_put(prog);
   402		kfree(new_kthread);
   403		return err;
   404	}
   405	

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2026-10-02  5:10 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-02  5:09 [kkdwivedi:fermata 28/49] kernel/bpf/waitq.c:399:17: error: implicit declaration of function 'cgroup_put'; did you mean 'cgroup_init'? kernel test robot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.