All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH V2] null_blk: allow zero poll queues
@ 2021-12-03 13:09 Ming Lei
  2021-12-04  1:35 ` Shinichiro Kawasaki
  2021-12-24  0:52 ` Shinichiro Kawasaki
  0 siblings, 2 replies; 5+ messages in thread
From: Ming Lei @ 2021-12-03 13:09 UTC (permalink / raw)
  To: Jens Axboe; +Cc: linux-block, Ming Lei, Shin'ichiro Kawasaki

There isn't any reason to not allow zero poll queues from user
viewpoint.

Also sometimes we need to compare io poll between poll mode and irq
mode, so not allowing poll queues is bad.

Fixes: 15dfc662ef31 ("null_blk: Fix handling of submit_queues and poll_queues attributes")
Cc: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Signed-off-by: Ming Lei <ming.lei@redhat.com>
---
V2:
	- fix divide zero fault as reported by Shin'ichiro

 drivers/block/null_blk/main.c | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/drivers/block/null_blk/main.c b/drivers/block/null_blk/main.c
index 54f7d490f8eb..c73e69ab77ed 100644
--- a/drivers/block/null_blk/main.c
+++ b/drivers/block/null_blk/main.c
@@ -340,9 +340,9 @@ static int nullb_update_nr_hw_queues(struct nullb_device *dev,
 		return 0;
 
 	/*
-	 * Make sure at least one queue exists for each of submit and poll.
+	 * Make sure at least one submit queue exists.
 	 */
-	if (!submit_queues || !poll_queues)
+	if (!submit_queues)
 		return -EINVAL;
 
 	/*
@@ -1878,8 +1878,7 @@ static int null_init_tag_set(struct nullb *nullb, struct blk_mq_tag_set *set)
 	set->nr_hw_queues = nullb ? nullb->dev->submit_queues :
 						g_submit_queues;
 	poll_queues = nullb ? nullb->dev->poll_queues : g_poll_queues;
-	if (poll_queues)
-		set->nr_hw_queues += poll_queues;
+	set->nr_hw_queues += poll_queues;
 	set->queue_depth = nullb ? nullb->dev->hw_queue_depth :
 						g_hw_queue_depth;
 	set->numa_node = nullb ? nullb->dev->home_node : g_home_node;
@@ -1890,7 +1889,7 @@ static int null_init_tag_set(struct nullb *nullb, struct blk_mq_tag_set *set)
 	if (g_shared_tag_bitmap)
 		set->flags |= BLK_MQ_F_TAG_HCTX_SHARED;
 	set->driver_data = nullb;
-	if (g_poll_queues)
+	if (poll_queues)
 		set->nr_maps = 3;
 	else
 		set->nr_maps = 1;
@@ -1917,8 +1916,6 @@ static int null_validate_conf(struct nullb_device *dev)
 
 	if (dev->poll_queues > g_poll_queues)
 		dev->poll_queues = g_poll_queues;
-	else if (dev->poll_queues == 0)
-		dev->poll_queues = 1;
 	dev->prev_poll_queues = dev->poll_queues;
 
 	dev->queue_mode = min_t(unsigned int, dev->queue_mode, NULL_Q_MQ);
-- 
2.31.1


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

* Re: [PATCH V2] null_blk: allow zero poll queues
  2021-12-03 13:09 [PATCH V2] null_blk: allow zero poll queues Ming Lei
@ 2021-12-04  1:35 ` Shinichiro Kawasaki
  2021-12-24  0:52 ` Shinichiro Kawasaki
  1 sibling, 0 replies; 5+ messages in thread
From: Shinichiro Kawasaki @ 2021-12-04  1:35 UTC (permalink / raw)
  To: Ming Lei; +Cc: Jens Axboe, linux-block

On Dec 03, 2021 / 21:09, Ming Lei wrote:
> There isn't any reason to not allow zero poll queues from user
> viewpoint.
> 
> Also sometimes we need to compare io poll between poll mode and irq
> mode, so not allowing poll queues is bad.
> 
> Fixes: 15dfc662ef31 ("null_blk: Fix handling of submit_queues and poll_queues attributes")
> Cc: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
> Signed-off-by: Ming Lei <ming.lei@redhat.com>

Thank you for the fix. Looks good to me.

Reviewed-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>

-- 
Best Regards,
Shin'ichiro Kawasaki

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

* Re: [PATCH V2] null_blk: allow zero poll queues
  2021-12-03 13:09 [PATCH V2] null_blk: allow zero poll queues Ming Lei
  2021-12-04  1:35 ` Shinichiro Kawasaki
@ 2021-12-24  0:52 ` Shinichiro Kawasaki
  2021-12-24  0:55   ` Jens Axboe
  1 sibling, 1 reply; 5+ messages in thread
From: Shinichiro Kawasaki @ 2021-12-24  0:52 UTC (permalink / raw)
  To: Ming Lei; +Cc: Jens Axboe, linux-block

On Dec 03, 2021 / 21:09, Ming Lei wrote:
> There isn't any reason to not allow zero poll queues from user
> viewpoint.
> 
> Also sometimes we need to compare io poll between poll mode and irq
> mode, so not allowing poll queues is bad.
> 
> Fixes: 15dfc662ef31 ("null_blk: Fix handling of submit_queues and poll_queues attributes")
> Cc: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
> Signed-off-by: Ming Lei <ming.lei@redhat.com>
> ---
> V2:
> 	- fix divide zero fault as reported by Shin'ichiro

Jens, Ming,

I find the V1 was applied to the for/5.17-drivers branch, and the additional fix
in the V2 does not look applied to the branch. Do we need another small patch to
cover the delta between V1 and V2?

-- 
Best Regards,
Shin'ichiro Kawasaki

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

* Re: [PATCH V2] null_blk: allow zero poll queues
  2021-12-24  0:52 ` Shinichiro Kawasaki
@ 2021-12-24  0:55   ` Jens Axboe
  2021-12-24  4:32     ` Shinichiro Kawasaki
  0 siblings, 1 reply; 5+ messages in thread
From: Jens Axboe @ 2021-12-24  0:55 UTC (permalink / raw)
  To: Shinichiro Kawasaki, Ming Lei; +Cc: linux-block

On 12/23/21 5:52 PM, Shinichiro Kawasaki wrote:
> On Dec 03, 2021 / 21:09, Ming Lei wrote:
>> There isn't any reason to not allow zero poll queues from user
>> viewpoint.
>>
>> Also sometimes we need to compare io poll between poll mode and irq
>> mode, so not allowing poll queues is bad.
>>
>> Fixes: 15dfc662ef31 ("null_blk: Fix handling of submit_queues and poll_queues attributes")
>> Cc: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
>> Signed-off-by: Ming Lei <ming.lei@redhat.com>
>> ---
>> V2:
>> 	- fix divide zero fault as reported by Shin'ichiro
> 
> Jens, Ming,
> 
> I find the V1 was applied to the for/5.17-drivers branch, and the additional fix
> in the V2 does not look applied to the branch. Do we need another small patch to
> cover the delta between V1 and V2?

Yes, please send an incremental, thanks.

-- 
Jens Axboe


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

* Re: [PATCH V2] null_blk: allow zero poll queues
  2021-12-24  0:55   ` Jens Axboe
@ 2021-12-24  4:32     ` Shinichiro Kawasaki
  0 siblings, 0 replies; 5+ messages in thread
From: Shinichiro Kawasaki @ 2021-12-24  4:32 UTC (permalink / raw)
  To: Jens Axboe; +Cc: Ming Lei, linux-block

On Dec 23, 2021 / 17:55, Jens Axboe wrote:
> On 12/23/21 5:52 PM, Shinichiro Kawasaki wrote:
> > On Dec 03, 2021 / 21:09, Ming Lei wrote:
> >> There isn't any reason to not allow zero poll queues from user
> >> viewpoint.
> >>
> >> Also sometimes we need to compare io poll between poll mode and irq
> >> mode, so not allowing poll queues is bad.
> >>
> >> Fixes: 15dfc662ef31 ("null_blk: Fix handling of submit_queues and poll_queues attributes")
> >> Cc: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
> >> Signed-off-by: Ming Lei <ming.lei@redhat.com>
> >> ---
> >> V2:
> >> 	- fix divide zero fault as reported by Shin'ichiro
> > 
> > Jens, Ming,
> > 
> > I find the V1 was applied to the for/5.17-drivers branch, and the additional fix
> > in the V2 does not look applied to the branch. Do we need another small patch to
> > cover the delta between V1 and V2?
> 
> Yes, please send an incremental, thanks.

Thanks, and Ming already provided the small patch (So quick!). I've confirmed
that the patch avoids the issue. Merge to for/5.17-drivers will be appreciated.

-- 
Best Regards,
Shin'ichiro Kawasaki

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

end of thread, other threads:[~2021-12-24  4:32 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-03 13:09 [PATCH V2] null_blk: allow zero poll queues Ming Lei
2021-12-04  1:35 ` Shinichiro Kawasaki
2021-12-24  0:52 ` Shinichiro Kawasaki
2021-12-24  0:55   ` Jens Axboe
2021-12-24  4:32     ` Shinichiro Kawasaki

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.