mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Fexiven <kernel@picomail.one>
To: Ulf Hansson <ulfh@kernel.org>
Cc: linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org,
	Fexiven <kernel@picomail.one>,
	stable@vger.kernel.org
Subject: [PATCH] mmc: core: clear MQRQ_XFER_SINGLE_BLOCK for new requests
Date: Tue,  3 Nov 2026 20:23:45 +0100	[thread overview]
Message-ID: <20261103192345.647483-1-kernel@picomail.one> (raw)

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;
 	}


             reply	other threads:[~2026-11-03 19:24 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-03 19:23 Fexiven [this message]
2026-11-03 20:07 ` Greg KH
2026-11-04  3:16 ` Shawn Lin
2026-11-04  5:44 ` [PATCH v2] " Jonathan Schmid

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261103192345.647483-1-kernel@picomail.one \
    --to=kernel@picomail.one \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mmc@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=ulfh@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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®