All of lore.kernel.org
 help / color / mirror / Atom feed
* Re: [PATCH V2 5/6] blk-mq: prepare for implementing hctx table via xarray
@ 2022-03-03 12:33 kernel test robot
  2022-03-09  3:01 ` kernel test robot
  0 siblings, 1 reply; 6+ messages in thread
From: kernel test robot @ 2022-03-03 12:33 UTC (permalink / raw)
  To: kbuild

[-- Attachment #1: Type: text/plain, Size: 4095 bytes --]

CC: kbuild-all(a)lists.01.org
BCC: lkp(a)intel.com
In-Reply-To: <20220302121407.1361401-6-ming.lei@redhat.com>
References: <20220302121407.1361401-6-ming.lei@redhat.com>
TO: Ming Lei <ming.lei@redhat.com>
TO: Jens Axboe <axboe@kernel.dk>
CC: linux-block(a)vger.kernel.org
CC: Yu Kuai <yukuai3@huawei.com>
CC: Ming Lei <ming.lei@redhat.com>

Hi Ming,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on axboe-block/for-next]
[also build test WARNING on v5.17-rc6 next-20220302]
[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]

url:    https://github.com/0day-ci/linux/commits/Ming-Lei/blk-mq-update_nr_hw_queues-related-improvement-bugfix/20220302-201636
base:   https://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux-block.git for-next
:::::: branch date: 24 hours ago
:::::: commit date: 24 hours ago
compiler: m68k-linux-gcc (GCC) 11.2.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>


cppcheck possible warnings: (new ones prefixed by >>, may not real problems)

>> block/blk-mq-sysfs.c:282:13: warning: Unsigned variable '--' can't be negative so it is unnecessary to test it. [unsignedPositive]
    while (--i >= 0)
               ^

vim +282 block/blk-mq-sysfs.c

67aec14ce87fe25 Jens Axboe      2014-05-30  254  
2d0364c8c1a97a1 Bart Van Assche 2017-04-26  255  int __blk_mq_register_dev(struct device *dev, struct request_queue *q)
320ae51feed5c2f Jens Axboe      2013-10-24  256  {
320ae51feed5c2f Jens Axboe      2013-10-24  257  	struct blk_mq_hw_ctx *hctx;
44849be579332ce Ming Lei        2022-03-02  258  	unsigned long i;
44849be579332ce Ming Lei        2022-03-02  259  	int ret;
320ae51feed5c2f Jens Axboe      2013-10-24  260  
2d0364c8c1a97a1 Bart Van Assche 2017-04-26  261  	WARN_ON_ONCE(!q->kobj.parent);
cecf5d87ff20351 Ming Lei        2019-08-27  262  	lockdep_assert_held(&q->sysfs_dir_lock);
4593fdbe7a2f44d Akinobu Mita    2015-09-27  263  
1db4909e76f64a8 Ming Lei        2018-11-20  264  	ret = kobject_add(q->mq_kobj, kobject_get(&dev->kobj), "%s", "mq");
320ae51feed5c2f Jens Axboe      2013-10-24  265  	if (ret < 0)
4593fdbe7a2f44d Akinobu Mita    2015-09-27  266  		goto out;
320ae51feed5c2f Jens Axboe      2013-10-24  267  
1db4909e76f64a8 Ming Lei        2018-11-20  268  	kobject_uevent(q->mq_kobj, KOBJ_ADD);
320ae51feed5c2f Jens Axboe      2013-10-24  269  
320ae51feed5c2f Jens Axboe      2013-10-24  270  	queue_for_each_hw_ctx(q, hctx, i) {
67aec14ce87fe25 Jens Axboe      2014-05-30  271  		ret = blk_mq_register_hctx(hctx);
320ae51feed5c2f Jens Axboe      2013-10-24  272  		if (ret)
f05d1ba7871a2c2 Bart Van Assche 2017-04-26  273  			goto unreg;
320ae51feed5c2f Jens Axboe      2013-10-24  274  	}
320ae51feed5c2f Jens Axboe      2013-10-24  275  
4593fdbe7a2f44d Akinobu Mita    2015-09-27  276  	q->mq_sysfs_init_done = true;
2d0364c8c1a97a1 Bart Van Assche 2017-04-26  277  
4593fdbe7a2f44d Akinobu Mita    2015-09-27  278  out:
2d0364c8c1a97a1 Bart Van Assche 2017-04-26  279  	return ret;
f05d1ba7871a2c2 Bart Van Assche 2017-04-26  280  
f05d1ba7871a2c2 Bart Van Assche 2017-04-26  281  unreg:
f05d1ba7871a2c2 Bart Van Assche 2017-04-26 @282  	while (--i >= 0)
f05d1ba7871a2c2 Bart Van Assche 2017-04-26  283  		blk_mq_unregister_hctx(q->queue_hw_ctx[i]);
f05d1ba7871a2c2 Bart Van Assche 2017-04-26  284  
1db4909e76f64a8 Ming Lei        2018-11-20  285  	kobject_uevent(q->mq_kobj, KOBJ_REMOVE);
1db4909e76f64a8 Ming Lei        2018-11-20  286  	kobject_del(q->mq_kobj);
f05d1ba7871a2c2 Bart Van Assche 2017-04-26  287  	kobject_put(&dev->kobj);
f05d1ba7871a2c2 Bart Van Assche 2017-04-26  288  	return ret;
2d0364c8c1a97a1 Bart Van Assche 2017-04-26  289  }
2d0364c8c1a97a1 Bart Van Assche 2017-04-26  290  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH V2 5/6] blk-mq: prepare for implementing hctx table via xarray
  2022-03-03 12:33 [PATCH V2 5/6] blk-mq: prepare for implementing hctx table via xarray kernel test robot
@ 2022-03-09  3:01 ` kernel test robot
  0 siblings, 0 replies; 6+ messages in thread
From: kernel test robot @ 2022-03-09  3:01 UTC (permalink / raw)
  To: Ming Lei, Jens Axboe; +Cc: kbuild-all, linux-block, Yu Kuai, Ming Lei

Hi Ming,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on axboe-block/for-next]
[also build test WARNING on v5.17-rc6 next-20220302]
[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]

url:    https://github.com/0day-ci/linux/commits/Ming-Lei/blk-mq-update_nr_hw_queues-related-improvement-bugfix/20220302-201636
base:   https://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux-block.git for-next
compiler: m68k-linux-gcc (GCC) 11.2.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <yujie.liu@intel.com>


cppcheck possible warnings: (new ones prefixed by >>, may not be real problems)

 >> block/blk-mq-sysfs.c:282:13: warning: Unsigned variable '--' can't be negative so it is unnecessary to test it. [unsignedPositive]
     while (--i >= 0)
                ^

vim +282 block/blk-mq-sysfs.c

67aec14ce87fe25 Jens Axboe      2014-05-30  254
2d0364c8c1a97a1 Bart Van Assche 2017-04-26  255  int __blk_mq_register_dev(struct device *dev, struct request_queue *q)
320ae51feed5c2f Jens Axboe      2013-10-24  256  {
320ae51feed5c2f Jens Axboe      2013-10-24  257  	struct blk_mq_hw_ctx *hctx;
44849be579332ce Ming Lei        2022-03-02 @258  	unsigned long i;
44849be579332ce Ming Lei        2022-03-02  259  	int ret;
320ae51feed5c2f Jens Axboe      2013-10-24  260
2d0364c8c1a97a1 Bart Van Assche 2017-04-26  261  	WARN_ON_ONCE(!q->kobj.parent);
cecf5d87ff20351 Ming Lei        2019-08-27  262  	lockdep_assert_held(&q->sysfs_dir_lock);
4593fdbe7a2f44d Akinobu Mita    2015-09-27  263
1db4909e76f64a8 Ming Lei        2018-11-20  264  	ret = kobject_add(q->mq_kobj, kobject_get(&dev->kobj), "%s", "mq");
320ae51feed5c2f Jens Axboe      2013-10-24  265  	if (ret < 0)
4593fdbe7a2f44d Akinobu Mita    2015-09-27  266  		goto out;
320ae51feed5c2f Jens Axboe      2013-10-24  267
1db4909e76f64a8 Ming Lei        2018-11-20  268  	kobject_uevent(q->mq_kobj, KOBJ_ADD);
320ae51feed5c2f Jens Axboe      2013-10-24  269
320ae51feed5c2f Jens Axboe      2013-10-24  270  	queue_for_each_hw_ctx(q, hctx, i) {
67aec14ce87fe25 Jens Axboe      2014-05-30  271  		ret = blk_mq_register_hctx(hctx);
320ae51feed5c2f Jens Axboe      2013-10-24  272  		if (ret)
f05d1ba7871a2c2 Bart Van Assche 2017-04-26  273  			goto unreg;
320ae51feed5c2f Jens Axboe      2013-10-24  274  	}
320ae51feed5c2f Jens Axboe      2013-10-24  275
4593fdbe7a2f44d Akinobu Mita    2015-09-27  276  	q->mq_sysfs_init_done = true;
2d0364c8c1a97a1 Bart Van Assche 2017-04-26  277
4593fdbe7a2f44d Akinobu Mita    2015-09-27  278  out:
2d0364c8c1a97a1 Bart Van Assche 2017-04-26  279  	return ret;
f05d1ba7871a2c2 Bart Van Assche 2017-04-26  280
f05d1ba7871a2c2 Bart Van Assche 2017-04-26  281  unreg:
f05d1ba7871a2c2 Bart Van Assche 2017-04-26 @282  	while (--i >= 0)
f05d1ba7871a2c2 Bart Van Assche 2017-04-26  283  		blk_mq_unregister_hctx(q->queue_hw_ctx[i]);
f05d1ba7871a2c2 Bart Van Assche 2017-04-26  284
1db4909e76f64a8 Ming Lei        2018-11-20  285  	kobject_uevent(q->mq_kobj, KOBJ_REMOVE);
1db4909e76f64a8 Ming Lei        2018-11-20  286  	kobject_del(q->mq_kobj);
f05d1ba7871a2c2 Bart Van Assche 2017-04-26  287  	kobject_put(&dev->kobj);
f05d1ba7871a2c2 Bart Van Assche 2017-04-26  288  	return ret;
2d0364c8c1a97a1 Bart Van Assche 2017-04-26  289  }
2d0364c8c1a97a1 Bart Van Assche 2017-04-26  290

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH V2 5/6] blk-mq: prepare for implementing hctx table via xarray
  2022-03-03  9:08   ` kernel test robot
@ 2022-03-03  9:31       ` Ming Lei
  0 siblings, 0 replies; 6+ messages in thread
From: Ming Lei @ 2022-03-03  9:31 UTC (permalink / raw)
  To: kernel test robot; +Cc: Jens Axboe, kbuild-all, linux-block, Yu Kuai

On Thu, Mar 03, 2022 at 05:08:47PM +0800, kernel test robot wrote:
> Hi Ming,
> 
> Thank you for the patch! Perhaps something to improve:
> 
> [auto build test WARNING on axboe-block/for-next]
> [also build test WARNING on v5.17-rc6 next-20220302]
> [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]
> 
> url:    https://github.com/0day-ci/linux/commits/Ming-Lei/blk-mq-update_nr_hw_queues-related-improvement-bugfix/20220302-201636
> base:   https://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux-block.git for-next
> config: m68k-randconfig-m031-20220302 (https://download.01.org/0day-ci/archive/20220303/202203031651.z0z86F6E-lkp@intel.com/config)
> compiler: m68k-linux-gcc (GCC) 11.2.0
> 
> If you fix the issue, kindly add following tag as appropriate
> Reported-by: kernel test robot <lkp@intel.com>
> 
> smatch warnings:
> block/blk-mq-sysfs.c:282 __blk_mq_register_dev() warn: always true condition '(--i >= 0) => (0-u32max >= 0)'
> block/blk-mq-sysfs.c:282 __blk_mq_register_dev() warn: always true condition '(--i >= 0) => (0-u32max >= 0)'

Good catch, will fix it by the following way in V3:

diff --git a/block/blk-mq-sysfs.c b/block/blk-mq-sysfs.c
index 6a7fb960e046..851faacc2f78 100644
--- a/block/blk-mq-sysfs.c
+++ b/block/blk-mq-sysfs.c
@@ -279,8 +279,8 @@ int __blk_mq_register_dev(struct device *dev, struct request_queue *q)
        return ret;

 unreg:
-       while (--i >= 0)
-               blk_mq_unregister_hctx(xa_load(&q->hctx_table, i));
+       queue_for_each_hw_ctx(q, hctx, i) {
+               blk_mq_unregister_hctx(hctx);

        kobject_uevent(q->mq_kobj, KOBJ_REMOVE);
        kobject_del(q->mq_kobj);



Thanks,
Ming


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH V2 5/6] blk-mq: prepare for implementing hctx table via xarray
@ 2022-03-03  9:31       ` Ming Lei
  0 siblings, 0 replies; 6+ messages in thread
From: Ming Lei @ 2022-03-03  9:31 UTC (permalink / raw)
  To: kbuild-all

[-- Attachment #1: Type: text/plain, Size: 1850 bytes --]

On Thu, Mar 03, 2022 at 05:08:47PM +0800, kernel test robot wrote:
> Hi Ming,
> 
> Thank you for the patch! Perhaps something to improve:
> 
> [auto build test WARNING on axboe-block/for-next]
> [also build test WARNING on v5.17-rc6 next-20220302]
> [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]
> 
> url:    https://github.com/0day-ci/linux/commits/Ming-Lei/blk-mq-update_nr_hw_queues-related-improvement-bugfix/20220302-201636
> base:   https://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux-block.git for-next
> config: m68k-randconfig-m031-20220302 (https://download.01.org/0day-ci/archive/20220303/202203031651.z0z86F6E-lkp(a)intel.com/config)
> compiler: m68k-linux-gcc (GCC) 11.2.0
> 
> If you fix the issue, kindly add following tag as appropriate
> Reported-by: kernel test robot <lkp@intel.com>
> 
> smatch warnings:
> block/blk-mq-sysfs.c:282 __blk_mq_register_dev() warn: always true condition '(--i >= 0) => (0-u32max >= 0)'
> block/blk-mq-sysfs.c:282 __blk_mq_register_dev() warn: always true condition '(--i >= 0) => (0-u32max >= 0)'

Good catch, will fix it by the following way in V3:

diff --git a/block/blk-mq-sysfs.c b/block/blk-mq-sysfs.c
index 6a7fb960e046..851faacc2f78 100644
--- a/block/blk-mq-sysfs.c
+++ b/block/blk-mq-sysfs.c
@@ -279,8 +279,8 @@ int __blk_mq_register_dev(struct device *dev, struct request_queue *q)
        return ret;

 unreg:
-       while (--i >= 0)
-               blk_mq_unregister_hctx(xa_load(&q->hctx_table, i));
+       queue_for_each_hw_ctx(q, hctx, i) {
+               blk_mq_unregister_hctx(hctx);

        kobject_uevent(q->mq_kobj, KOBJ_REMOVE);
        kobject_del(q->mq_kobj);



Thanks,
Ming

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH V2 5/6] blk-mq: prepare for implementing hctx table via xarray
  2022-03-02 12:14 ` [PATCH V2 5/6] blk-mq: prepare for implementing hctx table via xarray Ming Lei
@ 2022-03-03  9:08   ` kernel test robot
  2022-03-03  9:31       ` Ming Lei
  0 siblings, 1 reply; 6+ messages in thread
From: kernel test robot @ 2022-03-03  9:08 UTC (permalink / raw)
  To: Ming Lei, Jens Axboe; +Cc: kbuild-all, linux-block, Yu Kuai, Ming Lei

Hi Ming,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on axboe-block/for-next]
[also build test WARNING on v5.17-rc6 next-20220302]
[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]

url:    https://github.com/0day-ci/linux/commits/Ming-Lei/blk-mq-update_nr_hw_queues-related-improvement-bugfix/20220302-201636
base:   https://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux-block.git for-next
config: m68k-randconfig-m031-20220302 (https://download.01.org/0day-ci/archive/20220303/202203031651.z0z86F6E-lkp@intel.com/config)
compiler: m68k-linux-gcc (GCC) 11.2.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

smatch warnings:
block/blk-mq-sysfs.c:282 __blk_mq_register_dev() warn: always true condition '(--i >= 0) => (0-u32max >= 0)'
block/blk-mq-sysfs.c:282 __blk_mq_register_dev() warn: always true condition '(--i >= 0) => (0-u32max >= 0)'

vim +282 block/blk-mq-sysfs.c

67aec14ce87fe2 Jens Axboe      2014-05-30  254  
2d0364c8c1a97a Bart Van Assche 2017-04-26  255  int __blk_mq_register_dev(struct device *dev, struct request_queue *q)
320ae51feed5c2 Jens Axboe      2013-10-24  256  {
320ae51feed5c2 Jens Axboe      2013-10-24  257  	struct blk_mq_hw_ctx *hctx;
44849be579332c Ming Lei        2022-03-02  258  	unsigned long i;
44849be579332c Ming Lei        2022-03-02  259  	int ret;
320ae51feed5c2 Jens Axboe      2013-10-24  260  
2d0364c8c1a97a Bart Van Assche 2017-04-26  261  	WARN_ON_ONCE(!q->kobj.parent);
cecf5d87ff2035 Ming Lei        2019-08-27  262  	lockdep_assert_held(&q->sysfs_dir_lock);
4593fdbe7a2f44 Akinobu Mita    2015-09-27  263  
1db4909e76f64a Ming Lei        2018-11-20  264  	ret = kobject_add(q->mq_kobj, kobject_get(&dev->kobj), "%s", "mq");
320ae51feed5c2 Jens Axboe      2013-10-24  265  	if (ret < 0)
4593fdbe7a2f44 Akinobu Mita    2015-09-27  266  		goto out;
320ae51feed5c2 Jens Axboe      2013-10-24  267  
1db4909e76f64a Ming Lei        2018-11-20  268  	kobject_uevent(q->mq_kobj, KOBJ_ADD);
320ae51feed5c2 Jens Axboe      2013-10-24  269  
320ae51feed5c2 Jens Axboe      2013-10-24  270  	queue_for_each_hw_ctx(q, hctx, i) {
67aec14ce87fe2 Jens Axboe      2014-05-30  271  		ret = blk_mq_register_hctx(hctx);
320ae51feed5c2 Jens Axboe      2013-10-24  272  		if (ret)
f05d1ba7871a2c Bart Van Assche 2017-04-26  273  			goto unreg;
320ae51feed5c2 Jens Axboe      2013-10-24  274  	}
320ae51feed5c2 Jens Axboe      2013-10-24  275  
4593fdbe7a2f44 Akinobu Mita    2015-09-27  276  	q->mq_sysfs_init_done = true;
2d0364c8c1a97a Bart Van Assche 2017-04-26  277  
4593fdbe7a2f44 Akinobu Mita    2015-09-27  278  out:
2d0364c8c1a97a Bart Van Assche 2017-04-26  279  	return ret;
f05d1ba7871a2c Bart Van Assche 2017-04-26  280  
f05d1ba7871a2c Bart Van Assche 2017-04-26  281  unreg:
f05d1ba7871a2c Bart Van Assche 2017-04-26 @282  	while (--i >= 0)
f05d1ba7871a2c Bart Van Assche 2017-04-26  283  		blk_mq_unregister_hctx(q->queue_hw_ctx[i]);
f05d1ba7871a2c Bart Van Assche 2017-04-26  284  
1db4909e76f64a Ming Lei        2018-11-20  285  	kobject_uevent(q->mq_kobj, KOBJ_REMOVE);
1db4909e76f64a Ming Lei        2018-11-20  286  	kobject_del(q->mq_kobj);
f05d1ba7871a2c Bart Van Assche 2017-04-26  287  	kobject_put(&dev->kobj);
f05d1ba7871a2c Bart Van Assche 2017-04-26  288  	return ret;
2d0364c8c1a97a Bart Van Assche 2017-04-26  289  }
2d0364c8c1a97a Bart Van Assche 2017-04-26  290  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH V2 5/6] blk-mq: prepare for implementing hctx table via xarray
  2022-03-02 12:14 [PATCH V2 0/6] blk-mq: update_nr_hw_queues related improvement & bugfix Ming Lei
@ 2022-03-02 12:14 ` Ming Lei
  2022-03-03  9:08   ` kernel test robot
  0 siblings, 1 reply; 6+ messages in thread
From: Ming Lei @ 2022-03-02 12:14 UTC (permalink / raw)
  To: Jens Axboe; +Cc: linux-block, Yu Kuai, Ming Lei

It is inevitable to cause use-after-free on q->queue_hw_ctx between
queue_for_each_hw_ctx() and blk_mq_update_nr_hw_queues(). And converting
to xarray can fix the uaf, meantime code gets cleaner.

Prepare for converting q->queue_hctx_ctx into xarray, one thing is that
xa_for_each() can only accept 'unsigned long' as index, so changes type
of hctx index of queue_for_each_hw_ctx() into 'unsigned long'.

Signed-off-by: Ming Lei <ming.lei@redhat.com>
---
 block/blk-mq-debugfs.c        |  6 +++---
 block/blk-mq-sched.c          |  9 +++++----
 block/blk-mq-sysfs.c          | 10 ++++++----
 block/blk-mq-tag.c            |  2 +-
 block/blk-mq.c                | 30 ++++++++++++++++--------------
 drivers/block/rnbd/rnbd-clt.c |  2 +-
 6 files changed, 32 insertions(+), 27 deletions(-)

diff --git a/block/blk-mq-debugfs.c b/block/blk-mq-debugfs.c
index 3a790eb4995c..e2880f6deb34 100644
--- a/block/blk-mq-debugfs.c
+++ b/block/blk-mq-debugfs.c
@@ -707,7 +707,7 @@ static void debugfs_create_files(struct dentry *parent, void *data,
 void blk_mq_debugfs_register(struct request_queue *q)
 {
 	struct blk_mq_hw_ctx *hctx;
-	int i;
+	unsigned long i;
 
 	debugfs_create_files(q->debugfs_dir, q, blk_mq_debugfs_queue_attrs);
 
@@ -780,7 +780,7 @@ void blk_mq_debugfs_unregister_hctx(struct blk_mq_hw_ctx *hctx)
 void blk_mq_debugfs_register_hctxs(struct request_queue *q)
 {
 	struct blk_mq_hw_ctx *hctx;
-	int i;
+	unsigned long i;
 
 	queue_for_each_hw_ctx(q, hctx, i)
 		blk_mq_debugfs_register_hctx(q, hctx);
@@ -789,7 +789,7 @@ void blk_mq_debugfs_register_hctxs(struct request_queue *q)
 void blk_mq_debugfs_unregister_hctxs(struct request_queue *q)
 {
 	struct blk_mq_hw_ctx *hctx;
-	int i;
+	unsigned long i;
 
 	queue_for_each_hw_ctx(q, hctx, i)
 		blk_mq_debugfs_unregister_hctx(hctx);
diff --git a/block/blk-mq-sched.c b/block/blk-mq-sched.c
index 55488ba97823..e6ad8f761474 100644
--- a/block/blk-mq-sched.c
+++ b/block/blk-mq-sched.c
@@ -515,7 +515,7 @@ static void blk_mq_exit_sched_shared_tags(struct request_queue *queue)
 static void blk_mq_sched_tags_teardown(struct request_queue *q, unsigned int flags)
 {
 	struct blk_mq_hw_ctx *hctx;
-	int i;
+	unsigned long i;
 
 	queue_for_each_hw_ctx(q, hctx, i) {
 		if (hctx->sched_tags) {
@@ -550,9 +550,10 @@ static int blk_mq_init_sched_shared_tags(struct request_queue *queue)
 
 int blk_mq_init_sched(struct request_queue *q, struct elevator_type *e)
 {
-	unsigned int i, flags = q->tag_set->flags;
+	unsigned int flags = q->tag_set->flags;
 	struct blk_mq_hw_ctx *hctx;
 	struct elevator_queue *eq;
+	unsigned long i;
 	int ret;
 
 	if (!e) {
@@ -618,7 +619,7 @@ int blk_mq_init_sched(struct request_queue *q, struct elevator_type *e)
 void blk_mq_sched_free_rqs(struct request_queue *q)
 {
 	struct blk_mq_hw_ctx *hctx;
-	int i;
+	unsigned long i;
 
 	if (blk_mq_is_shared_tags(q->tag_set->flags)) {
 		blk_mq_free_rqs(q->tag_set, q->sched_shared_tags,
@@ -635,7 +636,7 @@ void blk_mq_sched_free_rqs(struct request_queue *q)
 void blk_mq_exit_sched(struct request_queue *q, struct elevator_queue *e)
 {
 	struct blk_mq_hw_ctx *hctx;
-	unsigned int i;
+	unsigned long i;
 	unsigned int flags = 0;
 
 	queue_for_each_hw_ctx(q, hctx, i) {
diff --git a/block/blk-mq-sysfs.c b/block/blk-mq-sysfs.c
index 674786574075..8d8c71c77ff8 100644
--- a/block/blk-mq-sysfs.c
+++ b/block/blk-mq-sysfs.c
@@ -206,7 +206,7 @@ static int blk_mq_register_hctx(struct blk_mq_hw_ctx *hctx)
 void blk_mq_unregister_dev(struct device *dev, struct request_queue *q)
 {
 	struct blk_mq_hw_ctx *hctx;
-	int i;
+	unsigned long i;
 
 	lockdep_assert_held(&q->sysfs_dir_lock);
 
@@ -255,7 +255,8 @@ void blk_mq_sysfs_init(struct request_queue *q)
 int __blk_mq_register_dev(struct device *dev, struct request_queue *q)
 {
 	struct blk_mq_hw_ctx *hctx;
-	int ret, i;
+	unsigned long i;
+	int ret;
 
 	WARN_ON_ONCE(!q->kobj.parent);
 	lockdep_assert_held(&q->sysfs_dir_lock);
@@ -290,7 +291,7 @@ int __blk_mq_register_dev(struct device *dev, struct request_queue *q)
 void blk_mq_sysfs_unregister(struct request_queue *q)
 {
 	struct blk_mq_hw_ctx *hctx;
-	int i;
+	unsigned long i;
 
 	mutex_lock(&q->sysfs_dir_lock);
 	if (!q->mq_sysfs_init_done)
@@ -306,7 +307,8 @@ void blk_mq_sysfs_unregister(struct request_queue *q)
 int blk_mq_sysfs_register(struct request_queue *q)
 {
 	struct blk_mq_hw_ctx *hctx;
-	int i, ret = 0;
+	unsigned long i;
+	int ret = 0;
 
 	mutex_lock(&q->sysfs_dir_lock);
 	if (!q->mq_sysfs_init_done)
diff --git a/block/blk-mq-tag.c b/block/blk-mq-tag.c
index 0fd409b8e86e..1850a4225e12 100644
--- a/block/blk-mq-tag.c
+++ b/block/blk-mq-tag.c
@@ -515,7 +515,7 @@ void blk_mq_queue_tag_busy_iter(struct request_queue *q, busy_tag_iter_fn *fn,
 		bt_for_each(NULL, q, btags, fn, priv, false);
 	} else {
 		struct blk_mq_hw_ctx *hctx;
-		int i;
+		unsigned long i;
 
 		queue_for_each_hw_ctx(q, hctx, i) {
 			struct blk_mq_tags *tags = hctx->tags;
diff --git a/block/blk-mq.c b/block/blk-mq.c
index 57ae9df0f4dc..bffdd71c670d 100644
--- a/block/blk-mq.c
+++ b/block/blk-mq.c
@@ -312,7 +312,7 @@ EXPORT_SYMBOL_GPL(blk_mq_unquiesce_queue);
 void blk_mq_wake_waiters(struct request_queue *q)
 {
 	struct blk_mq_hw_ctx *hctx;
-	unsigned int i;
+	unsigned long i;
 
 	queue_for_each_hw_ctx(q, hctx, i)
 		if (blk_mq_hw_queue_mapped(hctx))
@@ -1442,7 +1442,7 @@ static void blk_mq_timeout_work(struct work_struct *work)
 		container_of(work, struct request_queue, timeout_work);
 	unsigned long next = 0;
 	struct blk_mq_hw_ctx *hctx;
-	int i;
+	unsigned long i;
 
 	/* A deadlock might occur if a request is stuck requiring a
 	 * timeout at the same time a queue freeze is waiting
@@ -2143,7 +2143,7 @@ static struct blk_mq_hw_ctx *blk_mq_get_sq_hctx(struct request_queue *q)
 void blk_mq_run_hw_queues(struct request_queue *q, bool async)
 {
 	struct blk_mq_hw_ctx *hctx, *sq_hctx;
-	int i;
+	unsigned long i;
 
 	sq_hctx = NULL;
 	if (blk_mq_has_sqsched(q))
@@ -2171,7 +2171,7 @@ EXPORT_SYMBOL(blk_mq_run_hw_queues);
 void blk_mq_delay_run_hw_queues(struct request_queue *q, unsigned long msecs)
 {
 	struct blk_mq_hw_ctx *hctx, *sq_hctx;
-	int i;
+	unsigned long i;
 
 	sq_hctx = NULL;
 	if (blk_mq_has_sqsched(q))
@@ -2209,7 +2209,7 @@ EXPORT_SYMBOL(blk_mq_delay_run_hw_queues);
 bool blk_mq_queue_stopped(struct request_queue *q)
 {
 	struct blk_mq_hw_ctx *hctx;
-	int i;
+	unsigned long i;
 
 	queue_for_each_hw_ctx(q, hctx, i)
 		if (blk_mq_hctx_stopped(hctx))
@@ -2248,7 +2248,7 @@ EXPORT_SYMBOL(blk_mq_stop_hw_queue);
 void blk_mq_stop_hw_queues(struct request_queue *q)
 {
 	struct blk_mq_hw_ctx *hctx;
-	int i;
+	unsigned long i;
 
 	queue_for_each_hw_ctx(q, hctx, i)
 		blk_mq_stop_hw_queue(hctx);
@@ -2266,7 +2266,7 @@ EXPORT_SYMBOL(blk_mq_start_hw_queue);
 void blk_mq_start_hw_queues(struct request_queue *q)
 {
 	struct blk_mq_hw_ctx *hctx;
-	int i;
+	unsigned long i;
 
 	queue_for_each_hw_ctx(q, hctx, i)
 		blk_mq_start_hw_queue(hctx);
@@ -2286,7 +2286,7 @@ EXPORT_SYMBOL_GPL(blk_mq_start_stopped_hw_queue);
 void blk_mq_start_stopped_hw_queues(struct request_queue *q, bool async)
 {
 	struct blk_mq_hw_ctx *hctx;
-	int i;
+	unsigned long i;
 
 	queue_for_each_hw_ctx(q, hctx, i)
 		blk_mq_start_stopped_hw_queue(hctx, async);
@@ -3446,7 +3446,7 @@ static void blk_mq_exit_hw_queues(struct request_queue *q,
 		struct blk_mq_tag_set *set, int nr_queue)
 {
 	struct blk_mq_hw_ctx *hctx;
-	unsigned int i;
+	unsigned long i;
 
 	queue_for_each_hw_ctx(q, hctx, i) {
 		if (i == nr_queue)
@@ -3637,7 +3637,8 @@ static void __blk_mq_free_map_and_rqs(struct blk_mq_tag_set *set,
 
 static void blk_mq_map_swqueue(struct request_queue *q)
 {
-	unsigned int i, j, hctx_idx;
+	unsigned int j, hctx_idx;
+	unsigned long i;
 	struct blk_mq_hw_ctx *hctx;
 	struct blk_mq_ctx *ctx;
 	struct blk_mq_tag_set *set = q->tag_set;
@@ -3744,7 +3745,7 @@ static void blk_mq_map_swqueue(struct request_queue *q)
 static void queue_set_hctx_shared(struct request_queue *q, bool shared)
 {
 	struct blk_mq_hw_ctx *hctx;
-	int i;
+	unsigned long i;
 
 	queue_for_each_hw_ctx(q, hctx, i) {
 		if (shared) {
@@ -3844,7 +3845,7 @@ static int blk_mq_alloc_ctxs(struct request_queue *q)
 void blk_mq_release(struct request_queue *q)
 {
 	struct blk_mq_hw_ctx *hctx, *next;
-	int i;
+	unsigned long i;
 
 	queue_for_each_hw_ctx(q, hctx, i)
 		WARN_ON_ONCE(hctx && list_empty(&hctx->hctx_list));
@@ -4362,7 +4363,8 @@ int blk_mq_update_nr_requests(struct request_queue *q, unsigned int nr)
 {
 	struct blk_mq_tag_set *set = q->tag_set;
 	struct blk_mq_hw_ctx *hctx;
-	int i, ret;
+	int ret;
+	unsigned long i;
 
 	if (!set)
 		return -EINVAL;
@@ -4738,7 +4740,7 @@ void blk_mq_cancel_work_sync(struct request_queue *q)
 {
 	if (queue_is_mq(q)) {
 		struct blk_mq_hw_ctx *hctx;
-		int i;
+		unsigned long i;
 
 		cancel_delayed_work_sync(&q->requeue_work);
 
diff --git a/drivers/block/rnbd/rnbd-clt.c b/drivers/block/rnbd/rnbd-clt.c
index c08971de369f..58304f978e10 100644
--- a/drivers/block/rnbd/rnbd-clt.c
+++ b/drivers/block/rnbd/rnbd-clt.c
@@ -1343,7 +1343,7 @@ static inline void rnbd_init_hw_queue(struct rnbd_clt_dev *dev,
 
 static void rnbd_init_mq_hw_queues(struct rnbd_clt_dev *dev)
 {
-	int i;
+	unsigned long i;
 	struct blk_mq_hw_ctx *hctx;
 	struct rnbd_queue *q;
 
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2022-03-09  3:02 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-03 12:33 [PATCH V2 5/6] blk-mq: prepare for implementing hctx table via xarray kernel test robot
2022-03-09  3:01 ` kernel test robot
  -- strict thread matches above, loose matches on Subject: below --
2022-03-02 12:14 [PATCH V2 0/6] blk-mq: update_nr_hw_queues related improvement & bugfix Ming Lei
2022-03-02 12:14 ` [PATCH V2 5/6] blk-mq: prepare for implementing hctx table via xarray Ming Lei
2022-03-03  9:08   ` kernel test robot
2022-03-03  9:31     ` Ming Lei
2022-03-03  9:31       ` Ming Lei

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.