From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=192.198.163.5 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796342194; b=gBwhOcgfVOdl5BcTnag+TLKwqLUHbrvAQrm8QAr08x5Q2GewnRGiE7/mYSBCzJ3my522 BSwyVpkO6ULTCLmCBxfXU9iS5Uha+TUKVrBDor+jkfRAgpTPGLgQjx5VPbcA3ybq4kvLJ VVddgL0V5NrlCg/jMt5hoxfIEZHYTsNSgqjKcwZioEGnqPUTgojyaq4P9EUEqQG+5BPs3 2+kEEvN8JE3Kh3WylNTp1dmhWTxyISAb/hleE2hVeK5WH1W6Bb0yXAZ+wRbMNAGOci+8B gxCORVPeTHJ/qVPQSuuXeYzVoTyTPrNB3wOEZ4m/Q6ZaRZ5ccZxzo4pkbMgjQNLYKLQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796342194; h=DMARC-Filter:DKIM-Signature:X-CSE-ConnectionGUID:X-CSE-MsgGUID: X-IronPort-AV:X-IronPort-AV:Received:X-CSE-ConnectionGUID: X-CSE-MsgGUID:X-ExtLoop1:X-IronPort-AV:Received:Received:Date:From:To: Cc:Subject:Message-ID:User-Agent; bh=Uug534L6czDpSmoYC+1/2KICFG+uj/B5nCqq36LP9vY=; b=jVRqLZRax7lKD84YcK3cV2mqBQxCQ/L2ed0BKv7Km7wWQn+UB6utqLk1wCiWXO6EV+vt h1/bPbVLpk+YldOcK3NV4fburXn8Mz8F4jrCYOdnjoWIYsLHZEacV66zJGuC1ClOlG/75 4fya31gXO88EpXzPXSYHvjYuA+8hLT716fhktA2wNmpv9WRdosP3+V0bwb0MpCIk6tmjh JDPuOHdslvLbkfW9PULwScanwy2DW5ganBCAPFwepQneRfh+yR0VH+4UNwANshdcWlKTf jSxg56f6jC72XgYbi/zfWxXnHvGsJH5NA1q8HINRL0SFPyv8YTDmVEQpfy4u456963Q== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=ioIRAUTE; arc=none smtp.remote-ip=192.198.163.5 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.5]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 269E7606A32F for ; Thu, 3 Dec 2026 23:56:34 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 269E7606A32F Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=ioIRAUTE DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1796342194; x=1827878194; h=date:from:to:cc:subject:message-id; bh=KPUAm9IsC1raPPMQ6a/7umf6LxUNkS4f8tkHt+AmC1w=; b=ioIRAUTEqK0+XLd/1SYKLH2gx3dDCezBfVXthCh1zuNCnJQEr+VXXKka uAyE5HwsWBFvRmw1E+qv2YPzpofepCzyUap1TzqLG/JeZRIxfvqppAGHz +NknmeRaHtjlD9Ntm63XtqphSKGSX5vBX8pKi1yNtt3Wh8DlOOgx8r0mt 01p+jHcn975cSgChPrpTgJW0kBqqQ+xxBIm9ImQWkdUX9p6SHBWE2eepD IpqU91dTGutBFXcqHGR8WfrcJvFhWtq1nIiB8TVX9/oqutIDFhShoMNjr Iy7I99SV+ygSLLDLkN7gcnARAd6okrMJ5Xag4ExBczvI79vW2yGsa5CUc g==; X-CSE-ConnectionGUID: Q7p3NNJOQj+hkszWh99nSw== X-CSE-MsgGUID: 0JrXmV0aQVCZvfEAaX3AHA== X-IronPort-AV: E=McAfee;i="6800,10657,11985"; a="41872" X-IronPort-AV: E=Sophos;i="6.29,77,1794902400"; d="scan'208";a="41872" Received: from fmviesa008.fm.intel.com ([10.60.135.148]) by fmvoesa115.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Dec 2026 15:56:32 -0800 X-CSE-ConnectionGUID: 31Gn1xK9R+yLCPbN7oYYaw== X-CSE-MsgGUID: 8W+NI/vCR9qt6FmoJ0ePgw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.29,77,1794902400"; d="scan'208";a="14063510" Received: from igk-lkp-server01.igk.intel.com (HELO 146cf1e082f1) ([10.211.93.152]) by fmviesa008.fm.intel.com with ESMTP; 03 Dec 2026 15:56:31 -0800 Received: from kbuild by 146cf1e082f1 with local (Exim 4.98.2) (envelope-from ) id 1xZGf7-0000000043a-0YEO; Thu, 03 Dec 2026 23:56:29 +0000 Date: Fri, 04 Dec 2026 00:56:09 +0100 From: kernel test robot To: oe-kbuild@lists.linux.dev Cc: lkp@intel.com Subject: [kkdwivedi:xdp-round 101/158] kernel/bpf/kthread.c:269:19: sparse: sparse: Initializer entry defined twice Message-ID: <20261204005014.pxLkWuMq-lkp@intel.com> User-Agent: s-nail v14.9.25 X-Mailing-List: oe-kbuild@lists.linux.dev List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list :::::: :::::: Manual check reason: "sparse: Initializer entry defined twice" :::::: BCC: lkp@intel.com CC: oe-kbuild-all@lists.linux.dev TO: Kumar Kartikeya Dwivedi tree: https://github.com/kkdwivedi/linux xdp-round head: 361f52ba3cbe52e09f9c24068695693baef5ba3c commit: 77abcab07231b6d85931d3b241d932d172eadb3d [101/158] bpf: Add BPF kthreads for syscall programs :::::: branch date: 12 hours ago :::::: commit date: 12 hours ago config: parisc-randconfig-r2311-20261203 (https://download.01.org/0day-ci/archive/20261204/20261204005014.pxLkWuMq-lkp@intel.com/config) compiler: hppa-linux-gcc (GCC) 8.5.0 sparse: v0.6.5-rc1-94-g0d159c10 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20261204/20261204005014.pxLkWuMq-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 | Closes: https://lore.kernel.org/r/20261204005014.pxLkWuMq-lkp@intel.com/ sparse warnings: (new ones prefixed by >>) >> kernel/bpf/kthread.c:269:19: sparse: sparse: Initializer entry defined twice kernel/bpf/kthread.c:269:19: sparse: also defined here vim +269 kernel/bpf/kthread.c 77abcab07231b6d Kumar Kartikeya Dwivedi 2026-10-22 233 77abcab07231b6d Kumar Kartikeya Dwivedi 2026-10-22 234 /** 77abcab07231b6d Kumar Kartikeya Dwivedi 2026-10-22 235 * bpf_kthread_create - Create a kernel thread that runs a BPF callback 77abcab07231b6d Kumar Kartikeya Dwivedi 2026-10-22 236 * @callback_fn: the thread's body, run once; its return ends the thread 77abcab07231b6d Kumar Kartikeya Dwivedi 2026-10-22 237 * @arg: passed to @callback_fn as its only argument 77abcab07231b6d Kumar Kartikeya Dwivedi 2026-10-22 238 * @flags: must be 0 77abcab07231b6d Kumar Kartikeya Dwivedi 2026-10-22 239 * @aux: the calling program, set by the verifier 77abcab07231b6d Kumar Kartikeya Dwivedi 2026-10-22 240 * 77abcab07231b6d Kumar Kartikeya Dwivedi 2026-10-22 241 * Creates a kernel thread named bpfk/: without starting it, 77abcab07231b6d Kumar Kartikeya Dwivedi 2026-10-22 242 * the index counting the program's creations so that its threads are told 77abcab07231b6d Kumar Kartikeya Dwivedi 2026-10-22 243 * apart in ps, top and traces; the prefix is short so that both numbers fit 77abcab07231b6d Kumar Kartikeya Dwivedi 2026-10-22 244 * the comm that tracepoints and perf report as long as they have nine digits 77abcab07231b6d Kumar Kartikeya Dwivedi 2026-10-22 245 * between them, where /proc shows the full name in any case. bpf_kthread_start() 77abcab07231b6d Kumar Kartikeya Dwivedi 2026-10-22 246 * runs @callback_fn on it with @arg. The thread ends when the callback returns, 77abcab07231b6d Kumar Kartikeya Dwivedi 2026-10-22 247 * when bpf_kthread_stop() stops it, or with the last reference on the program 77abcab07231b6d Kumar Kartikeya Dwivedi 2026-10-22 248 * that created it. A thread whose callback has returned keeps its return value 77abcab07231b6d Kumar Kartikeya Dwivedi 2026-10-22 249 * until bpf_kthread_stop() collects it. 77abcab07231b6d Kumar Kartikeya Dwivedi 2026-10-22 250 * 77abcab07231b6d Kumar Kartikeya Dwivedi 2026-10-22 251 * The creation waits for kthreadd with migration enabled, so the caller may 77abcab07231b6d Kumar Kartikeya Dwivedi 2026-10-22 252 * return on another CPU. 77abcab07231b6d Kumar Kartikeya Dwivedi 2026-10-22 253 * 77abcab07231b6d Kumar Kartikeya Dwivedi 2026-10-22 254 * Return: the thread's task with a reference the program must release, or NULL 77abcab07231b6d Kumar Kartikeya Dwivedi 2026-10-22 255 * if @flags is not 0, the thread could not be created, or the program is being 77abcab07231b6d Kumar Kartikeya Dwivedi 2026-10-22 256 * freed. 77abcab07231b6d Kumar Kartikeya Dwivedi 2026-10-22 257 */ 77abcab07231b6d Kumar Kartikeya Dwivedi 2026-10-22 258 __bpf_kfunc struct task_struct *bpf_kthread_create(int (callback_fn)(u64 arg), u64 arg, 77abcab07231b6d Kumar Kartikeya Dwivedi 2026-10-22 259 u64 flags, struct bpf_prog_aux *aux) 77abcab07231b6d Kumar Kartikeya Dwivedi 2026-10-22 260 { 77abcab07231b6d Kumar Kartikeya Dwivedi 2026-10-22 261 struct bpf_kthread *kthread; 77abcab07231b6d Kumar Kartikeya Dwivedi 2026-10-22 262 unsigned long irqflags; 77abcab07231b6d Kumar Kartikeya Dwivedi 2026-10-22 263 struct task_struct *task; 77abcab07231b6d Kumar Kartikeya Dwivedi 2026-10-22 264 struct bpf_prog *prog; 77abcab07231b6d Kumar Kartikeya Dwivedi 2026-10-22 265 77abcab07231b6d Kumar Kartikeya Dwivedi 2026-10-22 266 if (flags) 77abcab07231b6d Kumar Kartikeya Dwivedi 2026-10-22 267 return NULL; 77abcab07231b6d Kumar Kartikeya Dwivedi 2026-10-22 268 77abcab07231b6d Kumar Kartikeya Dwivedi 2026-10-22 @269 kthread = kzalloc_obj(*kthread, GFP_KERNEL_ACCOUNT); 77abcab07231b6d Kumar Kartikeya Dwivedi 2026-10-22 270 if (!kthread) 77abcab07231b6d Kumar Kartikeya Dwivedi 2026-10-22 271 return NULL; 77abcab07231b6d Kumar Kartikeya Dwivedi 2026-10-22 272 kthread->aux = aux; 77abcab07231b6d Kumar Kartikeya Dwivedi 2026-10-22 273 kthread->callback_fn = callback_fn; 77abcab07231b6d Kumar Kartikeya Dwivedi 2026-10-22 274 kthread->arg = arg; 77abcab07231b6d Kumar Kartikeya Dwivedi 2026-10-22 275 77abcab07231b6d Kumar Kartikeya Dwivedi 2026-10-22 276 /* 77abcab07231b6d Kumar Kartikeya Dwivedi 2026-10-22 277 * The creation waits for kthreadd, and kthreadd's fork takes the 77abcab07231b6d Kumar Kartikeya Dwivedi 2026-10-22 278 * threadgroup rwsem that a cgroup move of this task holds while it 77abcab07231b6d Kumar Kartikeya Dwivedi 2026-10-22 279 * waits for this task to enable migration: see the comment at the top. 77abcab07231b6d Kumar Kartikeya Dwivedi 2026-10-22 280 */ 77abcab07231b6d Kumar Kartikeya Dwivedi 2026-10-22 281 migrate_enable(); 77abcab07231b6d Kumar Kartikeya Dwivedi 2026-10-22 282 task = kthread_create(bpf_kthread_fn, kthread, "bpfk/%u:%u", aux->id, 77abcab07231b6d Kumar Kartikeya Dwivedi 2026-10-22 283 atomic_fetch_inc(&aux->kthread_seq)); 77abcab07231b6d Kumar Kartikeya Dwivedi 2026-10-22 284 if (IS_ERR(task)) { 77abcab07231b6d Kumar Kartikeya Dwivedi 2026-10-22 285 bpf_kthread_wait_end(aux); 77abcab07231b6d Kumar Kartikeya Dwivedi 2026-10-22 286 kfree(kthread); 77abcab07231b6d Kumar Kartikeya Dwivedi 2026-10-22 287 return NULL; 77abcab07231b6d Kumar Kartikeya Dwivedi 2026-10-22 288 } 77abcab07231b6d Kumar Kartikeya Dwivedi 2026-10-22 289 kthread->task = get_task_struct(task); 77abcab07231b6d Kumar Kartikeya Dwivedi 2026-10-22 290 /* 77abcab07231b6d Kumar Kartikeya Dwivedi 2026-10-22 291 * The program's reference is the kind bpf_task_acquire() takes and 77abcab07231b6d Kumar Kartikeya Dwivedi 2026-10-22 292 * bpf_task_release() drops; the object's own, above, is the kind 77abcab07231b6d Kumar Kartikeya Dwivedi 2026-10-22 293 * kthread_stop_put() drops. Take it before the thread is published: 77abcab07231b6d Kumar Kartikeya Dwivedi 2026-10-22 294 * from then on any program may stop it, and a stopped thread's exit 77abcab07231b6d Kumar Kartikeya Dwivedi 2026-10-22 295 * drops the last reference the task had of its own. 77abcab07231b6d Kumar Kartikeya Dwivedi 2026-10-22 296 */ 77abcab07231b6d Kumar Kartikeya Dwivedi 2026-10-22 297 refcount_inc(&task->rcu_users); 77abcab07231b6d Kumar Kartikeya Dwivedi 2026-10-22 298 77abcab07231b6d Kumar Kartikeya Dwivedi 2026-10-22 299 /* 77abcab07231b6d Kumar Kartikeya Dwivedi 2026-10-22 300 * Run the thread up to its park. The generic kthread prologue, which 77abcab07231b6d Kumar Kartikeya Dwivedi 2026-10-22 301 * runs first, resets the affinity to the default for the thread's 77abcab07231b6d Kumar Kartikeya Dwivedi 2026-10-22 302 * node, so that an affinity set from now on sticks. 77abcab07231b6d Kumar Kartikeya Dwivedi 2026-10-22 303 */ 77abcab07231b6d Kumar Kartikeya Dwivedi 2026-10-22 304 kthread_park(task); 77abcab07231b6d Kumar Kartikeya Dwivedi 2026-10-22 305 bpf_kthread_wait_end(aux); 77abcab07231b6d Kumar Kartikeya Dwivedi 2026-10-22 306 77abcab07231b6d Kumar Kartikeya Dwivedi 2026-10-22 307 /* 77abcab07231b6d Kumar Kartikeya Dwivedi 2026-10-22 308 * Publish the thread while the program has a reference left to take. 77abcab07231b6d Kumar Kartikeya Dwivedi 2026-10-22 309 * Once it has none, the release of its last reference is pending or 77abcab07231b6d Kumar Kartikeya Dwivedi 2026-10-22 310 * under way, and a thread published after that release looked would 77abcab07231b6d Kumar Kartikeya Dwivedi 2026-10-22 311 * survive the program. The reference taken here is dropped again at 77abcab07231b6d Kumar Kartikeya Dwivedi 2026-10-22 312 * once: the release cannot start before it is, and the thread is on 77abcab07231b6d Kumar Kartikeya Dwivedi 2026-10-22 313 * the lists by then. 77abcab07231b6d Kumar Kartikeya Dwivedi 2026-10-22 314 */ 77abcab07231b6d Kumar Kartikeya Dwivedi 2026-10-22 315 raw_spin_lock_irqsave(&bpf_kthreads_lock, irqflags); 77abcab07231b6d Kumar Kartikeya Dwivedi 2026-10-22 316 prog = bpf_prog_inc_not_zero(aux->prog); 77abcab07231b6d Kumar Kartikeya Dwivedi 2026-10-22 317 if (IS_ERR(prog)) { 77abcab07231b6d Kumar Kartikeya Dwivedi 2026-10-22 318 raw_spin_unlock_irqrestore(&bpf_kthreads_lock, irqflags); 77abcab07231b6d Kumar Kartikeya Dwivedi 2026-10-22 319 migrate_enable(); 77abcab07231b6d Kumar Kartikeya Dwivedi 2026-10-22 320 bpf_kthread_stop_and_free(kthread); 77abcab07231b6d Kumar Kartikeya Dwivedi 2026-10-22 321 bpf_kthread_wait_end(aux); 77abcab07231b6d Kumar Kartikeya Dwivedi 2026-10-22 322 put_task_struct_rcu_user(task); 77abcab07231b6d Kumar Kartikeya Dwivedi 2026-10-22 323 return NULL; 77abcab07231b6d Kumar Kartikeya Dwivedi 2026-10-22 324 } 77abcab07231b6d Kumar Kartikeya Dwivedi 2026-10-22 325 list_add_tail(&kthread->node, &bpf_kthreads); 77abcab07231b6d Kumar Kartikeya Dwivedi 2026-10-22 326 list_add_tail(&kthread->prog_node, &aux->kthreads); 77abcab07231b6d Kumar Kartikeya Dwivedi 2026-10-22 327 raw_spin_unlock_irqrestore(&bpf_kthreads_lock, irqflags); 77abcab07231b6d Kumar Kartikeya Dwivedi 2026-10-22 328 bpf_prog_put(prog); 77abcab07231b6d Kumar Kartikeya Dwivedi 2026-10-22 329 return task; 77abcab07231b6d Kumar Kartikeya Dwivedi 2026-10-22 330 } 77abcab07231b6d Kumar Kartikeya Dwivedi 2026-10-22 331 -- 0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki