Hi Mykyta, kernel test robot noticed the following build warnings: [auto build test WARNING on bpf-next/master] url: https://github.com/intel-lab-lkp/linux/commits/Mykyta-Yatsenko/bpf-bpf-task-work-plumbing/20250816-032308 base: https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git master patch link: https://lore.kernel.org/r/20250815192156.272445-4-mykyta.yatsenko5%40gmail.com patch subject: [PATCH bpf-next v2 3/4] bpf: task work scheduling kfuncs config: riscv-randconfig-r122-20250816 (https://download.01.org/0day-ci/archive/20250817/202508170152.F0lX7DFM-lkp@xxxxxxxxx/config) compiler: clang version 22.0.0git (https://github.com/llvm/llvm-project 93d24b6b7b148c47a2fa228a4ef31524fa1d9f3f) reproduce: (https://download.01.org/0day-ci/archive/20250817/202508170152.F0lX7DFM-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/202508170152.F0lX7DFM-lkp@xxxxxxxxx/ sparse warnings: (new ones prefixed by >>) kernel/bpf/helpers.c:2471:18: sparse: sparse: symbol 'bpf_task_release_dtor' was not declared. Should it be static? kernel/bpf/helpers.c:2501:18: sparse: sparse: symbol 'bpf_cgroup_release_dtor' was not declared. Should it be static? kernel/bpf/helpers.c:3367:17: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected void const [noderef] __user *from @@ got char * @@ kernel/bpf/helpers.c:3367:17: sparse: expected void const [noderef] __user *from kernel/bpf/helpers.c:3367:17: sparse: got char * kernel/bpf/helpers.c:3368:17: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected void const [noderef] __user *from @@ got char * @@ kernel/bpf/helpers.c:3368:17: sparse: expected void const [noderef] __user *from kernel/bpf/helpers.c:3368:17: sparse: got char * kernel/bpf/helpers.c:3407:17: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected void const [noderef] __user *from @@ got char * @@ kernel/bpf/helpers.c:3407:17: sparse: expected void const [noderef] __user *from kernel/bpf/helpers.c:3407:17: sparse: got char * kernel/bpf/helpers.c:3461:17: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected void const [noderef] __user *from @@ got char * @@ kernel/bpf/helpers.c:3461:17: sparse: expected void const [noderef] __user *from kernel/bpf/helpers.c:3461:17: sparse: got char * kernel/bpf/helpers.c:3493:17: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected void const [noderef] __user *from @@ got char * @@ kernel/bpf/helpers.c:3493:17: sparse: expected void const [noderef] __user *from kernel/bpf/helpers.c:3493:17: sparse: got char * kernel/bpf/helpers.c:3526:17: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected void const [noderef] __user *from @@ got char * @@ kernel/bpf/helpers.c:3526:17: sparse: expected void const [noderef] __user *from kernel/bpf/helpers.c:3526:17: sparse: got char * kernel/bpf/helpers.c:3576:17: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected void const [noderef] __user *from @@ got char * @@ kernel/bpf/helpers.c:3576:17: sparse: expected void const [noderef] __user *from kernel/bpf/helpers.c:3576:17: sparse: got char * kernel/bpf/helpers.c:3580:25: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected void const [noderef] __user *from @@ got char * @@ kernel/bpf/helpers.c:3580:25: sparse: expected void const [noderef] __user *from kernel/bpf/helpers.c:3580:25: sparse: got char * kernel/bpf/helpers.c:3620:17: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected void const [noderef] __user *from @@ got char * @@ kernel/bpf/helpers.c:3620:17: sparse: expected void const [noderef] __user *from kernel/bpf/helpers.c:3620:17: sparse: got char * kernel/bpf/helpers.c:3624:25: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected void const [noderef] __user *from @@ got char * @@ kernel/bpf/helpers.c:3624:25: sparse: expected void const [noderef] __user *from kernel/bpf/helpers.c:3624:25: sparse: got char * kernel/bpf/helpers.c:3666:25: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected void const [noderef] __user *from @@ got char * @@ kernel/bpf/helpers.c:3666:25: sparse: expected void const [noderef] __user *from kernel/bpf/helpers.c:3666:25: sparse: got char * kernel/bpf/helpers.c:3669:25: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected void const [noderef] __user *from @@ got char * @@ kernel/bpf/helpers.c:3669:25: sparse: expected void const [noderef] __user *from kernel/bpf/helpers.c:3669:25: sparse: got char * >> kernel/bpf/helpers.c:3856:27: sparse: sparse: cast removes address space '__rcu' of expression >> kernel/bpf/helpers.c:3856:27: sparse: sparse: cast removes address space '__rcu' of expression >> kernel/bpf/helpers.c:3856:27: sparse: sparse: cast removes address space '__rcu' of expression >> kernel/bpf/helpers.c:3856:27: sparse: sparse: cast removes address space '__rcu' of expression >> kernel/bpf/helpers.c:3856:27: sparse: sparse: cast removes address space '__rcu' of expression >> kernel/bpf/helpers.c:3856:27: sparse: sparse: cast removes address space '__rcu' of expression >> kernel/bpf/helpers.c:3856:27: sparse: sparse: cast removes address space '__rcu' of expression kernel/bpf/helpers.c:2965:18: sparse: sparse: context imbalance in 'bpf_rcu_read_lock' - wrong count at exit kernel/bpf/helpers.c:2970:18: sparse: sparse: context imbalance in 'bpf_rcu_read_unlock' - unexpected unlock vim +/__rcu +3856 kernel/bpf/helpers.c 3838 3839 static struct bpf_task_work_context *bpf_task_work_context_acquire(struct bpf_task_work *tw, 3840 struct bpf_map *map) 3841 { 3842 struct bpf_task_work_context *ctx, *old_ctx; 3843 enum bpf_task_work_state state; 3844 struct bpf_task_work_context __force __rcu **ppc = 3845 (struct bpf_task_work_context __force __rcu **)&tw->ctx; 3846 3847 /* ctx pointer is RCU protected */ 3848 rcu_read_lock_trace(); 3849 ctx = rcu_dereference(*ppc); 3850 if (!ctx) { 3851 ctx = bpf_task_work_context_alloc(); 3852 if (!ctx) { 3853 rcu_read_unlock_trace(); 3854 return ERR_PTR(-ENOMEM); 3855 } > 3856 old_ctx = unrcu_pointer(cmpxchg(ppc, NULL, RCU_INITIALIZER(ctx))); 3857 /* 3858 * If ctx is set by another CPU, release allocated memory. 3859 * Do not fail, though, attempt stealing the work 3860 */ 3861 if (old_ctx) { 3862 bpf_mem_free(&bpf_global_ma, ctx); 3863 ctx = old_ctx; 3864 } 3865 } 3866 state = cmpxchg(&ctx->state, BPF_TW_STANDBY, BPF_TW_PENDING); 3867 /* 3868 * We can unlock RCU, because task work scheduler (this codepath) 3869 * now owns the ctx or returning an error 3870 */ 3871 rcu_read_unlock_trace(); 3872 if (state != BPF_TW_STANDBY) 3873 return ERR_PTR(-EBUSY); 3874 return ctx; 3875 } 3876 -- 0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki