* [PATCH] blk-mq: Make it safe to call blk_mq_quiesce_queue_nowait() from an interrupt handler
@ 2017-06-20 16:40 Bart Van Assche
2017-06-21 1:42 ` Ming Lei
0 siblings, 1 reply; 5+ messages in thread
From: Bart Van Assche @ 2017-06-20 16:40 UTC (permalink / raw)
To: Jens Axboe
Cc: linux-block, Christoph Hellwig, Bart Van Assche, Ming Lei,
Hannes Reinecke, Martin K . Petersen
Since blk_mq_quiesce_queue_nowait() can be called from interrupt
context, make this safe. Since this function is not in the hot
path, uninline it. Untested.
Fixes: commit f4560ffe8cec ("blk-mq: use QUEUE_FLAG_QUIESCED to quiesce queue")
Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com>
Cc: Ming Lei <ming.lei@redhat.com>
Cc: Hannes Reinecke <hare@suse.com>
Cc: Martin K. Petersen <martin.petersen@oracle.com>
---
block/blk-mq.c | 14 ++++++++++++++
include/linux/blk-mq.h | 10 +---------
2 files changed, 15 insertions(+), 9 deletions(-)
diff --git a/block/blk-mq.c b/block/blk-mq.c
index 1c4f1f4978c6..92faf340dc92 100644
--- a/block/blk-mq.c
+++ b/block/blk-mq.c
@@ -153,6 +153,20 @@ void blk_mq_unfreeze_queue(struct request_queue *q)
}
EXPORT_SYMBOL_GPL(blk_mq_unfreeze_queue);
+/*
+ * FIXME: replace the scsi_internal_device_*block_nowait() calls in the
+ * mpt3sas driver such that this function can be removed.
+ */
+void blk_mq_quiesce_queue_nowait(struct request_queue *q)
+{
+ unsigned long flags;
+
+ spin_lock_irqsave(q->queue_lock, flags);
+ queue_flag_set(QUEUE_FLAG_QUIESCED, q);
+ spin_unlock_irqrestore(q->queue_lock, flags);
+}
+EXPORT_SYMBOL_GPL(blk_mq_quiesce_queue_nowait);
+
/**
* blk_mq_quiesce_queue() - wait until all ongoing dispatches have finished
* @q: request queue.
diff --git a/include/linux/blk-mq.h b/include/linux/blk-mq.h
index 366b83cee955..23d32ff0b462 100644
--- a/include/linux/blk-mq.h
+++ b/include/linux/blk-mq.h
@@ -266,15 +266,7 @@ int blk_mq_reinit_tagset(struct blk_mq_tag_set *set);
int blk_mq_map_queues(struct blk_mq_tag_set *set);
void blk_mq_update_nr_hw_queues(struct blk_mq_tag_set *set, int nr_hw_queues);
-/*
- * FIXME: this helper is just for working around mpt3sas.
- */
-static inline void blk_mq_quiesce_queue_nowait(struct request_queue *q)
-{
- spin_lock_irq(q->queue_lock);
- queue_flag_set(QUEUE_FLAG_QUIESCED, q);
- spin_unlock_irq(q->queue_lock);
-}
+void blk_mq_quiesce_queue_nowait(struct request_queue *q);
/*
* Driver command data is immediately after the request. So subtract request
--
2.13.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] blk-mq: Make it safe to call blk_mq_quiesce_queue_nowait() from an interrupt handler
2017-06-20 16:40 [PATCH] blk-mq: Make it safe to call blk_mq_quiesce_queue_nowait() from an interrupt handler Bart Van Assche
@ 2017-06-21 1:42 ` Ming Lei
2017-06-21 1:46 ` Ming Lei
0 siblings, 1 reply; 5+ messages in thread
From: Ming Lei @ 2017-06-21 1:42 UTC (permalink / raw)
To: Bart Van Assche
Cc: Jens Axboe, linux-block, Christoph Hellwig, Hannes Reinecke,
Martin K . Petersen
On Tue, Jun 20, 2017 at 09:40:20AM -0700, Bart Van Assche wrote:
> Since blk_mq_quiesce_queue_nowait() can be called from interrupt
> context, make this safe. Since this function is not in the hot
> path, uninline it. Untested.
>
> Fixes: commit f4560ffe8cec ("blk-mq: use QUEUE_FLAG_QUIESCED to quiesce queue")
> Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com>
> Cc: Ming Lei <ming.lei@redhat.com>
> Cc: Hannes Reinecke <hare@suse.com>
> Cc: Martin K. Petersen <martin.petersen@oracle.com>
> ---
> block/blk-mq.c | 14 ++++++++++++++
> include/linux/blk-mq.h | 10 +---------
> 2 files changed, 15 insertions(+), 9 deletions(-)
>
> diff --git a/block/blk-mq.c b/block/blk-mq.c
> index 1c4f1f4978c6..92faf340dc92 100644
> --- a/block/blk-mq.c
> +++ b/block/blk-mq.c
> @@ -153,6 +153,20 @@ void blk_mq_unfreeze_queue(struct request_queue *q)
> }
> EXPORT_SYMBOL_GPL(blk_mq_unfreeze_queue);
>
> +/*
> + * FIXME: replace the scsi_internal_device_*block_nowait() calls in the
> + * mpt3sas driver such that this function can be removed.
> + */
> +void blk_mq_quiesce_queue_nowait(struct request_queue *q)
> +{
> + unsigned long flags;
> +
> + spin_lock_irqsave(q->queue_lock, flags);
> + queue_flag_set(QUEUE_FLAG_QUIESCED, q);
> + spin_unlock_irqrestore(q->queue_lock, flags);
> +}
> +EXPORT_SYMBOL_GPL(blk_mq_quiesce_queue_nowait);
> +
> /**
> * blk_mq_quiesce_queue() - wait until all ongoing dispatches have finished
> * @q: request queue.
> diff --git a/include/linux/blk-mq.h b/include/linux/blk-mq.h
> index 366b83cee955..23d32ff0b462 100644
> --- a/include/linux/blk-mq.h
> +++ b/include/linux/blk-mq.h
> @@ -266,15 +266,7 @@ int blk_mq_reinit_tagset(struct blk_mq_tag_set *set);
> int blk_mq_map_queues(struct blk_mq_tag_set *set);
> void blk_mq_update_nr_hw_queues(struct blk_mq_tag_set *set, int nr_hw_queues);
>
> -/*
> - * FIXME: this helper is just for working around mpt3sas.
> - */
> -static inline void blk_mq_quiesce_queue_nowait(struct request_queue *q)
> -{
> - spin_lock_irq(q->queue_lock);
> - queue_flag_set(QUEUE_FLAG_QUIESCED, q);
> - spin_unlock_irq(q->queue_lock);
> -}
> +void blk_mq_quiesce_queue_nowait(struct request_queue *q);
>
> /*
> * Driver command data is immediately after the request. So subtract request
> --
> 2.13.1
>
Looks fine,
Reviewed-by: Ming Lei <ming.lei@redhat.com>
Thanks,
Ming
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] blk-mq: Make it safe to call blk_mq_quiesce_queue_nowait() from an interrupt handler
2017-06-21 1:42 ` Ming Lei
@ 2017-06-21 1:46 ` Ming Lei
2017-06-21 1:48 ` Jens Axboe
0 siblings, 1 reply; 5+ messages in thread
From: Ming Lei @ 2017-06-21 1:46 UTC (permalink / raw)
To: Bart Van Assche
Cc: Jens Axboe, linux-block, Christoph Hellwig, Hannes Reinecke,
Martin K . Petersen
On Wed, Jun 21, 2017 at 09:42:36AM +0800, Ming Lei wrote:
> On Tue, Jun 20, 2017 at 09:40:20AM -0700, Bart Van Assche wrote:
> > Since blk_mq_quiesce_queue_nowait() can be called from interrupt
> > context, make this safe. Since this function is not in the hot
> > path, uninline it. Untested.
> >
> > Fixes: commit f4560ffe8cec ("blk-mq: use QUEUE_FLAG_QUIESCED to quiesce queue")
> > Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com>
> > Cc: Ming Lei <ming.lei@redhat.com>
> > Cc: Hannes Reinecke <hare@suse.com>
> > Cc: Martin K. Petersen <martin.petersen@oracle.com>
> > ---
> > block/blk-mq.c | 14 ++++++++++++++
> > include/linux/blk-mq.h | 10 +---------
> > 2 files changed, 15 insertions(+), 9 deletions(-)
> >
> > diff --git a/block/blk-mq.c b/block/blk-mq.c
> > index 1c4f1f4978c6..92faf340dc92 100644
> > --- a/block/blk-mq.c
> > +++ b/block/blk-mq.c
> > @@ -153,6 +153,20 @@ void blk_mq_unfreeze_queue(struct request_queue *q)
> > }
> > EXPORT_SYMBOL_GPL(blk_mq_unfreeze_queue);
> >
> > +/*
> > + * FIXME: replace the scsi_internal_device_*block_nowait() calls in the
> > + * mpt3sas driver such that this function can be removed.
> > + */
> > +void blk_mq_quiesce_queue_nowait(struct request_queue *q)
> > +{
> > + unsigned long flags;
> > +
> > + spin_lock_irqsave(q->queue_lock, flags);
> > + queue_flag_set(QUEUE_FLAG_QUIESCED, q);
> > + spin_unlock_irqrestore(q->queue_lock, flags);
> > +}
> > +EXPORT_SYMBOL_GPL(blk_mq_quiesce_queue_nowait);
> > +
> > /**
> > * blk_mq_quiesce_queue() - wait until all ongoing dispatches have finished
> > * @q: request queue.
> > diff --git a/include/linux/blk-mq.h b/include/linux/blk-mq.h
> > index 366b83cee955..23d32ff0b462 100644
> > --- a/include/linux/blk-mq.h
> > +++ b/include/linux/blk-mq.h
> > @@ -266,15 +266,7 @@ int blk_mq_reinit_tagset(struct blk_mq_tag_set *set);
> > int blk_mq_map_queues(struct blk_mq_tag_set *set);
> > void blk_mq_update_nr_hw_queues(struct blk_mq_tag_set *set, int nr_hw_queues);
> >
> > -/*
> > - * FIXME: this helper is just for working around mpt3sas.
> > - */
> > -static inline void blk_mq_quiesce_queue_nowait(struct request_queue *q)
> > -{
> > - spin_lock_irq(q->queue_lock);
> > - queue_flag_set(QUEUE_FLAG_QUIESCED, q);
> > - spin_unlock_irq(q->queue_lock);
> > -}
> > +void blk_mq_quiesce_queue_nowait(struct request_queue *q);
> >
> > /*
> > * Driver command data is immediately after the request. So subtract request
> > --
> > 2.13.1
> >
>
> Looks fine,
>
> Reviewed-by: Ming Lei <ming.lei@redhat.com>
Also we should save/restore irq flags in blk_mq_unquiesce_queue()
since scsi_start_queue() does that too, could you fix the two
in this patch?
Thanks,
Ming
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] blk-mq: Make it safe to call blk_mq_quiesce_queue_nowait() from an interrupt handler
2017-06-21 1:46 ` Ming Lei
@ 2017-06-21 1:48 ` Jens Axboe
2017-06-21 1:51 ` Bart Van Assche
0 siblings, 1 reply; 5+ messages in thread
From: Jens Axboe @ 2017-06-21 1:48 UTC (permalink / raw)
To: Ming Lei, Bart Van Assche
Cc: linux-block, Christoph Hellwig, Hannes Reinecke,
Martin K . Petersen
On 06/20/2017 07:46 PM, Ming Lei wrote:
> On Wed, Jun 21, 2017 at 09:42:36AM +0800, Ming Lei wrote:
>> On Tue, Jun 20, 2017 at 09:40:20AM -0700, Bart Van Assche wrote:
>>> Since blk_mq_quiesce_queue_nowait() can be called from interrupt
>>> context, make this safe. Since this function is not in the hot
>>> path, uninline it. Untested.
>>>
>>> Fixes: commit f4560ffe8cec ("blk-mq: use QUEUE_FLAG_QUIESCED to quiesce queue")
>>> Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com>
>>> Cc: Ming Lei <ming.lei@redhat.com>
>>> Cc: Hannes Reinecke <hare@suse.com>
>>> Cc: Martin K. Petersen <martin.petersen@oracle.com>
>>> ---
>>> block/blk-mq.c | 14 ++++++++++++++
>>> include/linux/blk-mq.h | 10 +---------
>>> 2 files changed, 15 insertions(+), 9 deletions(-)
>>>
>>> diff --git a/block/blk-mq.c b/block/blk-mq.c
>>> index 1c4f1f4978c6..92faf340dc92 100644
>>> --- a/block/blk-mq.c
>>> +++ b/block/blk-mq.c
>>> @@ -153,6 +153,20 @@ void blk_mq_unfreeze_queue(struct request_queue *q)
>>> }
>>> EXPORT_SYMBOL_GPL(blk_mq_unfreeze_queue);
>>>
>>> +/*
>>> + * FIXME: replace the scsi_internal_device_*block_nowait() calls in the
>>> + * mpt3sas driver such that this function can be removed.
>>> + */
>>> +void blk_mq_quiesce_queue_nowait(struct request_queue *q)
>>> +{
>>> + unsigned long flags;
>>> +
>>> + spin_lock_irqsave(q->queue_lock, flags);
>>> + queue_flag_set(QUEUE_FLAG_QUIESCED, q);
>>> + spin_unlock_irqrestore(q->queue_lock, flags);
>>> +}
>>> +EXPORT_SYMBOL_GPL(blk_mq_quiesce_queue_nowait);
>>> +
>>> /**
>>> * blk_mq_quiesce_queue() - wait until all ongoing dispatches have finished
>>> * @q: request queue.
>>> diff --git a/include/linux/blk-mq.h b/include/linux/blk-mq.h
>>> index 366b83cee955..23d32ff0b462 100644
>>> --- a/include/linux/blk-mq.h
>>> +++ b/include/linux/blk-mq.h
>>> @@ -266,15 +266,7 @@ int blk_mq_reinit_tagset(struct blk_mq_tag_set *set);
>>> int blk_mq_map_queues(struct blk_mq_tag_set *set);
>>> void blk_mq_update_nr_hw_queues(struct blk_mq_tag_set *set, int nr_hw_queues);
>>>
>>> -/*
>>> - * FIXME: this helper is just for working around mpt3sas.
>>> - */
>>> -static inline void blk_mq_quiesce_queue_nowait(struct request_queue *q)
>>> -{
>>> - spin_lock_irq(q->queue_lock);
>>> - queue_flag_set(QUEUE_FLAG_QUIESCED, q);
>>> - spin_unlock_irq(q->queue_lock);
>>> -}
>>> +void blk_mq_quiesce_queue_nowait(struct request_queue *q);
>>>
>>> /*
>>> * Driver command data is immediately after the request. So subtract request
>>> --
>>> 2.13.1
>>>
>>
>> Looks fine,
>>
>> Reviewed-by: Ming Lei <ming.lei@redhat.com>
>
> Also we should save/restore irq flags in blk_mq_unquiesce_queue()
> since scsi_start_queue() does that too, could you fix the two
> in this patch?
Good catch. Bart, will you spin a v2?
--
Jens Axboe
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] blk-mq: Make it safe to call blk_mq_quiesce_queue_nowait() from an interrupt handler
2017-06-21 1:48 ` Jens Axboe
@ 2017-06-21 1:51 ` Bart Van Assche
0 siblings, 0 replies; 5+ messages in thread
From: Bart Van Assche @ 2017-06-21 1:51 UTC (permalink / raw)
To: axboe@kernel.dk, ming.lei@redhat.com
Cc: hch@lst.de, linux-block@vger.kernel.org, hare@suse.com,
martin.petersen@oracle.com
T24gVHVlLCAyMDE3LTA2LTIwIGF0IDE5OjQ4IC0wNjAwLCBKZW5zIEF4Ym9lIHdyb3RlOg0KPiBH
b29kIGNhdGNoLiBCYXJ0LCB3aWxsIHlvdSBzcGluIGEgdjI/DQoNCkhlbGxvIEplbnMsDQoNClRo
YXQncyB0aGUgZmlyc3QgdGFzayBJIHdpbGwgd29yayBvbiB0b21vcnJvdyBtb3JuaW5nLg0KDQpC
YXJ0Lg==
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2017-06-21 1:51 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-06-20 16:40 [PATCH] blk-mq: Make it safe to call blk_mq_quiesce_queue_nowait() from an interrupt handler Bart Van Assche
2017-06-21 1:42 ` Ming Lei
2017-06-21 1:46 ` Ming Lei
2017-06-21 1:48 ` Jens Axboe
2017-06-21 1:51 ` Bart Van Assche
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox