de9378f79ad78d9e98615e6b09867c57b7927f7d
[openwrt/staging/svanheule.git] /
1 From 46b28bf91d411852abb18119c27d73da6064826d Mon Sep 17 00:00:00 2001
2 From: Jonathan Bell <jonathan@raspberrypi.com>
3 Date: Mon, 16 May 2022 10:28:27 +0100
4 Subject: [PATCH] mmc: block: Don't do single-sector reads during
5 recovery
6
7 See https://github.com/raspberrypi/linux/issues/5019
8
9 If an SD card has degraded performance such that IO operations time out
10 then the MMC block layer will leak SG DMA mappings in the swiotlb during
11 recovery. It retries the same SG and this causes the leak, as it is
12 mapped twice - once in sdhci_pre_req() and again during single-block
13 reads in sdhci_prepare_data().
14
15 Resetting the card (including power-cycling if a regulator for vmmc is
16 present) ought to be enough to recover a stuck state, so for now don't
17 try single-block reads in the recovery path.
18
19 Signed-off-by: Jonathan Bell <jonathan@raspberrypi.com>
20 ---
21 drivers/mmc/core/block.c | 2 +-
22 1 file changed, 1 insertion(+), 1 deletion(-)
23
24 --- a/drivers/mmc/core/block.c
25 +++ b/drivers/mmc/core/block.c
26 @@ -1928,7 +1928,7 @@ static void mmc_blk_mq_rw_recovery(struc
27 return;
28 }
29
30 - if (rq_data_dir(req) == READ && brq->data.blocks >
31 + if (0 && rq_data_dir(req) == READ && brq->data.blocks >
32 queue_physical_block_size(mq->queue) >> 9) {
33 /* Read one (native) sector at a time */
34 mmc_blk_read_single(mq, req);