On 6/30/25 1:22 AM, kernel test robot wrote: > Hi Nilay, > > kernel test robot noticed the following build warnings: > > [auto build test WARNING on axboe-block/for-next] > [also build test WARNING on linus/master v6.16-rc3 next-20250627] > [cannot apply to hch-configfs/for-next] > [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/Nilay-Shroff/block-move-elevator-queue-allocation-logic-into-blk_mq_init_sched/20250628-020013 > base: https://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux-block.git for-next > patch link: https://lore.kernel.org/r/20250627175544.1063910-3-nilay%40linux.ibm.com > patch subject: [PATCHv5 2/3] block: fix lockdep warning caused by lock dependency in elv_iosched_store > config: i386-randconfig-r072-20250629 (https://download.01.org/0day-ci/archive/20250630/202506300509.2S1tygch-lkp@xxxxxxxxx/config) > compiler: clang version 20.1.7 (https://github.com/llvm/llvm-project 6146a88f60492b520a36f8f8f3231e15f3cc6082) > > 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/202506300509.2S1tygch-lkp@xxxxxxxxx/ > > New smatch warnings: > block/blk-mq-sched.c:472 blk_mq_alloc_sched_tags() warn: always true condition '(--i >= 0) => (0-u32max >= 0)' > block/blk-mq-sched.c:472 blk_mq_alloc_sched_tags() warn: always true condition '(--i >= 0) => (0-u32max >= 0)' > > Old smatch warnings: > block/blk-mq-sched.c:383 blk_mq_sched_tags_teardown() warn: iterator 'i' not incremented > block/blk-mq-sched.c:397 blk_mq_sched_reg_debugfs() warn: iterator 'i' not incremented > block/blk-mq-sched.c:408 blk_mq_sched_unreg_debugfs() warn: iterator 'i' not incremented > block/blk-mq-sched.c:512 blk_mq_init_sched() warn: iterator 'i' not incremented > block/blk-mq-sched.c:544 blk_mq_sched_free_rqs() warn: iterator 'i' not incremented > block/blk-mq-sched.c:558 blk_mq_exit_sched() warn: iterator 'i' not incremented > > vim +472 block/blk-mq-sched.c > > 429 > 430 struct elevator_tags *blk_mq_alloc_sched_tags(struct blk_mq_tag_set *set, > 431 unsigned int nr_hw_queues) > 432 { > 433 unsigned int nr_tags, i; > 434 struct elevator_tags *et; > 435 gfp_t gfp = GFP_NOIO | __GFP_ZERO | __GFP_NOWARN | __GFP_NORETRY; > 436 > 437 if (blk_mq_is_shared_tags(set->flags)) > 438 nr_tags = 1; > 439 else > 440 nr_tags = nr_hw_queues; > 441 > 442 et = kmalloc(sizeof(struct elevator_tags) + > 443 nr_tags * sizeof(struct blk_mq_tags *), gfp); > 444 if (!et) > 445 return NULL; > 446 /* > 447 * Default to double of smaller one between hw queue_depth and > 448 * 128, since we don't split into sync/async like the old code > 449 * did. Additionally, this is a per-hw queue depth. > 450 */ > 451 et->nr_requests = 2 * min_t(unsigned int, set->queue_depth, > 452 BLKDEV_DEFAULT_RQ); > 453 et->nr_hw_queues = nr_hw_queues; > 454 > 455 if (blk_mq_is_shared_tags(set->flags)) { > 456 /* Shared tags are stored at index 0 in @tags. */ > 457 et->tags[0] = blk_mq_alloc_map_and_rqs(set, BLK_MQ_NO_HCTX_IDX, > 458 MAX_SCHED_RQ); > 459 if (!et->tags[0]) > 460 goto out; > 461 } else { > 462 for (i = 0; i < et->nr_hw_queues; i++) { > 463 et->tags[i] = blk_mq_alloc_map_and_rqs(set, i, > 464 et->nr_requests); > 465 if (!et->tags[i]) > 466 goto out_unwind; > 467 } > 468 } > 469 > 470 return et; > 471 out_unwind: > > 472 while (--i >= 0) > 473 blk_mq_free_map_and_rqs(set, et->tags[i], i); > 474 out: > 475 kfree(et); > 476 return NULL; > 477 } > 478 > Thanks for the report! I've fixed this warning and the fix is on its way... --Nilay