]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
5.10-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 3 Dec 2023 13:32:07 +0000 (14:32 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 3 Dec 2023 13:32:07 +0000 (14:32 +0100)
added patches:
dm-verity-don-t-perform-fec-for-failed-readahead-io.patch

queue-5.10/dm-verity-don-t-perform-fec-for-failed-readahead-io.patch [new file with mode: 0644]
queue-5.10/mmc-sdhci-sprd-fix-vqmmc-not-shutting-down-after-the-card-was-pulled.patch [deleted file]
queue-5.10/series

diff --git a/queue-5.10/dm-verity-don-t-perform-fec-for-failed-readahead-io.patch b/queue-5.10/dm-verity-don-t-perform-fec-for-failed-readahead-io.patch
new file mode 100644 (file)
index 0000000..0b9f931
--- /dev/null
@@ -0,0 +1,83 @@
+From 0193e3966ceeeef69e235975918b287ab093082b Mon Sep 17 00:00:00 2001
+From: Wu Bo <bo.wu@vivo.com>
+Date: Tue, 21 Nov 2023 20:51:50 -0700
+Subject: dm verity: don't perform FEC for failed readahead IO
+
+From: Wu Bo <bo.wu@vivo.com>
+
+commit 0193e3966ceeeef69e235975918b287ab093082b upstream.
+
+We found an issue under Android OTA scenario that many BIOs have to do
+FEC where the data under dm-verity is 100% complete and no corruption.
+
+Android OTA has many dm-block layers, from upper to lower:
+dm-verity
+dm-snapshot
+dm-origin & dm-cow
+dm-linear
+ufs
+
+DM tables have to change 2 times during Android OTA merging process.
+When doing table change, the dm-snapshot will be suspended for a while.
+During this interval, many readahead IOs are submitted to dm_verity
+from filesystem. Then the kverity works are busy doing FEC process
+which cost too much time to finish dm-verity IO. This causes needless
+delay which feels like system is hung.
+
+After adding debugging it was found that each readahead IO needed
+around 10s to finish when this situation occurred. This is due to IO
+amplification:
+
+dm-snapshot suspend
+erofs_readahead     // 300+ io is submitted
+       dm_submit_bio (dm_verity)
+               dm_submit_bio (dm_snapshot)
+               bio return EIO
+               bio got nothing, it's empty
+       verity_end_io
+       verity_verify_io
+       forloop range(0, io->n_blocks)    // each io->nblocks ~= 20
+               verity_fec_decode
+               fec_decode_rsb
+               fec_read_bufs
+               forloop range(0, v->fec->rsn) // v->fec->rsn = 253
+                       new_read
+                       submit_bio (dm_snapshot)
+               end loop
+       end loop
+dm-snapshot resume
+
+Readahead BIOs get nothing while dm-snapshot is suspended, so all of
+them will cause verity's FEC.
+Each readahead BIO needs to verify ~20 (io->nblocks) blocks.
+Each block needs to do FEC, and every block needs to do 253
+(v->fec->rsn) reads.
+So during the suspend interval(~200ms), 300 readahead BIOs trigger
+~1518000 (300*20*253) IOs to dm-snapshot.
+
+As readahead IO is not required by userspace, and to fix this issue,
+it is best to pass readahead errors to upper layer to handle it.
+
+Cc: stable@vger.kernel.org
+Fixes: a739ff3f543a ("dm verity: add support for forward error correction")
+Signed-off-by: Wu Bo <bo.wu@vivo.com>
+Reviewed-by: Mikulas Patocka <mpatocka@redhat.com>
+Signed-off-by: Mike Snitzer <snitzer@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/md/dm-verity-target.c |    4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+--- a/drivers/md/dm-verity-target.c
++++ b/drivers/md/dm-verity-target.c
+@@ -583,7 +583,9 @@ static void verity_end_io(struct bio *bi
+       struct dm_verity_io *io = bio->bi_private;
+       if (bio->bi_status &&
+-          (!verity_fec_is_enabled(io->v) || verity_is_system_shutting_down())) {
++          (!verity_fec_is_enabled(io->v) ||
++           verity_is_system_shutting_down() ||
++           (bio->bi_opf & REQ_RAHEAD))) {
+               verity_finish_io(io, bio->bi_status);
+               return;
+       }
diff --git a/queue-5.10/mmc-sdhci-sprd-fix-vqmmc-not-shutting-down-after-the-card-was-pulled.patch b/queue-5.10/mmc-sdhci-sprd-fix-vqmmc-not-shutting-down-after-the-card-was-pulled.patch
deleted file mode 100644 (file)
index 3bf8540..0000000
+++ /dev/null
@@ -1,88 +0,0 @@
-From 477865af60b2117ceaa1d558e03559108c15c78c Mon Sep 17 00:00:00 2001
-From: Wenchao Chen <wenchao.chen@unisoc.com>
-Date: Wed, 15 Nov 2023 16:34:06 +0800
-Subject: mmc: sdhci-sprd: Fix vqmmc not shutting down after the card was pulled
-
-From: Wenchao Chen <wenchao.chen@unisoc.com>
-
-commit 477865af60b2117ceaa1d558e03559108c15c78c upstream.
-
-With cat regulator_summary, we found that vqmmc was not shutting
-down after the card was pulled.
-
-cat /sys/kernel/debug/regulator/regulator_summary
-1.before fix
-1)Insert SD card
- vddsdio               1    1  0 unknown  3500mV 0mA  1200mV  3750mV
-    71100000.mmc-vqmmc  1                         0mA  3500mV  3600mV
-
-2)Pull out the SD card
- vddsdio                1    1  0 unknown  3500mV 0mA  1200mV  3750mV
-    71100000.mmc-vqmmc  1                         0mA  3500mV  3600mV
-
-2.after fix
-1)Insert SD cardt
- vddsdio                1    1  0 unknown  3500mV 0mA  1200mV  3750mV
-    71100000.mmc-vqmmc  1                         0mA  3500mV  3600mV
-
-2)Pull out the SD card
- vddsdio               0    1  0 unknown  3500mV 0mA  1200mV  3750mV
-    71100000.mmc-vqmmc  0                         0mA  3500mV  3600mV
-
-Fixes: fb8bd90f83c4 ("mmc: sdhci-sprd: Add Spreadtrum's initial host controller")
-Signed-off-by: Wenchao Chen <wenchao.chen@unisoc.com>
-Cc: stable@vger.kernel.org
-Link: https://lore.kernel.org/r/20231115083406.7368-1-wenchao.chen@unisoc.com
-Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
-Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
----
- drivers/mmc/host/sdhci-sprd.c |   25 +++++++++++++++++++++++++
- 1 file changed, 25 insertions(+)
-
---- a/drivers/mmc/host/sdhci-sprd.c
-+++ b/drivers/mmc/host/sdhci-sprd.c
-@@ -392,12 +392,33 @@ static void sdhci_sprd_request_done(stru
-       mmc_request_done(host->mmc, mrq);
- }
-+static void sdhci_sprd_set_power(struct sdhci_host *host, unsigned char mode,
-+                               unsigned short vdd)
-+{
-+      struct mmc_host *mmc = host->mmc;
-+
-+      switch (mode) {
-+      case MMC_POWER_OFF:
-+              mmc_regulator_set_ocr(host->mmc, mmc->supply.vmmc, 0);
-+
-+              mmc_regulator_disable_vqmmc(mmc);
-+              break;
-+      case MMC_POWER_ON:
-+              mmc_regulator_enable_vqmmc(mmc);
-+              break;
-+      case MMC_POWER_UP:
-+              mmc_regulator_set_ocr(host->mmc, mmc->supply.vmmc, vdd);
-+              break;
-+      }
-+}
-+
- static struct sdhci_ops sdhci_sprd_ops = {
-       .read_l = sdhci_sprd_readl,
-       .write_l = sdhci_sprd_writel,
-       .write_w = sdhci_sprd_writew,
-       .write_b = sdhci_sprd_writeb,
-       .set_clock = sdhci_sprd_set_clock,
-+      .set_power = sdhci_sprd_set_power,
-       .get_max_clock = sdhci_sprd_get_max_clock,
-       .get_min_clock = sdhci_sprd_get_min_clock,
-       .set_bus_width = sdhci_set_bus_width,
-@@ -663,6 +684,10 @@ static int sdhci_sprd_probe(struct platf
-       host->caps1 &= ~(SDHCI_SUPPORT_SDR50 | SDHCI_SUPPORT_SDR104 |
-                        SDHCI_SUPPORT_DDR50);
-+      ret = mmc_regulator_get_supply(host->mmc);
-+      if (ret)
-+              goto pm_runtime_disable;
-+
-       ret = sdhci_setup_host(host);
-       if (ret)
-               goto pm_runtime_disable;
index 1509f73573ad2eaeaf7f036d399c80b4e0f89717..3f388e27b68e5c4408c98a5fdd0298b4f86bc023 100644 (file)
@@ -70,9 +70,9 @@ io_uring-fix-off-by-one-bvec-index.patch
 perf-inject-fix-gen_elf_text_offset-for-jit.patch
 pinctrl-avoid-reload-of-p-state-in-list-iteration.patch
 firewire-core-fix-possible-memory-leak-in-create_units.patch
-mmc-sdhci-sprd-fix-vqmmc-not-shutting-down-after-the-card-was-pulled.patch
 mmc-block-do-not-lose-cache-flush-during-cqe-error-recovery.patch
 alsa-hda-disable-power-save-on-kontron-singlepc.patch
 alsa-hda-realtek-headset-mic-vref-to-100.patch
 alsa-hda-realtek-add-supported-alc257-for-chromeos.patch
 dm-verity-align-struct-dm_verity_fec_io-properly.patch
+dm-verity-don-t-perform-fec-for-failed-readahead-io.patch