From: kernel test robot <lkp@intel.com>
To: oe-kbuild@lists.linux.dev
Cc: lkp@intel.com, Julia Lawall <julia.lawall@inria.fr>
Subject: fs/bcachefs/rcu_pending.c:447:1-7: preceding lock on line 375
Date: Mon, 28 Oct 2024 11:52:34 +0800 [thread overview]
Message-ID: <202410281132.ybQAzCfz-lkp@intel.com> (raw)
BCC: lkp@intel.com
CC: oe-kbuild-all@lists.linux.dev
CC: linux-kernel@vger.kernel.org
TO: Kent Overstreet <kent.overstreet@linux.dev>
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 81983758430957d9a5cb3333fe324fd70cf63e7e
commit: 8e973a4f3c74824ef03ed06006726321bc2346d6 bcachefs: rcu_pending
date: 7 weeks ago
:::::: branch date: 5 hours ago
:::::: commit date: 7 weeks ago
config: m68k-randconfig-r051-20241027 (https://download.01.org/0day-ci/archive/20241028/202410281132.ybQAzCfz-lkp@intel.com/config)
compiler: m68k-linux-gcc (GCC) 14.1.0
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>
| Reported-by: Julia Lawall <julia.lawall@inria.fr>
| Closes: https://lore.kernel.org/r/202410281132.ybQAzCfz-lkp@intel.com/
cocci warnings: (new ones prefixed by >>)
>> fs/bcachefs/rcu_pending.c:447:1-7: preceding lock on line 375
>> fs/bcachefs/rcu_pending.c:447:1-7: preceding lock on line 375
fs/bcachefs/rcu_pending.c:447:1-7: preceding lock on line 466
vim +447 fs/bcachefs/rcu_pending.c
8e973a4f3c7482 Kent Overstreet 2024-06-10 364
8e973a4f3c7482 Kent Overstreet 2024-06-10 365 struct rcu_pending_pcpu *p;
8e973a4f3c7482 Kent Overstreet 2024-06-10 366 struct rcu_pending_seq *objs;
8e973a4f3c7482 Kent Overstreet 2024-06-10 367 struct genradix_node *new_node = NULL;
8e973a4f3c7482 Kent Overstreet 2024-06-10 368 unsigned long seq, flags;
8e973a4f3c7482 Kent Overstreet 2024-06-10 369 bool start_gp = false;
8e973a4f3c7482 Kent Overstreet 2024-06-10 370
8e973a4f3c7482 Kent Overstreet 2024-06-10 371 BUG_ON((ptr != NULL) != (pending->process == RCU_PENDING_KVFREE_FN));
8e973a4f3c7482 Kent Overstreet 2024-06-10 372
8e973a4f3c7482 Kent Overstreet 2024-06-10 373 local_irq_save(flags);
8e973a4f3c7482 Kent Overstreet 2024-06-10 374 p = this_cpu_ptr(pending->p);
8e973a4f3c7482 Kent Overstreet 2024-06-10 @375 spin_lock(&p->lock);
8e973a4f3c7482 Kent Overstreet 2024-06-10 376 seq = __get_state_synchronize_rcu(pending->srcu);
8e973a4f3c7482 Kent Overstreet 2024-06-10 377 restart:
8e973a4f3c7482 Kent Overstreet 2024-06-10 378 if (may_sleep &&
8e973a4f3c7482 Kent Overstreet 2024-06-10 379 unlikely(process_finished_items(pending, p, flags)))
8e973a4f3c7482 Kent Overstreet 2024-06-10 380 goto check_expired;
8e973a4f3c7482 Kent Overstreet 2024-06-10 381
8e973a4f3c7482 Kent Overstreet 2024-06-10 382 /*
8e973a4f3c7482 Kent Overstreet 2024-06-10 383 * In kvfree_rcu() mode, the radix tree is only for slab pointers so
8e973a4f3c7482 Kent Overstreet 2024-06-10 384 * that we can do kfree_bulk() - vmalloc pointers always use the linked
8e973a4f3c7482 Kent Overstreet 2024-06-10 385 * list:
8e973a4f3c7482 Kent Overstreet 2024-06-10 386 */
8e973a4f3c7482 Kent Overstreet 2024-06-10 387 if (ptr && unlikely(is_vmalloc_addr(ptr)))
8e973a4f3c7482 Kent Overstreet 2024-06-10 388 goto list_add;
8e973a4f3c7482 Kent Overstreet 2024-06-10 389
8e973a4f3c7482 Kent Overstreet 2024-06-10 390 objs = get_object_radix(p, seq);
8e973a4f3c7482 Kent Overstreet 2024-06-10 391 if (unlikely(!objs))
8e973a4f3c7482 Kent Overstreet 2024-06-10 392 goto list_add;
8e973a4f3c7482 Kent Overstreet 2024-06-10 393
8e973a4f3c7482 Kent Overstreet 2024-06-10 394 if (unlikely(!objs->cursor)) {
8e973a4f3c7482 Kent Overstreet 2024-06-10 395 /*
8e973a4f3c7482 Kent Overstreet 2024-06-10 396 * New radix tree nodes must be added under @p->lock because the
8e973a4f3c7482 Kent Overstreet 2024-06-10 397 * tree root is in a darray that can be resized (typically,
8e973a4f3c7482 Kent Overstreet 2024-06-10 398 * genradix supports concurrent unlocked allocation of new
8e973a4f3c7482 Kent Overstreet 2024-06-10 399 * nodes) - hence preallocation and the retry loop:
8e973a4f3c7482 Kent Overstreet 2024-06-10 400 */
8e973a4f3c7482 Kent Overstreet 2024-06-10 401 objs->cursor = genradix_ptr_alloc_preallocated_inlined(&objs->objs,
8e973a4f3c7482 Kent Overstreet 2024-06-10 402 objs->nr, &new_node, GFP_ATOMIC|__GFP_NOWARN);
8e973a4f3c7482 Kent Overstreet 2024-06-10 403 if (unlikely(!objs->cursor)) {
8e973a4f3c7482 Kent Overstreet 2024-06-10 404 if (may_sleep) {
8e973a4f3c7482 Kent Overstreet 2024-06-10 405 spin_unlock_irqrestore(&p->lock, flags);
8e973a4f3c7482 Kent Overstreet 2024-06-10 406
8e973a4f3c7482 Kent Overstreet 2024-06-10 407 gfp_t gfp = GFP_KERNEL;
8e973a4f3c7482 Kent Overstreet 2024-06-10 408 if (!head)
8e973a4f3c7482 Kent Overstreet 2024-06-10 409 gfp |= __GFP_NOFAIL;
8e973a4f3c7482 Kent Overstreet 2024-06-10 410
8e973a4f3c7482 Kent Overstreet 2024-06-10 411 new_node = genradix_alloc_node(gfp);
8e973a4f3c7482 Kent Overstreet 2024-06-10 412 if (!new_node)
8e973a4f3c7482 Kent Overstreet 2024-06-10 413 may_sleep = false;
8e973a4f3c7482 Kent Overstreet 2024-06-10 414 goto check_expired;
8e973a4f3c7482 Kent Overstreet 2024-06-10 415 }
8e973a4f3c7482 Kent Overstreet 2024-06-10 416 list_add:
8e973a4f3c7482 Kent Overstreet 2024-06-10 417 start_gp = rcu_pending_enqueue_list(p, seq, head, ptr, &flags);
8e973a4f3c7482 Kent Overstreet 2024-06-10 418 goto start_gp;
8e973a4f3c7482 Kent Overstreet 2024-06-10 419 }
8e973a4f3c7482 Kent Overstreet 2024-06-10 420 }
8e973a4f3c7482 Kent Overstreet 2024-06-10 421
8e973a4f3c7482 Kent Overstreet 2024-06-10 422 *objs->cursor++ = ptr ?: head;
8e973a4f3c7482 Kent Overstreet 2024-06-10 423 /* zero cursor if we hit the end of a radix tree node: */
8e973a4f3c7482 Kent Overstreet 2024-06-10 424 if (!(((ulong) objs->cursor) & (GENRADIX_NODE_SIZE - 1)))
8e973a4f3c7482 Kent Overstreet 2024-06-10 425 objs->cursor = NULL;
8e973a4f3c7482 Kent Overstreet 2024-06-10 426 start_gp = !objs->nr;
8e973a4f3c7482 Kent Overstreet 2024-06-10 427 objs->nr++;
8e973a4f3c7482 Kent Overstreet 2024-06-10 428 start_gp:
8e973a4f3c7482 Kent Overstreet 2024-06-10 429 if (unlikely(start_gp)) {
8e973a4f3c7482 Kent Overstreet 2024-06-10 430 /*
8e973a4f3c7482 Kent Overstreet 2024-06-10 431 * We only have one callback (ideally, we would have one for
8e973a4f3c7482 Kent Overstreet 2024-06-10 432 * every outstanding graceperiod) - so if our callback is
8e973a4f3c7482 Kent Overstreet 2024-06-10 433 * already in flight, we may still have to start a grace period
8e973a4f3c7482 Kent Overstreet 2024-06-10 434 * (since we used get_state() above, not start_poll())
8e973a4f3c7482 Kent Overstreet 2024-06-10 435 */
8e973a4f3c7482 Kent Overstreet 2024-06-10 436 if (!p->cb_armed) {
8e973a4f3c7482 Kent Overstreet 2024-06-10 437 p->cb_armed = true;
8e973a4f3c7482 Kent Overstreet 2024-06-10 438 __call_rcu(pending->srcu, &p->cb, rcu_pending_rcu_cb);
8e973a4f3c7482 Kent Overstreet 2024-06-10 439 } else {
8e973a4f3c7482 Kent Overstreet 2024-06-10 440 __start_poll_synchronize_rcu(pending->srcu);
8e973a4f3c7482 Kent Overstreet 2024-06-10 441 }
8e973a4f3c7482 Kent Overstreet 2024-06-10 442 }
8e973a4f3c7482 Kent Overstreet 2024-06-10 443 spin_unlock_irqrestore(&p->lock, flags);
8e973a4f3c7482 Kent Overstreet 2024-06-10 444 free_node:
8e973a4f3c7482 Kent Overstreet 2024-06-10 445 if (new_node)
8e973a4f3c7482 Kent Overstreet 2024-06-10 446 genradix_free_node(new_node);
8e973a4f3c7482 Kent Overstreet 2024-06-10 @447 return;
8e973a4f3c7482 Kent Overstreet 2024-06-10 448 check_expired:
8e973a4f3c7482 Kent Overstreet 2024-06-10 449 if (unlikely(__poll_state_synchronize_rcu(pending->srcu, seq))) {
8e973a4f3c7482 Kent Overstreet 2024-06-10 450 switch ((ulong) pending->process) {
8e973a4f3c7482 Kent Overstreet 2024-06-10 451 case RCU_PENDING_KVFREE:
8e973a4f3c7482 Kent Overstreet 2024-06-10 452 kvfree(ptr);
8e973a4f3c7482 Kent Overstreet 2024-06-10 453 break;
8e973a4f3c7482 Kent Overstreet 2024-06-10 454 case RCU_PENDING_CALL_RCU:
8e973a4f3c7482 Kent Overstreet 2024-06-10 455 head->func(head);
8e973a4f3c7482 Kent Overstreet 2024-06-10 456 break;
8e973a4f3c7482 Kent Overstreet 2024-06-10 457 default:
8e973a4f3c7482 Kent Overstreet 2024-06-10 458 pending->process(pending, head);
8e973a4f3c7482 Kent Overstreet 2024-06-10 459 break;
8e973a4f3c7482 Kent Overstreet 2024-06-10 460 }
8e973a4f3c7482 Kent Overstreet 2024-06-10 461 goto free_node;
8e973a4f3c7482 Kent Overstreet 2024-06-10 462 }
8e973a4f3c7482 Kent Overstreet 2024-06-10 463
8e973a4f3c7482 Kent Overstreet 2024-06-10 464 local_irq_save(flags);
8e973a4f3c7482 Kent Overstreet 2024-06-10 465 p = this_cpu_ptr(pending->p);
8e973a4f3c7482 Kent Overstreet 2024-06-10 466 spin_lock(&p->lock);
8e973a4f3c7482 Kent Overstreet 2024-06-10 467 goto restart;
8e973a4f3c7482 Kent Overstreet 2024-06-10 468 }
8e973a4f3c7482 Kent Overstreet 2024-06-10 469
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
next reply other threads:[~2024-10-28 3:53 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-28 3:52 kernel test robot [this message]
-- strict thread matches above, loose matches on Subject: below --
2024-12-06 2:59 fs/bcachefs/rcu_pending.c:447:1-7: preceding lock on line 375 kernel test robot
2024-10-13 8:00 kernel test robot
2024-09-30 2:22 kernel test robot
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=202410281132.ybQAzCfz-lkp@intel.com \
--to=lkp@intel.com \
--cc=julia.lawall@inria.fr \
--cc=oe-kbuild@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.