Skip to contentSkip to conversation

CQE fixes

PATCH In review Veerabhadrarao Badiganti 4 participants 15 messages May 6, 2020 – May 9, 2020

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

cover CQE fixes

Fixes for a couple of issues observed with CQE. One with CQE completion path and the other one is with CQE recovery path.

Sarthak Garg (1):
mmc: core: Fix recursive locking issue in CQE recovery path

Veerabhadrarao Badiganti (1):
mmc: core: Check request type before completing the request

 drivers/mmc/core/block.c |  3 ++-
 drivers/mmc/core/queue.c | 11 ++++++-----
 2 files changed, 8 insertions(+), 6 deletions(-)
Signature · 1 line
Qualcomm India Private Limited, on behalf of Qualcomm Innovation Center, Inc., is a member of Code Aurora Forum, a Linux Foundation Collaborative Project
#1 lore raw

PATCH 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.

---
 drivers/mmc/core/block.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/mmc/core/block.c +2 -1
index 8499b56..c5367e2 100644
@@ -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);
 
Signature · 1 line
Qualcomm India Private Limited, on behalf of Qualcomm Innovation Center, Inc., is a member of Code Aurora Forum, a Linux Foundation Collaborative Project
Acked-by on v1 1/2
#2 lore raw

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

Quoted 9 lines · Veerabhadrarao Badiganti

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.

Quoted 4 lines

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

Quoted 1 line
Fixes 1e8e55b67030 ("mmc: block: Add CQE support")

Thank you for finding this!

Quoted 26 lines
---
 drivers/mmc/core/block.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/mmc/core/block.c +2 -1
index 8499b56..c5367e2 100644
@@ -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);
 
#3 lore raw

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

In reply to Veerabhadrarao Badiganti
Quoted 10 lines · Veerabhadrarao Badiganti

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.

Quoted 5 lines

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

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

Kind regards
Uffe

Quoted 27 lines
---
 drivers/mmc/core/block.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/mmc/core/block.c +2 -2
index 8499b56..c5367e2 100644
@@ -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

#4 lore raw

PATCH 2/2 mmc: core: Fix recursive locking issue in CQE recovery path

In reply to Veerabhadrarao Badiganti

From: Sarthak Garg <[email protected]>

Consider the following stack trace

-001|raw_spin_lock_irqsave
-002|mmc_blk_cqe_complete_rq
-003|__blk_mq_complete_request(inline)
-003|blk_mq_complete_request(rq)
-004|mmc_cqe_timed_out(inline)
-004|mmc_mq_timed_out

mmc_mq_timed_out acquires the queue_lock for the first time. The mmc_blk_cqe_complete_rq function also tries to acquire the same queue lock resulting in recursive locking where the task is spinning for the same lock which it has already acquired leading to watchdog bark.

Fix this issue with the lock only for the required critical section.

---
 drivers/mmc/core/queue.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)
drivers/mmc/core/queue.c +6 -5
index 25bee3d..72bef39 100644
@@ -107,7 +107,7 @@ static enum blk_eh_timer_return mmc_cqe_timed_out(struct request *req)
 	case MMC_ISSUE_DCMD:
 		if (host->cqe_ops->cqe_timeout(host, mrq, &recovery_needed)) {
 			if (recovery_needed)
-				__mmc_cqe_recovery_notifier(mq);
+				mmc_cqe_recovery_notifier(mrq);
 			return BLK_EH_RESET_TIMER;
 		}
 		/* No timeout (XXX: huh? comment doesn't make much sense) */
@@ -131,12 +131,13 @@ static enum blk_eh_timer_return mmc_mq_timed_out(struct request *req,
 
 	spin_lock_irqsave(&mq->lock, flags);
 
-	if (mq->recovery_needed || !mq->use_cqe || host->hsq_enabled)
+	if (mq->recovery_needed || !mq->use_cqe || host->hsq_enabled) {
 		ret = BLK_EH_RESET_TIMER;
-	else
+		spin_unlock_irqrestore(&mq->lock, flags);
+	} else {
+		spin_unlock_irqrestore(&mq->lock, flags);
 		ret = mmc_cqe_timed_out(req);
-
-	spin_unlock_irqrestore(&mq->lock, flags);
+	}
 
 	return ret;
 }
Signature · 1 line
Qualcomm India Private Limited, on behalf of Qualcomm Innovation Center, Inc., is a member of Code Aurora Forum, a Linux Foundation Collaborative Project
#5 lore raw

Re: [PATCH V1 2/2] mmc: core: Fix recursive locking issue in CQE recovery path

Quoted 44 lines · Veerabhadrarao Badiganti

From: Sarthak Garg <[email protected]>

Consider the following stack trace

-001|raw_spin_lock_irqsave
-002|mmc_blk_cqe_complete_rq
-003|__blk_mq_complete_request(inline)
-003|blk_mq_complete_request(rq)
-004|mmc_cqe_timed_out(inline)
-004|mmc_mq_timed_out

mmc_mq_timed_out acquires the queue_lock for the first time. The mmc_blk_cqe_complete_rq function also tries to acquire the same queue lock resulting in recursive locking where the task is spinning for the same lock which it has already acquired leading to watchdog bark.

Fix this issue with the lock only for the required critical section.

---
 drivers/mmc/core/queue.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)
drivers/mmc/core/queue.c +1 -2
index 25bee3d..72bef39 100644
@@ -107,7 +107,7 @@ static enum blk_eh_timer_return mmc_cqe_timed_out(struct request *req)
 	case MMC_ISSUE_DCMD:
 		if (host->cqe_ops->cqe_timeout(host, mrq, &recovery_needed)) {
 			if (recovery_needed)
-				__mmc_cqe_recovery_notifier(mq);
+				mmc_cqe_recovery_notifier(mrq);
 			return BLK_EH_RESET_TIMER;
 		}
 		/* No timeout (XXX: huh? comment doesn't make much sense) */
@@ -131,12 +131,13 @@ static enum blk_eh_timer_return mmc_mq_timed_out(struct request *req,
 
 	spin_lock_irqsave(&mq->lock, flags);
 
-	if (mq->recovery_needed || !mq->use_cqe || host->hsq_enabled)

drivers/mmc/core/queue.c static enum blk_eh_timer_return mmc_mq_timed_out(struct request *req, · line 140

Quoted 10 lines
drivers/mmc/core/queue.c +5 -3
+	if (mq->recovery_needed || !mq->use_cqe || host->hsq_enabled) {
 		ret = BLK_EH_RESET_TIMER;
-	else
+		spin_unlock_irqrestore(&mq->lock, flags);
+	} else {
+		spin_unlock_irqrestore(&mq->lock, flags);
 		ret = mmc_cqe_timed_out(req);
-
-	spin_unlock_irqrestore(&mq->lock, flags);
+	}

This looks good, but I think there needs to be another change also. I will send a patch for that, but in the meantime maybe you could straighten up the code flow through the spinlock e.g.

	spin_lock_irqsave(&mq->lock, flags);
	ignore = mq->recovery_needed || !mq->use_cqe || host->hsq_enabled;
	spin_unlock_irqrestore(&mq->lock, flags);

	return ignore ? BLK_EH_RESET_TIMER : mmc_cqe_timed_out(req);

And add a fixes tag.

Quoted 4 lines
drivers/mmc/core/queue.c +0 -0
 	return ret;
 }
 
#6 lore raw

PATCH 1/1 mmc: block: Fix request completion in the CQE timeout path

First, it should be noted that the CQE timeout (60 seconds) is substantial so a CQE request that times out is really stuck, and the race between timeout and completion is extremely unlikely. Nevertheless this patch fixes an issue with it.

Commit ad73d6feadbd7b ("mmc: complete requests from ->timeout") preserved the existing functionality, to complete the request. However that had only been necessary because the block layer timeout handler had been marking the request to prevent it from being completed normally. That restriction was removed at the same time, the result being that a request that has gone will have been completed anyway. That is, the completion in the timeout handler became unnecessary.

At the time, the unnecessary completion was harmless because the block layer would ignore it, although that changed in kernel v5.0.

Note for stable, this patch will not apply cleanly without patch "mmc:
core: Fix recursive locking issue in CQE recovery path"

Fixes ad73d6feadbd7b ("mmc: complete requests from ->timeout")

---

This is the patch I alluded to when replying to "mmc: core: Fix recursive locking issue in CQE recovery path"

 drivers/mmc/core/queue.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/mmc/core/queue.c +0 -0
index 72bef39d7011..10ea67892b5f 100644
@@ -110,8 +110,7 @@ static enum blk_eh_timer_return mmc_cqe_timed_out(struct

request *req)
mmc_cqe_recovery_notifier(mrq);
return BLK_EH_RESET_TIMER;
}
- /* No timeout (XXX: huh? comment doesn't make much sense) */
- blk_mq_complete_request(req);
+ /* The request has gone already */
return BLK_EH_DONE;
default:
/* Timeout is handled by mmc core */

Signature · 1 line
2.17.1
#7 lore raw

Re: [PATCH] mmc: block: Fix request completion in the CQE timeout path

Quoted 20 lines · Adrian Hunter

First, it should be noted that the CQE timeout (60 seconds) is substantial so a CQE request that times out is really stuck, and the race between timeout and completion is extremely unlikely. Nevertheless this patch fixes an issue with it.

Commit ad73d6feadbd7b ("mmc: complete requests from ->timeout") preserved the existing functionality, to complete the request. However that had only been necessary because the block layer timeout handler had been marking the request to prevent it from being completed normally. That restriction was removed at the same time, the result being that a request that has gone will have been completed anyway. That is, the completion in the timeout handler became unnecessary.

At the time, the unnecessary completion was harmless because the block layer would ignore it, although that changed in kernel v5.0.

Note for stable, this patch will not apply cleanly without patch "mmc:
core: Fix recursive locking issue in CQE recovery path"

Quoted 8 lines
Fixes ad73d6feadbd7b ("mmc: complete requests from ->timeout")

---

This is the patch I alluded to when replying to "mmc: core: Fix recursive locking issue in CQE recovery path"

Looks like the patch got corrupted, I was trying to fix it, but just couldn't figure it out.

Can you please re-format and do a repost?

Kind regards
Uffe

Quoted 23 lines

 drivers/mmc/core/queue.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/mmc/core/queue.c +1 -2
index 72bef39d7011..10ea67892b5f 100644
@@ -110,8 +110,7 @@ static enum blk_eh_timer_return mmc_cqe_timed_out(struct
 request *req)
                                mmc_cqe_recovery_notifier(mrq);
                        return BLK_EH_RESET_TIMER;
                }
-               /* No timeout (XXX: huh? comment doesn't make much sense) */
-               blk_mq_complete_request(req);
+               /* The request has gone already */
                return BLK_EH_DONE;
        default:
                /* Timeout is handled by mmc core */

--
2.17.1

#8 lore raw

PATCH RESEND 1/1 mmc: block: Fix request completion in the CQE timeout path

First, it should be noted that the CQE timeout (60 seconds) is substantial so a CQE request that times out is really stuck, and the race between timeout and completion is extremely unlikely. Nevertheless this patch fixes an issue with it.

Commit ad73d6feadbd7b ("mmc: complete requests from ->timeout") preserved the existing functionality, to complete the request. However that had only been necessary because the block layer timeout handler had been marking the request to prevent it from being completed normally. That restriction was removed at the same time, the result being that a request that has gone will have been completed anyway. That is, the completion was unnecessary.

At the time, the unnecessary completion was harmless because the block layer would ignore it, although that changed in kernel v5.0.

Note for stable, this patch will not apply cleanly without patch "mmc:
core: Fix recursive locking issue in CQE recovery path"

Fixes ad73d6feadbd7b ("mmc: complete requests from ->timeout")
---
 drivers/mmc/core/queue.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/mmc/core/queue.c +1 -2
index 72bef39d7011..10ea67892b5f 100644
@@ -110,8 +110,7 @@ static enum blk_eh_timer_return mmc_cqe_timed_out(struct request *req)
 				mmc_cqe_recovery_notifier(mrq);
 			return BLK_EH_RESET_TIMER;
 		}
-		/* No timeout (XXX: huh? comment doesn't make much sense) */
-		blk_mq_complete_request(req);
+		/* The request has gone already */
 		return BLK_EH_DONE;
 	default:
 		/* Timeout is handled by mmc core */
Signature · 1 line
2.17.1
#9 lore raw

Re: [PATCH RESEND] mmc: block: Fix request completion in the CQE timeout path

Quoted 17 lines · Adrian Hunter

First, it should be noted that the CQE timeout (60 seconds) is substantial so a CQE request that times out is really stuck, and the race between timeout and completion is extremely unlikely. Nevertheless this patch fixes an issue with it.

Commit ad73d6feadbd7b ("mmc: complete requests from ->timeout") preserved the existing functionality, to complete the request. However that had only been necessary because the block layer timeout handler had been marking the request to prevent it from being completed normally. That restriction was removed at the same time, the result being that a request that has gone will have been completed anyway. That is, the completion was unnecessary.

At the time, the unnecessary completion was harmless because the block layer would ignore it, although that changed in kernel v5.0.

Quoted 6 lines

Note for stable, this patch will not apply cleanly without patch "mmc:
core: Fix recursive locking issue in CQE recovery path"

Fixes ad73d6feadbd7b ("mmc: complete requests from ->timeout")

Applied for fixes, thanks!

Kind regards
Uffe

Quoted 21 lines
---
 drivers/mmc/core/queue.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/mmc/core/queue.c +1 -3
index 72bef39d7011..10ea67892b5f 100644
@@ -110,8 +110,7 @@ static enum blk_eh_timer_return mmc_cqe_timed_out(struct request *req)
                                mmc_cqe_recovery_notifier(mrq);
                        return BLK_EH_RESET_TIMER;
                }
-               /* No timeout (XXX: huh? comment doesn't make much sense) */
-               blk_mq_complete_request(req);
+               /* The request has gone already */
                return BLK_EH_DONE;
        default:
                /* Timeout is handled by mmc core */
--

2.17.1

#10 lore raw

PATCH v2 1/1 mmc: core: Fix recursive locking issue in CQE recovery path

In reply to Veerabhadrarao Badiganti

From: Sarthak Garg <[email protected]>

Consider the following stack trace

-001|raw_spin_lock_irqsave
-002|mmc_blk_cqe_complete_rq
-003|__blk_mq_complete_request(inline)
-003|blk_mq_complete_request(rq)
-004|mmc_cqe_timed_out(inline)
-004|mmc_mq_timed_out

mmc_mq_timed_out acquires the queue_lock for the first time. The mmc_blk_cqe_complete_rq function also tries to acquire the same queue lock resulting in recursive locking where the task is spinning for the same lock which it has already acquired leading to watchdog bark.

Fix this issue with the lock only for the required critical section.

Fixes 1e8e55b67030 ("mmc: block: Add CQE support")
---
 drivers/mmc/core/queue.c | 13 ++++---------
 1 file changed, 4 insertions(+), 9 deletions(-)
drivers/mmc/core/queue.c +4 -9
index 25bee3d..b5fd3bc 100644
@@ -107,7 +107,7 @@ static enum blk_eh_timer_return mmc_cqe_timed_out(struct request *req)
 	case MMC_ISSUE_DCMD:
 		if (host->cqe_ops->cqe_timeout(host, mrq, &recovery_needed)) {
 			if (recovery_needed)
-				__mmc_cqe_recovery_notifier(mq);
+				mmc_cqe_recovery_notifier(mrq);
 			return BLK_EH_RESET_TIMER;
 		}
 		/* No timeout (XXX: huh? comment doesn't make much sense) */
@@ -127,18 +127,13 @@ static enum blk_eh_timer_return mmc_mq_timed_out(struct request *req,
 	struct mmc_card *card = mq->card;
 	struct mmc_host *host = card->host;
 	unsigned long flags;
-	int ret;
+	bool ignore_tout;
 
 	spin_lock_irqsave(&mq->lock, flags);
-
-	if (mq->recovery_needed || !mq->use_cqe || host->hsq_enabled)
-		ret = BLK_EH_RESET_TIMER;
-	else
-		ret = mmc_cqe_timed_out(req);
-
+	ignore_tout = mq->recovery_needed || !mq->use_cqe || host->hsq_enabled;
 	spin_unlock_irqrestore(&mq->lock, flags);
 
-	return ret;
+	return ignore_tout ? BLK_EH_RESET_TIMER : mmc_cqe_timed_out(req);
 }
 
 static void mmc_mq_recovery_handler(struct work_struct *work)
Signature · 1 line
Qualcomm India Private Limited, on behalf of Qualcomm Innovation Center, Inc., is a member of Code Aurora Forum, a Linux Foundation Collaborative Project
Acked-by on v2 1/1
#11 lore raw

Re: [PATCH V2] mmc: core: Fix recursive locking issue in CQE recovery path

Quoted 17 lines · Veerabhadrarao Badiganti

From: Sarthak Garg <[email protected]>

Consider the following stack trace

-001|raw_spin_lock_irqsave
-002|mmc_blk_cqe_complete_rq
-003|__blk_mq_complete_request(inline)
-003|blk_mq_complete_request(rq)
-004|mmc_cqe_timed_out(inline)
-004|mmc_mq_timed_out

mmc_mq_timed_out acquires the queue_lock for the first time. The mmc_blk_cqe_complete_rq function also tries to acquire the same queue lock resulting in recursive locking where the task is spinning for the same lock which it has already acquired leading to watchdog bark.

Quoted 6 lines

Fix this issue with the lock only for the required critical section.

Fixes 1e8e55b67030 ("mmc: block: Add CQE support")
Quoted 40 lines
---
 drivers/mmc/core/queue.c | 13 ++++---------
 1 file changed, 4 insertions(+), 9 deletions(-)
drivers/mmc/core/queue.c +4 -9
index 25bee3d..b5fd3bc 100644
@@ -107,7 +107,7 @@ static enum blk_eh_timer_return mmc_cqe_timed_out(struct request *req)
 	case MMC_ISSUE_DCMD:
 		if (host->cqe_ops->cqe_timeout(host, mrq, &recovery_needed)) {
 			if (recovery_needed)
-				__mmc_cqe_recovery_notifier(mq);
+				mmc_cqe_recovery_notifier(mrq);
 			return BLK_EH_RESET_TIMER;
 		}
 		/* No timeout (XXX: huh? comment doesn't make much sense) */
@@ -127,18 +127,13 @@ static enum blk_eh_timer_return mmc_mq_timed_out(struct request *req,
 	struct mmc_card *card = mq->card;
 	struct mmc_host *host = card->host;
 	unsigned long flags;
-	int ret;
+	bool ignore_tout;
 
 	spin_lock_irqsave(&mq->lock, flags);
-
-	if (mq->recovery_needed || !mq->use_cqe || host->hsq_enabled)
-		ret = BLK_EH_RESET_TIMER;
-	else
-		ret = mmc_cqe_timed_out(req);
-
+	ignore_tout = mq->recovery_needed || !mq->use_cqe || host->hsq_enabled;
 	spin_unlock_irqrestore(&mq->lock, flags);
 
-	return ret;
+	return ignore_tout ? BLK_EH_RESET_TIMER : mmc_cqe_timed_out(req);
 }
 
 static void mmc_mq_recovery_handler(struct work_struct *work)
#12 lore raw

Re: [PATCH V2] mmc: core: Fix recursive locking issue in CQE recovery path

In reply to Veerabhadrarao Badiganti
Quoted 18 lines · Veerabhadrarao Badiganti

From: Sarthak Garg <[email protected]>

Consider the following stack trace

-001|raw_spin_lock_irqsave
-002|mmc_blk_cqe_complete_rq
-003|__blk_mq_complete_request(inline)
-003|blk_mq_complete_request(rq)
-004|mmc_cqe_timed_out(inline)
-004|mmc_mq_timed_out

mmc_mq_timed_out acquires the queue_lock for the first time. The mmc_blk_cqe_complete_rq function also tries to acquire the same queue lock resulting in recursive locking where the task is spinning for the same lock which it has already acquired leading to watchdog bark.

Quoted 6 lines

Fix this issue with the lock only for the required critical section.

Fixes 1e8e55b67030 ("mmc: block: Add CQE support")

Applied for fixes, thanks!

Kind regards
Uffe

Quoted 41 lines
---
 drivers/mmc/core/queue.c | 13 ++++---------
 1 file changed, 4 insertions(+), 9 deletions(-)
drivers/mmc/core/queue.c +4 -10
index 25bee3d..b5fd3bc 100644
@@ -107,7 +107,7 @@ static enum blk_eh_timer_return mmc_cqe_timed_out(struct request *req)
        case MMC_ISSUE_DCMD:
                if (host->cqe_ops->cqe_timeout(host, mrq, &recovery_needed)) {
                        if (recovery_needed)
-                               __mmc_cqe_recovery_notifier(mq);
+                               mmc_cqe_recovery_notifier(mrq);
                        return BLK_EH_RESET_TIMER;
                }
                /* No timeout (XXX: huh? comment doesn't make much sense) */
@@ -127,18 +127,13 @@ static enum blk_eh_timer_return mmc_mq_timed_out(struct request *req,
        struct mmc_card *card = mq->card;
        struct mmc_host *host = card->host;
        unsigned long flags;
-       int ret;
+       bool ignore_tout;
 
        spin_lock_irqsave(&mq->lock, flags);
-
-       if (mq->recovery_needed || !mq->use_cqe || host->hsq_enabled)
-               ret = BLK_EH_RESET_TIMER;
-       else
-               ret = mmc_cqe_timed_out(req);
-
+       ignore_tout = mq->recovery_needed || !mq->use_cqe || host->hsq_enabled;
        spin_unlock_irqrestore(&mq->lock, flags);
 
-       return ret;
+       return ignore_tout ? BLK_EH_RESET_TIMER : mmc_cqe_timed_out(req);
 }
 
 static void mmc_mq_recovery_handler(struct work_struct *work)
--

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

maintainer
#13 lore raw

Re: [PATCH V2] mmc: core: Fix recursive locking issue in CQE recovery path

In reply to Veerabhadrarao Badiganti

Hi

[This is an automated email]

This commit has been processed because it contains a "Fixes:" tag fixing commit: 1e8e55b67030 ("mmc: block: Add CQE support").

The bot has tested the following trees: v5.6.11, v5.4.39, v4.19.121.

v5.6.11: Failed to apply! Possible dependencies:
511ce378e16f ("mmc: Add MMC host software queue support")

v5.4.39: Failed to apply! Possible dependencies:
511ce378e16f ("mmc: Add MMC host software queue support")

v4.19.121: Failed to apply! Possible dependencies:
310df020cdd7 ("mmc: stop abusing the request queue_lock pointer") 511ce378e16f ("mmc: Add MMC host software queue support") b061b326287d ("mmc: simplify queue initialization") f5d72c5c55bc ("mmc: stop abusing the request queue_lock pointer")

NOTE: The patch will not be queued to stable trees until it is upstream.

How should we proceed with this patch?

Signature · 2 lines
Thanks
Sasha
maintainer
#14 lore raw

Re: [PATCH V1 2/2] mmc: core: Fix recursive locking issue in CQE recovery path

In reply to Veerabhadrarao Badiganti

Hi

[This is an automated email]

This commit has been processed because it contains a -stable tag. The stable tag indicates that it's relevant for the following trees: 4.19+

The bot has tested the following trees: v5.6.11, v5.4.39, v4.19.121.

v5.6.11: Failed to apply! Possible dependencies:
511ce378e16f ("mmc: Add MMC host software queue support")

v5.4.39: Failed to apply! Possible dependencies:
511ce378e16f ("mmc: Add MMC host software queue support")

v4.19.121: Failed to apply! Possible dependencies:
310df020cdd7 ("mmc: stop abusing the request queue_lock pointer") 511ce378e16f ("mmc: Add MMC host software queue support") b061b326287d ("mmc: simplify queue initialization") f5d72c5c55bc ("mmc: stop abusing the request queue_lock pointer")

NOTE: The patch will not be queued to stable trees until it is upstream.

How should we proceed with this patch?

Signature · 2 lines
Thanks
Sasha