Re: [PATCH] null_blk: allow zero poll queues

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Shinichiro,

On Fri, Dec 03, 2021 at 10:01:33AM +0000, Shinichiro Kawasaki wrote:
> On Dec 03, 2021 / 10:39, 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@xxxxxxx>
> > Signed-off-by: Ming Lei <ming.lei@xxxxxxxxxx>
> 
> Hi Ming,
> 
> It is good to know that the zero poll queues is useful. Having said that, I
> observe zero division error [1] with your patch and the commands below. Don' we
> need some more code changes to avoid the error?
> 
> # modprobe null_blk
> # cd /sys/kernel/config/nullb
> # mkdir test
> # echo 0 > test/poll_queues
> # echo 1 > test/power
> Segmentation fault

I guess the following change may fix the error:

diff --git a/drivers/block/null_blk/main.c b/drivers/block/null_blk/main.c
index 20534a2daf17..96c55d06401d 100644
--- a/drivers/block/null_blk/main.c
+++ b/drivers/block/null_blk/main.c
@@ -1892,7 +1892,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;




Thanks,
Ming




[Index of Archives]     [Linux RAID]     [Linux SCSI]     [Linux ATA RAID]     [IDE]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Device Mapper]

  Powered by Linux