[<prev] [next>] [day] [month] [year] [list]
Message-ID: <202308180746.GSehftnY-lkp@intel.com>
Date: Fri, 18 Aug 2023 07:19:34 +0800
From: kernel test robot <lkp@...el.com>
To: Tejun Heo <tj@...nel.org>
Cc: oe-kbuild-all@...ts.linux.dev, linux-kernel@...r.kernel.org,
Alexei Starovoitov <ast@...nel.org>
Subject: kernel/bpf/helpers.c:2112:28: warning: no previous declaration for
'bpf_cgroup_from_id'
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 16931859a6500d360b90aeacab3b505a3560a3ed
commit: 332ea1f697be148bd5e66475d82b5ecc5084da65 bpf: Add bpf_cgroup_from_id() kfunc
date: 6 months ago
config: x86_64-randconfig-x012-20230816 (https://download.01.org/0day-ci/archive/20230818/202308180746.GSehftnY-lkp@intel.com/config)
compiler: gcc-7 (Ubuntu 7.5.0-6ubuntu2) 7.5.0
reproduce: (https://download.01.org/0day-ci/archive/20230818/202308180746.GSehftnY-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@...el.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202308180746.GSehftnY-lkp@intel.com/
All warnings (new ones prefixed by >>):
kernel/bpf/helpers.c:1819:19: warning: no previous declaration for 'bpf_obj_new_impl' [-Wmissing-declarations]
__bpf_kfunc void *bpf_obj_new_impl(u64 local_type_id__k, void *meta__ign)
^~~~~~~~~~~~~~~~
kernel/bpf/helpers.c:1833:18: warning: no previous declaration for 'bpf_obj_drop_impl' [-Wmissing-declarations]
__bpf_kfunc void bpf_obj_drop_impl(void *p__alloc, void *meta__ign)
^~~~~~~~~~~~~~~~~
kernel/bpf/helpers.c:1854:18: warning: no previous declaration for 'bpf_list_push_front' [-Wmissing-declarations]
__bpf_kfunc void bpf_list_push_front(struct bpf_list_head *head, struct bpf_list_node *node)
^~~~~~~~~~~~~~~~~~~
kernel/bpf/helpers.c:1859:18: warning: no previous declaration for 'bpf_list_push_back' [-Wmissing-declarations]
__bpf_kfunc void bpf_list_push_back(struct bpf_list_head *head, struct bpf_list_node *node)
^~~~~~~~~~~~~~~~~~
kernel/bpf/helpers.c:1877:35: warning: no previous declaration for 'bpf_list_pop_front' [-Wmissing-declarations]
__bpf_kfunc struct bpf_list_node *bpf_list_pop_front(struct bpf_list_head *head)
^~~~~~~~~~~~~~~~~~
kernel/bpf/helpers.c:1882:35: warning: no previous declaration for 'bpf_list_pop_back' [-Wmissing-declarations]
__bpf_kfunc struct bpf_list_node *bpf_list_pop_back(struct bpf_list_head *head)
^~~~~~~~~~~~~~~~~
kernel/bpf/helpers.c:1887:33: warning: no previous declaration for 'bpf_rbtree_remove' [-Wmissing-declarations]
__bpf_kfunc struct bpf_rb_node *bpf_rbtree_remove(struct bpf_rb_root *root,
^~~~~~~~~~~~~~~~~
kernel/bpf/helpers.c:1924:18: warning: no previous declaration for 'bpf_rbtree_add' [-Wmissing-declarations]
__bpf_kfunc void bpf_rbtree_add(struct bpf_rb_root *root, struct bpf_rb_node *node,
^~~~~~~~~~~~~~
kernel/bpf/helpers.c:1930:33: warning: no previous declaration for 'bpf_rbtree_first' [-Wmissing-declarations]
__bpf_kfunc struct bpf_rb_node *bpf_rbtree_first(struct bpf_rb_root *root)
^~~~~~~~~~~~~~~~
kernel/bpf/helpers.c:1943:33: warning: no previous declaration for 'bpf_task_acquire' [-Wmissing-declarations]
__bpf_kfunc struct task_struct *bpf_task_acquire(struct task_struct *p)
^~~~~~~~~~~~~~~~
kernel/bpf/helpers.c:1954:33: warning: no previous declaration for 'bpf_task_acquire_not_zero' [-Wmissing-declarations]
__bpf_kfunc struct task_struct *bpf_task_acquire_not_zero(struct task_struct *p)
^~~~~~~~~~~~~~~~~~~~~~~~~
kernel/bpf/helpers.c:2006:33: warning: no previous declaration for 'bpf_task_kptr_get' [-Wmissing-declarations]
__bpf_kfunc struct task_struct *bpf_task_kptr_get(struct task_struct **pp)
^~~~~~~~~~~~~~~~~
kernel/bpf/helpers.c:2019:18: warning: no previous declaration for 'bpf_task_release' [-Wmissing-declarations]
__bpf_kfunc void bpf_task_release(struct task_struct *p)
^~~~~~~~~~~~~~~~
kernel/bpf/helpers.c:2034:28: warning: no previous declaration for 'bpf_cgroup_acquire' [-Wmissing-declarations]
__bpf_kfunc struct cgroup *bpf_cgroup_acquire(struct cgroup *cgrp)
^~~~~~~~~~~~~~~~~~
kernel/bpf/helpers.c:2046:28: warning: no previous declaration for 'bpf_cgroup_kptr_get' [-Wmissing-declarations]
__bpf_kfunc struct cgroup *bpf_cgroup_kptr_get(struct cgroup **cgrpp)
^~~~~~~~~~~~~~~~~~~
kernel/bpf/helpers.c:2078:18: warning: no previous declaration for 'bpf_cgroup_release' [-Wmissing-declarations]
__bpf_kfunc void bpf_cgroup_release(struct cgroup *cgrp)
^~~~~~~~~~~~~~~~~~
kernel/bpf/helpers.c:2093:28: warning: no previous declaration for 'bpf_cgroup_ancestor' [-Wmissing-declarations]
__bpf_kfunc struct cgroup *bpf_cgroup_ancestor(struct cgroup *cgrp, int level)
^~~~~~~~~~~~~~~~~~~
>> kernel/bpf/helpers.c:2112:28: warning: no previous declaration for 'bpf_cgroup_from_id' [-Wmissing-declarations]
__bpf_kfunc struct cgroup *bpf_cgroup_from_id(u64 cgid)
^~~~~~~~~~~~~~~~~~
kernel/bpf/helpers.c:2129:33: warning: no previous declaration for 'bpf_task_from_pid' [-Wmissing-declarations]
__bpf_kfunc struct task_struct *bpf_task_from_pid(s32 pid)
^~~~~~~~~~~~~~~~~
kernel/bpf/helpers.c:2142:19: warning: no previous declaration for 'bpf_cast_to_kern_ctx' [-Wmissing-declarations]
__bpf_kfunc void *bpf_cast_to_kern_ctx(void *obj)
^~~~~~~~~~~~~~~~~~~~
kernel/bpf/helpers.c:2147:19: warning: no previous declaration for 'bpf_rdonly_cast' [-Wmissing-declarations]
__bpf_kfunc void *bpf_rdonly_cast(void *obj__ign, u32 btf_id__k)
^~~~~~~~~~~~~~~
kernel/bpf/helpers.c:2152:18: warning: no previous declaration for 'bpf_rcu_read_lock' [-Wmissing-declarations]
__bpf_kfunc void bpf_rcu_read_lock(void)
^~~~~~~~~~~~~~~~~
kernel/bpf/helpers.c:2157:18: warning: no previous declaration for 'bpf_rcu_read_unlock' [-Wmissing-declarations]
__bpf_kfunc void bpf_rcu_read_unlock(void)
^~~~~~~~~~~~~~~~~~~
vim +/bpf_cgroup_from_id +2112 kernel/bpf/helpers.c
2039
2040 /**
2041 * bpf_cgroup_kptr_get - Acquire a reference on a struct cgroup kptr. A cgroup
2042 * kptr acquired by this kfunc which is not subsequently stored in a map, must
2043 * be released by calling bpf_cgroup_release().
2044 * @cgrpp: A pointer to a cgroup kptr on which a reference is being acquired.
2045 */
> 2046 __bpf_kfunc struct cgroup *bpf_cgroup_kptr_get(struct cgroup **cgrpp)
2047 {
2048 struct cgroup *cgrp;
2049
2050 rcu_read_lock();
2051 /* Another context could remove the cgroup from the map and release it
2052 * at any time, including after we've done the lookup above. This is
2053 * safe because we're in an RCU read region, so the cgroup is
2054 * guaranteed to remain valid until at least the rcu_read_unlock()
2055 * below.
2056 */
2057 cgrp = READ_ONCE(*cgrpp);
2058
2059 if (cgrp && !cgroup_tryget(cgrp))
2060 /* If the cgroup had been removed from the map and freed as
2061 * described above, cgroup_tryget() will return false. The
2062 * cgroup will be freed at some point after the current RCU gp
2063 * has ended, so just return NULL to the user.
2064 */
2065 cgrp = NULL;
2066 rcu_read_unlock();
2067
2068 return cgrp;
2069 }
2070
2071 /**
2072 * bpf_cgroup_release - Release the reference acquired on a cgroup.
2073 * If this kfunc is invoked in an RCU read region, the cgroup is guaranteed to
2074 * not be freed until the current grace period has ended, even if its refcount
2075 * drops to 0.
2076 * @cgrp: The cgroup on which a reference is being released.
2077 */
2078 __bpf_kfunc void bpf_cgroup_release(struct cgroup *cgrp)
2079 {
2080 if (!cgrp)
2081 return;
2082
2083 cgroup_put(cgrp);
2084 }
2085
2086 /**
2087 * bpf_cgroup_ancestor - Perform a lookup on an entry in a cgroup's ancestor
2088 * array. A cgroup returned by this kfunc which is not subsequently stored in a
2089 * map, must be released by calling bpf_cgroup_release().
2090 * @cgrp: The cgroup for which we're performing a lookup.
2091 * @level: The level of ancestor to look up.
2092 */
2093 __bpf_kfunc struct cgroup *bpf_cgroup_ancestor(struct cgroup *cgrp, int level)
2094 {
2095 struct cgroup *ancestor;
2096
2097 if (level > cgrp->level || level < 0)
2098 return NULL;
2099
2100 ancestor = cgrp->ancestors[level];
2101 cgroup_get(ancestor);
2102 return ancestor;
2103 }
2104
2105 /**
2106 * bpf_cgroup_from_id - Find a cgroup from its ID. A cgroup returned by this
2107 * kfunc which is not subsequently stored in a map, must be released by calling
2108 * bpf_cgroup_release().
2109 * @cgrp: The cgroup for which we're performing a lookup.
2110 * @level: The level of ancestor to look up.
2111 */
> 2112 __bpf_kfunc struct cgroup *bpf_cgroup_from_id(u64 cgid)
2113 {
2114 struct cgroup *cgrp;
2115
2116 cgrp = cgroup_get_from_id(cgid);
2117 if (IS_ERR(cgrp))
2118 return NULL;
2119 return cgrp;
2120 }
2121 #endif /* CONFIG_CGROUPS */
2122
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
Powered by blists - more mailing lists