Re: [PATCH v1 1/2] PM: wakeup: Add kfuncs to lock/unlock wakeup_sources

kernel test robot
2026-03-23T12:34:18Z

Hi Samuel,

kernel test robot noticed the following build warnings:

[auto build test WARNING on rafael-pm/linux-next]
[also build test WARNING on rafael-pm/bleeding-edge linus/master v7.0-rc5 next-20260320]
[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/Samuel-Wu/PM-wakeup-Add-kfuncs-to-lock-unlock-wakeup_sources/20260323-064540
base: https://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git linux-next
patch link: https://lore.kernel.org/r/20260320160055.4114055-2-wusamuel%40google.com
patch subject: [PATCH v1 1/2] PM: wakeup: Add kfuncs to lock/unlock wakeup_sources
config: x86_64-randconfig-121-20260323 (https://download.01.org/0day-ci/archive/20260323/202603232018.pdjbZ3eL-lkp@intel.com/config)
compiler: gcc-12 (Debian 12.4.0-5) 12.4.0
sparse: v0.6.5-rc1
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260323/202603232018.pdjbZ3eL-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/202603232018.pdjbZ3eL-lkp@intel.com/

sparse warnings: (new ones prefixed by >>)
>> drivers/base/power/wakeup.c:1189:32: sparse: sparse: symbol 'bpf_wakeup_sources_read_lock' was not declared. Should it be static?
>> drivers/base/power/wakeup.c:1202:18: sparse: sparse: symbol 'bpf_wakeup_sources_read_unlock' was not declared. Should it be static?

vim +/bpf_wakeup_sources_read_lock +1189 drivers/base/power/wakeup.c

1177
1178 /**
1179 * bpf_wakeup_sources_read_lock - Acquire the SRCU lock for wakeup sources
1180 *
1181 * The underlying SRCU lock returns an integer index. However, the BPF verifier
1182 * requires a pointer (PTR_TO_BTF_ID) to strictly track the state of acquired
1183 * resources using KF_ACQUIRE and KF_RELEASE semantics. We use an opaque
1184 * structure pointer (struct bpf_ws_lock *) to satisfy the verifier while
1185 * safely encoding the integer index within the pointer address itself.
1186 *
1187 * Return: An opaque pointer encoding the SRCU lock index + 1 (to avoid NULL).
1188 */
> 1189 __bpf_kfunc struct bpf_ws_lock *bpf_wakeup_sources_read_lock(void)
1190 {
1191 return (struct bpf_ws_lock *)(long)(wakeup_sources_read_lock() + 1);
1192 }
1193
1194 /**
1195 * bpf_wakeup_sources_read_unlock - Release the SRCU lock for wakeup sources
1196 * @lock: The opaque pointer returned by bpf_wakeup_sources_read_lock()
1197 *
1198 * The BPF verifier guarantees that @lock is a valid, unreleased pointer from
1199 * the acquire function. We decode the pointer back into the integer SRCU index
1200 * by subtracting 1 and release the lock.
1201 */
> 1202 __bpf_kfunc void bpf_wakeup_sources_read_unlock(struct bpf_ws_lock *lock)
1203 {
1204 wakeup_sources_read_unlock((int)(long)lock - 1);
1205 }
1206

--
0-DAY CI Kernel Test Service