Linux block layer
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: Nilay Shroff <nilay@linux.ibm.com>, linux-block@vger.kernel.org
Cc: oe-kbuild-all@lists.linux.dev, hch@lst.de, ming.lei@redhat.com,
	axboe@kernel.dk, sth@linux.ibm.com, gjoyce@ibm.com
Subject: Re: [PATCHv5 2/3] block: fix lockdep warning caused by lock dependency in elv_iosched_store
Date: Mon, 30 Jun 2025 03:52:14 +0800	[thread overview]
Message-ID: <202506300509.2S1tygch-lkp@intel.com> (raw)
In-Reply-To: <20250627175544.1063910-3-nilay@linux.ibm.com>

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@intel.com/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@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202506300509.2S1tygch-lkp@intel.com/

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	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

  reply	other threads:[~2025-06-29 19:52 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-27 17:55 [PATCHv5 0/3] block: move sched_tags allocation/de-allocation outside of locking context Nilay Shroff
2025-06-27 17:55 ` [PATCHv5 1/3] block: move elevator queue allocation logic into blk_mq_init_sched Nilay Shroff
2025-06-27 17:55 ` [PATCHv5 2/3] block: fix lockdep warning caused by lock dependency in elv_iosched_store Nilay Shroff
2025-06-29 19:52   ` kernel test robot [this message]
2025-06-30  5:47     ` Nilay Shroff
2025-06-27 17:55 ` [PATCHv5 3/3] block: fix potential deadlock while running nr_hw_queue update Nilay Shroff

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=202506300509.2S1tygch-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=axboe@kernel.dk \
    --cc=gjoyce@ibm.com \
    --cc=hch@lst.de \
    --cc=linux-block@vger.kernel.org \
    --cc=ming.lei@redhat.com \
    --cc=nilay@linux.ibm.com \
    --cc=oe-kbuild-all@lists.linux.dev \
    --cc=sth@linux.ibm.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox