2020-05-06 14:37:08

by Veerabhadrarao Badiganti

[permalink] [raw]
Subject: [PATCH V1 1/2] mmc: core: Check request type before completing the request

In the request completion path with CQE, request type is being checked
after the request is getting completed. This is resulting in returning
the wrong request type and leading to the IO hang issue.

ASYNC request type is getting returned for DCMD type requests.
Because of this mismatch, mq->cqe_busy flag is never getting cleared
and the driver is not invoking blk_mq_hw_run_queue. So requests are not
getting dispatched to the LLD from the block layer.

All these eventually leading to IO hang issues.
So, get the request type before completing the request.

Cc: <[email protected]> # v4.19+
Signed-off-by: Veerabhadrarao Badiganti <[email protected]>
---
drivers/mmc/core/block.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/mmc/core/block.c b/drivers/mmc/core/block.c
index 8499b56..c5367e2 100644
--- a/drivers/mmc/core/block.c
+++ b/drivers/mmc/core/block.c
@@ -1370,6 +1370,7 @@ static void mmc_blk_cqe_complete_rq(struct mmc_queue *mq, struct request *req)
struct mmc_request *mrq = &mqrq->brq.mrq;
struct request_queue *q = req->q;
struct mmc_host *host = mq->card->host;
+ enum mmc_issue_type issue_type = mmc_issue_type(mq, req);
unsigned long flags;
bool put_card;
int err;
@@ -1399,7 +1400,7 @@ static void mmc_blk_cqe_complete_rq(struct mmc_queue *mq, struct request *req)

spin_lock_irqsave(&mq->lock, flags);

- mq->in_flight[mmc_issue_type(mq, req)] -= 1;
+ mq->in_flight[issue_type] -= 1;

put_card = (mmc_tot_in_flight(mq) == 0);

--
Qualcomm India Private Limited, on behalf of Qualcomm Innovation Center, Inc., is a member of Code Aurora Forum, a Linux Foundation Collaborative Project


2020-05-06 17:08:24

by Adrian Hunter

[permalink] [raw]
Subject: Re: [PATCH V1 1/2] mmc: core: Check request type before completing the request

On 6/05/20 5:34 pm, Veerabhadrarao Badiganti wrote:
> In the request completion path with CQE, request type is being checked
> after the request is getting completed. This is resulting in returning
> the wrong request type and leading to the IO hang issue.
>
> ASYNC request type is getting returned for DCMD type requests.
> Because of this mismatch, mq->cqe_busy flag is never getting cleared
> and the driver is not invoking blk_mq_hw_run_queue. So requests are not
> getting dispatched to the LLD from the block layer.
>
> All these eventually leading to IO hang issues.
> So, get the request type before completing the request.
>
> Cc: <[email protected]> # v4.19+

The fixed commit was in 4.16

> Signed-off-by: Veerabhadrarao Badiganti <[email protected]>

Fixes: 1e8e55b67030 ("mmc: block: Add CQE support")
Acked-by: Adrian Hunter <[email protected]>

Thank you for finding this!

> ---
> drivers/mmc/core/block.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/mmc/core/block.c b/drivers/mmc/core/block.c
> index 8499b56..c5367e2 100644
> --- a/drivers/mmc/core/block.c
> +++ b/drivers/mmc/core/block.c
> @@ -1370,6 +1370,7 @@ static void mmc_blk_cqe_complete_rq(struct mmc_queue *mq, struct request *req)
> struct mmc_request *mrq = &mqrq->brq.mrq;
> struct request_queue *q = req->q;
> struct mmc_host *host = mq->card->host;
> + enum mmc_issue_type issue_type = mmc_issue_type(mq, req);
> unsigned long flags;
> bool put_card;
> int err;
> @@ -1399,7 +1400,7 @@ static void mmc_blk_cqe_complete_rq(struct mmc_queue *mq, struct request *req)
>
> spin_lock_irqsave(&mq->lock, flags);
>
> - mq->in_flight[mmc_issue_type(mq, req)] -= 1;
> + mq->in_flight[issue_type] -= 1;
>
> put_card = (mmc_tot_in_flight(mq) == 0);
>
>

2020-05-08 08:14:24

by Ulf Hansson

[permalink] [raw]
Subject: Re: [PATCH V1 1/2] mmc: core: Check request type before completing the request

On Wed, 6 May 2020 at 16:34, Veerabhadrarao Badiganti
<[email protected]> wrote:
>
> In the request completion path with CQE, request type is being checked
> after the request is getting completed. This is resulting in returning
> the wrong request type and leading to the IO hang issue.
>
> ASYNC request type is getting returned for DCMD type requests.
> Because of this mismatch, mq->cqe_busy flag is never getting cleared
> and the driver is not invoking blk_mq_hw_run_queue. So requests are not
> getting dispatched to the LLD from the block layer.
>
> All these eventually leading to IO hang issues.
> So, get the request type before completing the request.
>
> Cc: <[email protected]> # v4.19+
> Signed-off-by: Veerabhadrarao Badiganti <[email protected]>

Applied for fixes, and by updating the tags that were provided by
Adrian, thanks!

Kind regards
Uffe


> ---
> drivers/mmc/core/block.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/mmc/core/block.c b/drivers/mmc/core/block.c
> index 8499b56..c5367e2 100644
> --- a/drivers/mmc/core/block.c
> +++ b/drivers/mmc/core/block.c
> @@ -1370,6 +1370,7 @@ static void mmc_blk_cqe_complete_rq(struct mmc_queue *mq, struct request *req)
> struct mmc_request *mrq = &mqrq->brq.mrq;
> struct request_queue *q = req->q;
> struct mmc_host *host = mq->card->host;
> + enum mmc_issue_type issue_type = mmc_issue_type(mq, req);
> unsigned long flags;
> bool put_card;
> int err;
> @@ -1399,7 +1400,7 @@ static void mmc_blk_cqe_complete_rq(struct mmc_queue *mq, struct request *req)
>
> spin_lock_irqsave(&mq->lock, flags);
>
> - mq->in_flight[mmc_issue_type(mq, req)] -= 1;
> + mq->in_flight[issue_type] -= 1;
>
> put_card = (mmc_tot_in_flight(mq) == 0);
>
> --
> Qualcomm India Private Limited, on behalf of Qualcomm Innovation Center, Inc., is a member of Code Aurora Forum, a Linux Foundation Collaborative Project