* [PATCHv4 1/2] blk-mq: blk-mq: provide forced completion method
@ 2020-05-29 14:51 ` Keith Busch
0 siblings, 0 replies; 12+ messages in thread
From: Keith Busch @ 2020-05-29 14:51 UTC (permalink / raw)
To: linux-nvme, hch, sagi, linux-block, axboe; +Cc: alan.adamson, Keith Busch
Drivers may need to bypass error injection for error recovery. Rename
__blk_mq_complete_request() to blk_mq_force_complete_rq() and export
that function so drivers may skip potential fake timeouts after they've
reclaimed lost requests.
Signed-off-by: Keith Busch <kbusch@kernel.org>
---
block/blk-mq.c | 15 +++++++++++++--
include/linux/blk-mq.h | 1 +
2 files changed, 14 insertions(+), 2 deletions(-)
diff --git a/block/blk-mq.c b/block/blk-mq.c
index cac11945f602..560a114a82f8 100644
--- a/block/blk-mq.c
+++ b/block/blk-mq.c
@@ -556,7 +556,17 @@ static void __blk_mq_complete_request_remote(void *data)
q->mq_ops->complete(rq);
}
-static void __blk_mq_complete_request(struct request *rq)
+/**
+ * blk_mq_force_complete_rq() - Force complete the request, bypassing any error
+ * injection that could drop the completion.
+ * @rq: Request to be force completed
+ *
+ * Drivers should use blk_mq_complete_request() to complete requests in their
+ * normal IO path. For timeout error recovery, drivers may call this forced
+ * completion routine after they've reclaimed timed out requests to bypass
+ * potentially subsequent fake timeouts.
+ */
+void blk_mq_force_complete_rq(struct request *rq)
{
struct blk_mq_ctx *ctx = rq->mq_ctx;
struct request_queue *q = rq->q;
@@ -602,6 +612,7 @@ static void __blk_mq_complete_request(struct request *rq)
}
put_cpu();
}
+EXPORT_SYMBOL_GPL(blk_mq_force_complete_rq);
static void hctx_unlock(struct blk_mq_hw_ctx *hctx, int srcu_idx)
__releases(hctx->srcu)
@@ -635,7 +646,7 @@ bool blk_mq_complete_request(struct request *rq)
{
if (unlikely(blk_should_fake_timeout(rq->q)))
return false;
- __blk_mq_complete_request(rq);
+ blk_mq_force_complete_rq(rq);
return true;
}
EXPORT_SYMBOL(blk_mq_complete_request);
diff --git a/include/linux/blk-mq.h b/include/linux/blk-mq.h
index d7307795439a..856bb10993cf 100644
--- a/include/linux/blk-mq.h
+++ b/include/linux/blk-mq.h
@@ -494,6 +494,7 @@ void blk_mq_requeue_request(struct request *rq, bool kick_requeue_list);
void blk_mq_kick_requeue_list(struct request_queue *q);
void blk_mq_delay_kick_requeue_list(struct request_queue *q, unsigned long msecs);
bool blk_mq_complete_request(struct request *rq);
+void blk_mq_force_complete_rq(struct request *rq);
bool blk_mq_bio_list_merge(struct request_queue *q, struct list_head *list,
struct bio *bio, unsigned int nr_segs);
bool blk_mq_queue_stopped(struct request_queue *q);
--
2.24.1
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCHv4 1/2] blk-mq: blk-mq: provide forced completion method
@ 2020-05-29 14:51 ` Keith Busch
0 siblings, 0 replies; 12+ messages in thread
From: Keith Busch @ 2020-05-29 14:51 UTC (permalink / raw)
To: linux-nvme, hch, sagi, linux-block, axboe; +Cc: Keith Busch, alan.adamson
Drivers may need to bypass error injection for error recovery. Rename
__blk_mq_complete_request() to blk_mq_force_complete_rq() and export
that function so drivers may skip potential fake timeouts after they've
reclaimed lost requests.
Signed-off-by: Keith Busch <kbusch@kernel.org>
---
block/blk-mq.c | 15 +++++++++++++--
include/linux/blk-mq.h | 1 +
2 files changed, 14 insertions(+), 2 deletions(-)
diff --git a/block/blk-mq.c b/block/blk-mq.c
index cac11945f602..560a114a82f8 100644
--- a/block/blk-mq.c
+++ b/block/blk-mq.c
@@ -556,7 +556,17 @@ static void __blk_mq_complete_request_remote(void *data)
q->mq_ops->complete(rq);
}
-static void __blk_mq_complete_request(struct request *rq)
+/**
+ * blk_mq_force_complete_rq() - Force complete the request, bypassing any error
+ * injection that could drop the completion.
+ * @rq: Request to be force completed
+ *
+ * Drivers should use blk_mq_complete_request() to complete requests in their
+ * normal IO path. For timeout error recovery, drivers may call this forced
+ * completion routine after they've reclaimed timed out requests to bypass
+ * potentially subsequent fake timeouts.
+ */
+void blk_mq_force_complete_rq(struct request *rq)
{
struct blk_mq_ctx *ctx = rq->mq_ctx;
struct request_queue *q = rq->q;
@@ -602,6 +612,7 @@ static void __blk_mq_complete_request(struct request *rq)
}
put_cpu();
}
+EXPORT_SYMBOL_GPL(blk_mq_force_complete_rq);
static void hctx_unlock(struct blk_mq_hw_ctx *hctx, int srcu_idx)
__releases(hctx->srcu)
@@ -635,7 +646,7 @@ bool blk_mq_complete_request(struct request *rq)
{
if (unlikely(blk_should_fake_timeout(rq->q)))
return false;
- __blk_mq_complete_request(rq);
+ blk_mq_force_complete_rq(rq);
return true;
}
EXPORT_SYMBOL(blk_mq_complete_request);
diff --git a/include/linux/blk-mq.h b/include/linux/blk-mq.h
index d7307795439a..856bb10993cf 100644
--- a/include/linux/blk-mq.h
+++ b/include/linux/blk-mq.h
@@ -494,6 +494,7 @@ void blk_mq_requeue_request(struct request *rq, bool kick_requeue_list);
void blk_mq_kick_requeue_list(struct request_queue *q);
void blk_mq_delay_kick_requeue_list(struct request_queue *q, unsigned long msecs);
bool blk_mq_complete_request(struct request *rq);
+void blk_mq_force_complete_rq(struct request *rq);
bool blk_mq_bio_list_merge(struct request_queue *q, struct list_head *list,
struct bio *bio, unsigned int nr_segs);
bool blk_mq_queue_stopped(struct request_queue *q);
--
2.24.1
_______________________________________________
linux-nvme mailing list
linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCHv4 2/2] nvme: force complete cancelled requests
2020-05-29 14:51 ` Keith Busch
@ 2020-05-29 14:52 ` Keith Busch
-1 siblings, 0 replies; 12+ messages in thread
From: Keith Busch @ 2020-05-29 14:52 UTC (permalink / raw)
To: linux-nvme, hch, sagi, linux-block, axboe
Cc: alan.adamson, Keith Busch, Johannes Thumshirn, Ming Lei
Use blk_mq_foce_complete_rq() to bypass fake timeout error injection so
that request reclaim may proceed.
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Reviewed-by: Ming Lei <ming.lei@redhat.com>
Signed-off-by: Keith Busch <kbusch@kernel.org>
---
drivers/nvme/host/core.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index ba860efd250d..891e9461bfae 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -310,7 +310,7 @@ bool nvme_cancel_request(struct request *req, void *data, bool reserved)
return true;
nvme_req(req)->status = NVME_SC_HOST_ABORTED_CMD;
- blk_mq_complete_request(req);
+ blk_mq_force_complete_rq(req);
return true;
}
EXPORT_SYMBOL_GPL(nvme_cancel_request);
--
2.24.1
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCHv4 2/2] nvme: force complete cancelled requests
@ 2020-05-29 14:52 ` Keith Busch
0 siblings, 0 replies; 12+ messages in thread
From: Keith Busch @ 2020-05-29 14:52 UTC (permalink / raw)
To: linux-nvme, hch, sagi, linux-block, axboe
Cc: Keith Busch, Johannes Thumshirn, alan.adamson, Ming Lei
Use blk_mq_foce_complete_rq() to bypass fake timeout error injection so
that request reclaim may proceed.
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Reviewed-by: Ming Lei <ming.lei@redhat.com>
Signed-off-by: Keith Busch <kbusch@kernel.org>
---
drivers/nvme/host/core.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index ba860efd250d..891e9461bfae 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -310,7 +310,7 @@ bool nvme_cancel_request(struct request *req, void *data, bool reserved)
return true;
nvme_req(req)->status = NVME_SC_HOST_ABORTED_CMD;
- blk_mq_complete_request(req);
+ blk_mq_force_complete_rq(req);
return true;
}
EXPORT_SYMBOL_GPL(nvme_cancel_request);
--
2.24.1
_______________________________________________
linux-nvme mailing list
linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme
^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [PATCHv4 1/2] blk-mq: blk-mq: provide forced completion method
2020-05-29 14:51 ` Keith Busch
@ 2020-05-29 15:42 ` Daniel Wagner
-1 siblings, 0 replies; 12+ messages in thread
From: Daniel Wagner @ 2020-05-29 15:42 UTC (permalink / raw)
To: Keith Busch; +Cc: linux-nvme, hch, sagi, linux-block, axboe, alan.adamson
On Fri, May 29, 2020 at 07:51:59AM -0700, Keith Busch wrote:
> Drivers may need to bypass error injection for error recovery. Rename
> __blk_mq_complete_request() to blk_mq_force_complete_rq() and export
> that function so drivers may skip potential fake timeouts after they've
> reclaimed lost requests.
>
> Signed-off-by: Keith Busch <kbusch@kernel.org>
Reviewed-by: Daniel Wagner <dwagner@suse.de>
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCHv4 1/2] blk-mq: blk-mq: provide forced completion method
@ 2020-05-29 15:42 ` Daniel Wagner
0 siblings, 0 replies; 12+ messages in thread
From: Daniel Wagner @ 2020-05-29 15:42 UTC (permalink / raw)
To: Keith Busch; +Cc: axboe, sagi, linux-nvme, linux-block, alan.adamson, hch
On Fri, May 29, 2020 at 07:51:59AM -0700, Keith Busch wrote:
> Drivers may need to bypass error injection for error recovery. Rename
> __blk_mq_complete_request() to blk_mq_force_complete_rq() and export
> that function so drivers may skip potential fake timeouts after they've
> reclaimed lost requests.
>
> Signed-off-by: Keith Busch <kbusch@kernel.org>
Reviewed-by: Daniel Wagner <dwagner@suse.de>
_______________________________________________
linux-nvme mailing list
linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCHv4 2/2] nvme: force complete cancelled requests
2020-05-29 14:52 ` Keith Busch
@ 2020-05-29 15:42 ` Daniel Wagner
-1 siblings, 0 replies; 12+ messages in thread
From: Daniel Wagner @ 2020-05-29 15:42 UTC (permalink / raw)
To: Keith Busch
Cc: linux-nvme, hch, sagi, linux-block, axboe, alan.adamson,
Johannes Thumshirn, Ming Lei
On Fri, May 29, 2020 at 07:52:00AM -0700, Keith Busch wrote:
> Use blk_mq_foce_complete_rq() to bypass fake timeout error injection so
> that request reclaim may proceed.
>
> Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
> Reviewed-by: Ming Lei <ming.lei@redhat.com>
> Signed-off-by: Keith Busch <kbusch@kernel.org>
Reviewed-by: Daniel Wagner <dwagner@suse.de>
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCHv4 2/2] nvme: force complete cancelled requests
@ 2020-05-29 15:42 ` Daniel Wagner
0 siblings, 0 replies; 12+ messages in thread
From: Daniel Wagner @ 2020-05-29 15:42 UTC (permalink / raw)
To: Keith Busch
Cc: axboe, sagi, Johannes Thumshirn, linux-nvme, Ming Lei,
linux-block, alan.adamson, hch
On Fri, May 29, 2020 at 07:52:00AM -0700, Keith Busch wrote:
> Use blk_mq_foce_complete_rq() to bypass fake timeout error injection so
> that request reclaim may proceed.
>
> Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
> Reviewed-by: Ming Lei <ming.lei@redhat.com>
> Signed-off-by: Keith Busch <kbusch@kernel.org>
Reviewed-by: Daniel Wagner <dwagner@suse.de>
_______________________________________________
linux-nvme mailing list
linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCHv4 1/2] blk-mq: blk-mq: provide forced completion method
2020-05-29 14:51 ` Keith Busch
@ 2020-05-29 16:22 ` Jens Axboe
-1 siblings, 0 replies; 12+ messages in thread
From: Jens Axboe @ 2020-05-29 16:22 UTC (permalink / raw)
To: Keith Busch, linux-nvme, hch, sagi, linux-block; +Cc: alan.adamson
On 5/29/20 8:51 AM, Keith Busch wrote:
> Drivers may need to bypass error injection for error recovery. Rename
> __blk_mq_complete_request() to blk_mq_force_complete_rq() and export
> that function so drivers may skip potential fake timeouts after they've
> reclaimed lost requests.
Applied 1-2, thanks Keith.
--
Jens Axboe
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCHv4 1/2] blk-mq: blk-mq: provide forced completion method
@ 2020-05-29 16:22 ` Jens Axboe
0 siblings, 0 replies; 12+ messages in thread
From: Jens Axboe @ 2020-05-29 16:22 UTC (permalink / raw)
To: Keith Busch, linux-nvme, hch, sagi, linux-block; +Cc: alan.adamson
On 5/29/20 8:51 AM, Keith Busch wrote:
> Drivers may need to bypass error injection for error recovery. Rename
> __blk_mq_complete_request() to blk_mq_force_complete_rq() and export
> that function so drivers may skip potential fake timeouts after they've
> reclaimed lost requests.
Applied 1-2, thanks Keith.
--
Jens Axboe
_______________________________________________
linux-nvme mailing list
linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCHv4 1/2] blk-mq: blk-mq: provide forced completion method
2020-05-29 14:51 ` Keith Busch
@ 2020-05-29 18:02 ` Alan Adamson
-1 siblings, 0 replies; 12+ messages in thread
From: Alan Adamson @ 2020-05-29 18:02 UTC (permalink / raw)
To: Keith Busch, linux-nvme, hch, sagi, linux-block, axboe
Passes my tests, thanks.
Reviewed-by: Alan Adamson <alan.adamson@oracle.com>
On 5/29/20 7:51 AM, Keith Busch wrote:
> Drivers may need to bypass error injection for error recovery. Rename
> __blk_mq_complete_request() to blk_mq_force_complete_rq() and export
> that function so drivers may skip potential fake timeouts after they've
> reclaimed lost requests.
>
> Signed-off-by: Keith Busch <kbusch@kernel.org>
> ---
> block/blk-mq.c | 15 +++++++++++++--
> include/linux/blk-mq.h | 1 +
> 2 files changed, 14 insertions(+), 2 deletions(-)
>
> diff --git a/block/blk-mq.c b/block/blk-mq.c
> index cac11945f602..560a114a82f8 100644
> --- a/block/blk-mq.c
> +++ b/block/blk-mq.c
> @@ -556,7 +556,17 @@ static void __blk_mq_complete_request_remote(void *data)
> q->mq_ops->complete(rq);
> }
>
> -static void __blk_mq_complete_request(struct request *rq)
> +/**
> + * blk_mq_force_complete_rq() - Force complete the request, bypassing any error
> + * injection that could drop the completion.
> + * @rq: Request to be force completed
> + *
> + * Drivers should use blk_mq_complete_request() to complete requests in their
> + * normal IO path. For timeout error recovery, drivers may call this forced
> + * completion routine after they've reclaimed timed out requests to bypass
> + * potentially subsequent fake timeouts.
> + */
> +void blk_mq_force_complete_rq(struct request *rq)
> {
> struct blk_mq_ctx *ctx = rq->mq_ctx;
> struct request_queue *q = rq->q;
> @@ -602,6 +612,7 @@ static void __blk_mq_complete_request(struct request *rq)
> }
> put_cpu();
> }
> +EXPORT_SYMBOL_GPL(blk_mq_force_complete_rq);
>
> static void hctx_unlock(struct blk_mq_hw_ctx *hctx, int srcu_idx)
> __releases(hctx->srcu)
> @@ -635,7 +646,7 @@ bool blk_mq_complete_request(struct request *rq)
> {
> if (unlikely(blk_should_fake_timeout(rq->q)))
> return false;
> - __blk_mq_complete_request(rq);
> + blk_mq_force_complete_rq(rq);
> return true;
> }
> EXPORT_SYMBOL(blk_mq_complete_request);
> diff --git a/include/linux/blk-mq.h b/include/linux/blk-mq.h
> index d7307795439a..856bb10993cf 100644
> --- a/include/linux/blk-mq.h
> +++ b/include/linux/blk-mq.h
> @@ -494,6 +494,7 @@ void blk_mq_requeue_request(struct request *rq, bool kick_requeue_list);
> void blk_mq_kick_requeue_list(struct request_queue *q);
> void blk_mq_delay_kick_requeue_list(struct request_queue *q, unsigned long msecs);
> bool blk_mq_complete_request(struct request *rq);
> +void blk_mq_force_complete_rq(struct request *rq);
> bool blk_mq_bio_list_merge(struct request_queue *q, struct list_head *list,
> struct bio *bio, unsigned int nr_segs);
> bool blk_mq_queue_stopped(struct request_queue *q);
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCHv4 1/2] blk-mq: blk-mq: provide forced completion method
@ 2020-05-29 18:02 ` Alan Adamson
0 siblings, 0 replies; 12+ messages in thread
From: Alan Adamson @ 2020-05-29 18:02 UTC (permalink / raw)
To: Keith Busch, linux-nvme, hch, sagi, linux-block, axboe
Passes my tests, thanks.
Reviewed-by: Alan Adamson <alan.adamson@oracle.com>
On 5/29/20 7:51 AM, Keith Busch wrote:
> Drivers may need to bypass error injection for error recovery. Rename
> __blk_mq_complete_request() to blk_mq_force_complete_rq() and export
> that function so drivers may skip potential fake timeouts after they've
> reclaimed lost requests.
>
> Signed-off-by: Keith Busch <kbusch@kernel.org>
> ---
> block/blk-mq.c | 15 +++++++++++++--
> include/linux/blk-mq.h | 1 +
> 2 files changed, 14 insertions(+), 2 deletions(-)
>
> diff --git a/block/blk-mq.c b/block/blk-mq.c
> index cac11945f602..560a114a82f8 100644
> --- a/block/blk-mq.c
> +++ b/block/blk-mq.c
> @@ -556,7 +556,17 @@ static void __blk_mq_complete_request_remote(void *data)
> q->mq_ops->complete(rq);
> }
>
> -static void __blk_mq_complete_request(struct request *rq)
> +/**
> + * blk_mq_force_complete_rq() - Force complete the request, bypassing any error
> + * injection that could drop the completion.
> + * @rq: Request to be force completed
> + *
> + * Drivers should use blk_mq_complete_request() to complete requests in their
> + * normal IO path. For timeout error recovery, drivers may call this forced
> + * completion routine after they've reclaimed timed out requests to bypass
> + * potentially subsequent fake timeouts.
> + */
> +void blk_mq_force_complete_rq(struct request *rq)
> {
> struct blk_mq_ctx *ctx = rq->mq_ctx;
> struct request_queue *q = rq->q;
> @@ -602,6 +612,7 @@ static void __blk_mq_complete_request(struct request *rq)
> }
> put_cpu();
> }
> +EXPORT_SYMBOL_GPL(blk_mq_force_complete_rq);
>
> static void hctx_unlock(struct blk_mq_hw_ctx *hctx, int srcu_idx)
> __releases(hctx->srcu)
> @@ -635,7 +646,7 @@ bool blk_mq_complete_request(struct request *rq)
> {
> if (unlikely(blk_should_fake_timeout(rq->q)))
> return false;
> - __blk_mq_complete_request(rq);
> + blk_mq_force_complete_rq(rq);
> return true;
> }
> EXPORT_SYMBOL(blk_mq_complete_request);
> diff --git a/include/linux/blk-mq.h b/include/linux/blk-mq.h
> index d7307795439a..856bb10993cf 100644
> --- a/include/linux/blk-mq.h
> +++ b/include/linux/blk-mq.h
> @@ -494,6 +494,7 @@ void blk_mq_requeue_request(struct request *rq, bool kick_requeue_list);
> void blk_mq_kick_requeue_list(struct request_queue *q);
> void blk_mq_delay_kick_requeue_list(struct request_queue *q, unsigned long msecs);
> bool blk_mq_complete_request(struct request *rq);
> +void blk_mq_force_complete_rq(struct request *rq);
> bool blk_mq_bio_list_merge(struct request_queue *q, struct list_head *list,
> struct bio *bio, unsigned int nr_segs);
> bool blk_mq_queue_stopped(struct request_queue *q);
_______________________________________________
linux-nvme mailing list
linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2020-05-29 17:59 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-29 14:51 [PATCHv4 1/2] blk-mq: blk-mq: provide forced completion method Keith Busch
2020-05-29 14:51 ` Keith Busch
2020-05-29 14:52 ` [PATCHv4 2/2] nvme: force complete cancelled requests Keith Busch
2020-05-29 14:52 ` Keith Busch
2020-05-29 15:42 ` Daniel Wagner
2020-05-29 15:42 ` Daniel Wagner
2020-05-29 15:42 ` [PATCHv4 1/2] blk-mq: blk-mq: provide forced completion method Daniel Wagner
2020-05-29 15:42 ` Daniel Wagner
2020-05-29 16:22 ` Jens Axboe
2020-05-29 16:22 ` Jens Axboe
2020-05-29 18:02 ` Alan Adamson
2020-05-29 18:02 ` Alan Adamson
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.