mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] mmc: core: clear MQRQ_XFER_SINGLE_BLOCK for new requests
@ 2026-11-03 19:23 Fexiven
  2026-11-03 20:07 ` Greg KH
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Fexiven @ 2026-11-03 19:23 UTC (permalink / raw)
  To: Ulf Hansson; +Cc: linux-mmc, linux-kernel, Fexiven, stable

mmc_blk_mq_complete_rq() and mmc_blk_cqe_complete_rq() set
MQRQ_XFER_SINGLE_BLOCK in the request PDU when a transfer fails, so the
retry is done one block at a time. Nothing ever clears the flag again.

The PDU belongs to the blk-mq tag and is reused for later requests, while
mmc_mq_queue_rq() only resets ->retries for a new request. Every tag that
has seen a single transfer error therefore keeps issuing single-block
transfers (CMD17/CMD24) for the rest of the uptime.

On an RK3576 board (HS400ES eMMC) with occasional data CRC errors, which
are recovered correctly, sequential direct reads dropped from ~200 MB/s
after boot to 3-10 MB/s within minutes and never recovered. The host
registers showed only CMD17 with a 512 byte block size. With this change
the read throughput stays at ~200 MB/s and writes at 60-90 MB/s while the
data CRC errors continue to be retried.

Reset the flags together with the retry counter when a request is
prepared for the first time. Requeued requests keep RQF_DONTPREP, so the
single-block retry of the failing request itself is unchanged.

Fixes: d34124edffdb ("mmc: block: Use MQRQ_XFER_SINGLE_BLOCK for both read and write recovery")
Cc: stable@vger.kernel.org
Signed-off-by: Fexiven <kernel@picomail.one>
---
 drivers/mmc/core/queue.c | 2 ++
 1 file changed, 2 insertions(+)

--- a/drivers/mmc/core/queue.c
+++ b/drivers/mmc/core/queue.c
@@ -301,6 +301,8 @@

 	if (!(req->rq_flags & RQF_DONTPREP)) {
 		req_to_mmc_queue_req(req)->retries = 0;
+		/* the request PDU is reused: don't inherit single-block recovery */
+		req_to_mmc_queue_req(req)->flags = 0;
 		req->rq_flags |= RQF_DONTPREP;
 	}


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

* Re: [PATCH] mmc: core: clear MQRQ_XFER_SINGLE_BLOCK for new requests
  2026-11-03 19:23 [PATCH] mmc: core: clear MQRQ_XFER_SINGLE_BLOCK for new requests Fexiven
@ 2026-11-03 20:07 ` Greg KH
  2026-11-04  3:16 ` Shawn Lin
  2026-11-04  5:44 ` [PATCH v2] " Jonathan Schmid
  2 siblings, 0 replies; 4+ messages in thread
From: Greg KH @ 2026-11-03 20:07 UTC (permalink / raw)
  To: Fexiven; +Cc: Ulf Hansson, linux-mmc, linux-kernel, stable

On Tue, Nov 03, 2026 at 08:23:45PM +0100, Fexiven wrote:
> mmc_blk_mq_complete_rq() and mmc_blk_cqe_complete_rq() set
> MQRQ_XFER_SINGLE_BLOCK in the request PDU when a transfer fails, so the
> retry is done one block at a time. Nothing ever clears the flag again.
> 
> The PDU belongs to the blk-mq tag and is reused for later requests, while
> mmc_mq_queue_rq() only resets ->retries for a new request. Every tag that
> has seen a single transfer error therefore keeps issuing single-block
> transfers (CMD17/CMD24) for the rest of the uptime.
> 
> On an RK3576 board (HS400ES eMMC) with occasional data CRC errors, which
> are recovered correctly, sequential direct reads dropped from ~200 MB/s
> after boot to 3-10 MB/s within minutes and never recovered. The host
> registers showed only CMD17 with a 512 byte block size. With this change
> the read throughput stays at ~200 MB/s and writes at 60-90 MB/s while the
> data CRC errors continue to be retried.
> 
> Reset the flags together with the retry counter when a request is
> prepared for the first time. Requeued requests keep RQF_DONTPREP, so the
> single-block retry of the failing request itself is unchanged.
> 
> Fixes: d34124edffdb ("mmc: block: Use MQRQ_XFER_SINGLE_BLOCK for both read and write recovery")
> Cc: stable@vger.kernel.org
> Signed-off-by: Fexiven <kernel@picomail.one>

Real name please.

thanks,

greg k-h

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

* Re: [PATCH] mmc: core: clear MQRQ_XFER_SINGLE_BLOCK for new requests
  2026-11-03 19:23 [PATCH] mmc: core: clear MQRQ_XFER_SINGLE_BLOCK for new requests Fexiven
  2026-11-03 20:07 ` Greg KH
@ 2026-11-04  3:16 ` Shawn Lin
  2026-11-04  5:44 ` [PATCH v2] " Jonathan Schmid
  2 siblings, 0 replies; 4+ messages in thread
From: Shawn Lin @ 2026-11-04  3:16 UTC (permalink / raw)
  To: Fexiven, Ulf Hansson; +Cc: shawn.lin, linux-mmc, linux-kernel, stable

Hi Fexiven

在 2026/11/04 星期三 3:23, Fexiven 写道:
> mmc_blk_mq_complete_rq() and mmc_blk_cqe_complete_rq() set
> MQRQ_XFER_SINGLE_BLOCK in the request PDU when a transfer fails, so the
> retry is done one block at a time. Nothing ever clears the flag again.
> 
> The PDU belongs to the blk-mq tag and is reused for later requests, while
> mmc_mq_queue_rq() only resets ->retries for a new request. Every tag that
> has seen a single transfer error therefore keeps issuing single-block
> transfers (CMD17/CMD24) for the rest of the uptime.
> 
> On an RK3576 board (HS400ES eMMC) with occasional data CRC errors, which
> are recovered correctly, sequential direct reads dropped from ~200 MB/s
> after boot to 3-10 MB/s within minutes and never recovered. The host
> registers showed only CMD17 with a 512 byte block size. With this change
> the read throughput stays at ~200 MB/s and writes at 60-90 MB/s while the
> data CRC errors continue to be retried.
> 
> Reset the flags together with the retry counter when a request is
> prepared for the first time. Requeued requests keep RQF_DONTPREP, so the
> single-block retry of the failing request itself is unchanged.
> 

Sorry for not catching this in the first place. I was preparing a patch
to fix it but forgot to send out immediately :(

Except for your DCO name , the change itself looks good.
With that improved, feel free to add,

Reviewed-by: Shawn Lin <shawn.lin@rock-chips.com>


> Fixes: d34124edffdb ("mmc: block: Use MQRQ_XFER_SINGLE_BLOCK for both read and write recovery")
> Cc: stable@vger.kernel.org
> Signed-off-by: Fexiven <kernel@picomail.one>
> ---
>   drivers/mmc/core/queue.c | 2 ++
>   1 file changed, 2 insertions(+)
> 
> --- a/drivers/mmc/core/queue.c
> +++ b/drivers/mmc/core/queue.c
> @@ -301,6 +301,8 @@
> 
>   	if (!(req->rq_flags & RQF_DONTPREP)) {
>   		req_to_mmc_queue_req(req)->retries = 0;
> +		/* the request PDU is reused: don't inherit single-block recovery */
> +		req_to_mmc_queue_req(req)->flags = 0;
>   		req->rq_flags |= RQF_DONTPREP;
>   	}
> 
> 
> 


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

* [PATCH v2] mmc: core: clear MQRQ_XFER_SINGLE_BLOCK for new requests
  2026-11-03 19:23 [PATCH] mmc: core: clear MQRQ_XFER_SINGLE_BLOCK for new requests Fexiven
  2026-11-03 20:07 ` Greg KH
  2026-11-04  3:16 ` Shawn Lin
@ 2026-11-04  5:44 ` Jonathan Schmid
  2 siblings, 0 replies; 4+ messages in thread
From: Jonathan Schmid @ 2026-11-04  5:44 UTC (permalink / raw)
  To: Ulf Hansson
  Cc: linux-mmc, linux-kernel, Greg Kroah-Hartman, Jonathan Schmid, stable

mmc_blk_mq_complete_rq() and mmc_blk_cqe_complete_rq() set
MQRQ_XFER_SINGLE_BLOCK in the request PDU when a transfer fails, so the
retry is done one block at a time. Nothing ever clears the flag again.

The PDU belongs to the blk-mq tag and is reused for later requests, while
mmc_mq_queue_rq() only resets ->retries for a new request. Every tag that
has seen a single transfer error therefore keeps issuing single-block
transfers (CMD17/CMD24) for the rest of the uptime.

On an RK3576 board (HS400ES eMMC) with occasional data CRC errors, which
are recovered correctly, sequential direct reads dropped from ~200 MB/s
after boot to 3-10 MB/s within minutes and never recovered. The host
registers showed only CMD17 with a 512 byte block size. With this change
the read throughput stays at ~200 MB/s and writes at 60-90 MB/s while the
data CRC errors continue to be retried.

Reset the flags together with the retry counter when a request is
prepared for the first time. Requeued requests keep RQF_DONTPREP, so the
single-block retry of the failing request itself is unchanged.

Fixes: d34124edffdb ("mmc: block: Use MQRQ_XFER_SINGLE_BLOCK for both read and write recovery")
Cc: stable@vger.kernel.org
Signed-off-by: Jonathan Schmid <kernel@picomail.one>
---
v2: use my real name in From and Signed-off-by (Greg)

 drivers/mmc/core/queue.c | 2 ++
 1 file changed, 2 insertions(+)

--- a/drivers/mmc/core/queue.c
+++ b/drivers/mmc/core/queue.c
@@ -301,6 +301,8 @@

 	if (!(req->rq_flags & RQF_DONTPREP)) {
 		req_to_mmc_queue_req(req)->retries = 0;
+		/* the request PDU is reused: don't inherit single-block recovery */
+		req_to_mmc_queue_req(req)->flags = 0;
 		req->rq_flags |= RQF_DONTPREP;
 	}


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

end of thread, other threads:[~2026-11-04  5:45 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-03 19:23 [PATCH] mmc: core: clear MQRQ_XFER_SINGLE_BLOCK for new requests Fexiven
2026-11-03 20:07 ` Greg KH
2026-11-04  3:16 ` Shawn Lin
2026-11-04  5:44 ` [PATCH v2] " Jonathan Schmid

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®