Skip to contentSkip to conversation

mmc: block: Limit queue size for consecutive requeues

PATCH In review Christian Löhle 2 participants 2 messages Oct 26, 2022 – Nov 18, 2022

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

PATCH 2/3 mmc: block: Limit queue size for consecutive requeues

In case mmcblk relies on requeueing to fulfill block layer requests due to hardware or driver restricting the max_blk_count to 1 also limit the hardware queue size to 1 to get consecutive accesses instead of a round-robin on all queued reads.

See SDHCI_QUIRK_NO_MULTIBLOCK for such a restriction.

---
 drivers/mmc/core/queue.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/mmc/core/queue.c +2 -0
index fefaa901b50f..3a20f3933502 100644
@@ -425,6 +425,8 @@ struct gendisk *mmc_init_queue(struct mmc_queue *mq, struct mmc_card *card)
 	if (host->cqe_enabled && !host->hsq_enabled)
 		mq->tag_set.queue_depth =
 			min_t(int, card->ext_csd.cmdq_depth, host->cqe_qdepth);
+	else if (host->max_blk_count == 1)
+		mq->tag_set.queue_depth = 1;
 	else
 		mq->tag_set.queue_depth = MMC_QUEUE_DEPTH;
 	mq->tag_set.numa_node = NUMA_NO_NODE;
Signature · 5 lines
2.37.3

Hyperstone GmbH | Reichenaustr. 39a  | 78467 Konstanz
Managing Director: Dr. Jan Peter Berns.
Commercial register of local courts: Freiburg HRB381782
#1 lore raw
Quoted 17 lines · Christian Löhle

In case mmcblk relies on requeueing to fulfill block layer requests due to hardware or driver restricting the max_blk_count to 1 also limit the hardware queue size to 1 to get consecutive accesses instead of a round-robin on all queued reads.

See SDHCI_QUIRK_NO_MULTIBLOCK for such a restriction.

---
 drivers/mmc/core/queue.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/mmc/core/queue.c +0 -0
index fefaa901b50f..3a20f3933502 100644

drivers/mmc/core/queue.c struct gendisk *mmc_init_queue(struct mmc_queue *mq, struct mmc_card *card) · line 428

Quoted 4 lines
drivers/mmc/core/queue.c +1 -0
@@ -425,6 +425,8 @@ struct gendisk *mmc_init_queue(struct mmc_queue *mq, struct mmc_card *card)
 	if (host->cqe_enabled && !host->hsq_enabled)
 		mq->tag_set.queue_depth =
 			min_t(int, card->ext_csd.cmdq_depth, host->cqe_qdepth);
+	else if (host->max_blk_count == 1)

I suggest adding a big comment here about why this is needed. Perhaps like the information in your cover letter email.

Quoted 4 lines
drivers/mmc/core/queue.c +1 -0
+		mq->tag_set.queue_depth = 1;
 	else
 		mq->tag_set.queue_depth = MMC_QUEUE_DEPTH;
 	mq->tag_set.numa_node = NUMA_NO_NODE;