Skip to contentSkip to conversation

mmc: core: Fix WRITE_ZEROES CQE handling

PATCH In review Vincent Whitchurch 3 participants 3 messages Oct 20, 2022 – Oct 24, 2022 MMC, SD and SDIO

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mmc: core: Fix WRITE_ZEROES CQE handling

WRITE_ZEROES requests use TRIM, so mark them as needing to be issued synchronously even when a CQE is being used. Without this, mmc_blk_mq_issue_rq() triggers a WARN_ON_ONCE() and fails the request since we don't have any handling for issuing this asynchronously.

Fixes f7b6fc327327 ("mmc: core: Support zeroout using TRIM for eMMC")
---
 drivers/mmc/core/queue.c | 1 +
 1 file changed, 1 insertion(+)
drivers/mmc/core/queue.c +1 -0
index fefaa901b50f..3661ba0bbc87 100644
@@ -48,6 +48,7 @@ static enum mmc_issue_type mmc_cqe_issue_type(struct mmc_host *host,
 	case REQ_OP_DRV_OUT:
 	case REQ_OP_DISCARD:
 	case REQ_OP_SECURE_ERASE:
+	case REQ_OP_WRITE_ZEROES:
 		return MMC_ISSUE_SYNC;
 	case REQ_OP_FLUSH:
 		return mmc_cqe_can_dcmd(host) ? MMC_ISSUE_DCMD : MMC_ISSUE_SYNC;
Signature · 1 line
2.28.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 9 lines

WRITE_ZEROES requests use TRIM, so mark them as needing to be issued synchronously even when a CQE is being used. Without this, mmc_blk_mq_issue_rq() triggers a WARN_ON_ONCE() and fails the request since we don't have any handling for issuing this asynchronously.

Fixes f7b6fc327327 ("mmc: core: Support zeroout using TRIM for eMMC")
Quoted 20 lines
---
 drivers/mmc/core/queue.c | 1 +
 1 file changed, 1 insertion(+)
drivers/mmc/core/queue.c index renamed from drivers/mmc/core/queue.c +0 -0

fefaa901b50f..3661ba0bbc87 100644

drivers/mmc/core/queue.c +1 -0
@@ -48,6 +48,7 @@ static enum mmc_issue_type
 mmc_cqe_issue_type(struct mmc_host *host,
        case REQ_OP_DRV_OUT:
        case REQ_OP_DISCARD:
        case REQ_OP_SECURE_ERASE:
+       case REQ_OP_WRITE_ZEROES:
                return MMC_ISSUE_SYNC;
        case REQ_OP_FLUSH:

return mmc_cqe_can_dcmd(host) ? MMC_ISSUE_DCMD :
MMC_ISSUE_SYNC;
--
2.28.0

#2 lore raw
In reply to Vincent Whitchurch
Quoted 10 lines · Vincent Whitchurch

WRITE_ZEROES requests use TRIM, so mark them as needing to be issued synchronously even when a CQE is being used. Without this, mmc_blk_mq_issue_rq() triggers a WARN_ON_ONCE() and fails the request since we don't have any handling for issuing this asynchronously.

Fixes f7b6fc327327 ("mmc: core: Support zeroout using TRIM for eMMC")

Applied for fixes and by adding a stable tag, thanks!

Kind regards
Uffe

Quoted 19 lines
---
 drivers/mmc/core/queue.c | 1 +
 1 file changed, 1 insertion(+)
drivers/mmc/core/queue.c +1 -1
index fefaa901b50f..3661ba0bbc87 100644
@@ -48,6 +48,7 @@ static enum mmc_issue_type mmc_cqe_issue_type(struct mmc_host *host,
        case REQ_OP_DRV_OUT:
        case REQ_OP_DISCARD:
        case REQ_OP_SECURE_ERASE:
+       case REQ_OP_WRITE_ZEROES:
                return MMC_ISSUE_SYNC;
        case REQ_OP_FLUSH:
                return mmc_cqe_can_dcmd(host) ? MMC_ISSUE_DCMD : MMC_ISSUE_SYNC;
--

2.28.0