Linux-Block Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH V2] block: Fix elv_support_iosched()
@ 2019-10-08 22:39 Damien Le Moal
  2019-10-09  3:31 ` Bob Liu
  2019-10-14  0:03 ` Damien Le Moal
  0 siblings, 2 replies; 4+ messages in thread
From: Damien Le Moal @ 2019-10-08 22:39 UTC (permalink / raw)
  To: linux-block, Jens Axboe; +Cc: Shinichiro Kawasaki

A BIO based request queue does not have a tag_set, which prevent testing
for the flag BLK_MQ_F_NO_SCHED indicating that the queue does not
require an elevator. This leads to an incorrect initialization of a
default elevator in some cases such as BIO based null_blk
(queue_mode == BIO) with zoned mode enabled as the default elevator in
this case is mq-deadline instead of "none".

Fix this by testing for a NULL queue mq_ops field which indicates that
the queue is BIO based and should not have an elevator.

Reported-by: Shinichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
---
Changes from V1:
* Test if q->mq_ops is NULL to identify BIO based queues

 block/elevator.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/block/elevator.c b/block/elevator.c
index 5437059c9261..076ba7308e65 100644
--- a/block/elevator.c
+++ b/block/elevator.c
@@ -616,7 +616,8 @@ int elevator_switch_mq(struct request_queue *q,
 
 static inline bool elv_support_iosched(struct request_queue *q)
 {
-	if (q->tag_set && (q->tag_set->flags & BLK_MQ_F_NO_SCHED))
+	if (!q->mq_ops ||
+	    (q->tag_set && (q->tag_set->flags & BLK_MQ_F_NO_SCHED)))
 		return false;
 	return true;
 }
-- 
2.21.0


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

* Re: [PATCH V2] block: Fix elv_support_iosched()
  2019-10-08 22:39 [PATCH V2] block: Fix elv_support_iosched() Damien Le Moal
@ 2019-10-09  3:31 ` Bob Liu
  2019-10-14  0:03 ` Damien Le Moal
  1 sibling, 0 replies; 4+ messages in thread
From: Bob Liu @ 2019-10-09  3:31 UTC (permalink / raw)
  To: Damien Le Moal, linux-block, Jens Axboe; +Cc: Shinichiro Kawasaki

On 10/9/19 6:39 AM, Damien Le Moal wrote:
> A BIO based request queue does not have a tag_set, which prevent testing
> for the flag BLK_MQ_F_NO_SCHED indicating that the queue does not
> require an elevator. This leads to an incorrect initialization of a
> default elevator in some cases such as BIO based null_blk
> (queue_mode == BIO) with zoned mode enabled as the default elevator in
> this case is mq-deadline instead of "none".
> 
> Fix this by testing for a NULL queue mq_ops field which indicates that
> the queue is BIO based and should not have an elevator.
> 
> Reported-by: Shinichiro Kawasaki <shinichiro.kawasaki@wdc.com>
> Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
> ---
> Changes from V1:
> * Test if q->mq_ops is NULL to identify BIO based queues
> 
>  block/elevator.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/block/elevator.c b/block/elevator.c
> index 5437059c9261..076ba7308e65 100644
> --- a/block/elevator.c
> +++ b/block/elevator.c
> @@ -616,7 +616,8 @@ int elevator_switch_mq(struct request_queue *q,
>  
>  static inline bool elv_support_iosched(struct request_queue *q)
>  {
> -	if (q->tag_set && (q->tag_set->flags & BLK_MQ_F_NO_SCHED))
> +	if (!q->mq_ops ||
> +	    (q->tag_set && (q->tag_set->flags & BLK_MQ_F_NO_SCHED)))
>  		return false;
>  	return true;
>  }
> 

Looks good to me.
Reviewed-by: Bob Liu <bob.liu@oracle.com>


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

* Re: [PATCH V2] block: Fix elv_support_iosched()
  2019-10-08 22:39 [PATCH V2] block: Fix elv_support_iosched() Damien Le Moal
  2019-10-09  3:31 ` Bob Liu
@ 2019-10-14  0:03 ` Damien Le Moal
  2019-10-14 19:54   ` Jens Axboe
  1 sibling, 1 reply; 4+ messages in thread
From: Damien Le Moal @ 2019-10-14  0:03 UTC (permalink / raw)
  To: linux-block, Jens Axboe; +Cc: Shinichiro Kawasaki

On 2019/10/09 7:40, Damien Le Moal wrote:
> A BIO based request queue does not have a tag_set, which prevent testing
> for the flag BLK_MQ_F_NO_SCHED indicating that the queue does not
> require an elevator. This leads to an incorrect initialization of a
> default elevator in some cases such as BIO based null_blk
> (queue_mode == BIO) with zoned mode enabled as the default elevator in
> this case is mq-deadline instead of "none".
> 
> Fix this by testing for a NULL queue mq_ops field which indicates that
> the queue is BIO based and should not have an elevator.
> 
> Reported-by: Shinichiro Kawasaki <shinichiro.kawasaki@wdc.com>
> Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
> ---
> Changes from V1:
> * Test if q->mq_ops is NULL to identify BIO based queues
> 
>  block/elevator.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/block/elevator.c b/block/elevator.c
> index 5437059c9261..076ba7308e65 100644
> --- a/block/elevator.c
> +++ b/block/elevator.c
> @@ -616,7 +616,8 @@ int elevator_switch_mq(struct request_queue *q,
>  
>  static inline bool elv_support_iosched(struct request_queue *q)
>  {
> -	if (q->tag_set && (q->tag_set->flags & BLK_MQ_F_NO_SCHED))
> +	if (!q->mq_ops ||
> +	    (q->tag_set && (q->tag_set->flags & BLK_MQ_F_NO_SCHED)))
>  		return false;
>  	return true;
>  }
> 

Jens,

Ping ? This was not in your rc3 pull request...

-- 
Damien Le Moal
Western Digital Research

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

* Re: [PATCH V2] block: Fix elv_support_iosched()
  2019-10-14  0:03 ` Damien Le Moal
@ 2019-10-14 19:54   ` Jens Axboe
  0 siblings, 0 replies; 4+ messages in thread
From: Jens Axboe @ 2019-10-14 19:54 UTC (permalink / raw)
  To: Damien Le Moal, linux-block; +Cc: Shinichiro Kawasaki

On 10/13/19 6:03 PM, Damien Le Moal wrote:
> On 2019/10/09 7:40, Damien Le Moal wrote:
>> A BIO based request queue does not have a tag_set, which prevent testing
>> for the flag BLK_MQ_F_NO_SCHED indicating that the queue does not
>> require an elevator. This leads to an incorrect initialization of a
>> default elevator in some cases such as BIO based null_blk
>> (queue_mode == BIO) with zoned mode enabled as the default elevator in
>> this case is mq-deadline instead of "none".
>>
>> Fix this by testing for a NULL queue mq_ops field which indicates that
>> the queue is BIO based and should not have an elevator.
>>
>> Reported-by: Shinichiro Kawasaki <shinichiro.kawasaki@wdc.com>
>> Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
>> ---
>> Changes from V1:
>> * Test if q->mq_ops is NULL to identify BIO based queues
>>
>>   block/elevator.c | 3 ++-
>>   1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/block/elevator.c b/block/elevator.c
>> index 5437059c9261..076ba7308e65 100644
>> --- a/block/elevator.c
>> +++ b/block/elevator.c
>> @@ -616,7 +616,8 @@ int elevator_switch_mq(struct request_queue *q,
>>   
>>   static inline bool elv_support_iosched(struct request_queue *q)
>>   {
>> -	if (q->tag_set && (q->tag_set->flags & BLK_MQ_F_NO_SCHED))
>> +	if (!q->mq_ops ||
>> +	    (q->tag_set && (q->tag_set->flags & BLK_MQ_F_NO_SCHED)))
>>   		return false;
>>   	return true;
>>   }
>>
> 
> Jens,
> 
> Ping ? This was not in your rc3 pull request...

Yeah that missed -rc3, I've queued it up for -rc4. Thanks!

-- 
Jens Axboe


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

end of thread, back to index

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-08 22:39 [PATCH V2] block: Fix elv_support_iosched() Damien Le Moal
2019-10-09  3:31 ` Bob Liu
2019-10-14  0:03 ` Damien Le Moal
2019-10-14 19:54   ` Jens Axboe

Linux-Block Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-block/0 linux-block/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-block linux-block/ https://lore.kernel.org/linux-block \
		linux-block@vger.kernel.org linux-block@archiver.kernel.org
	public-inbox-index linux-block

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-block


AGPL code for this site: git clone https://public-inbox.org/ public-inbox