diff options
author | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2025-05-07 11:14:56 +0200 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2025-05-07 11:14:56 +0200 |
commit | e2a04eb716abdbcbf6ac216a11c8e09cb996bb70 (patch) | |
tree | 5dd73d1bda734e9d65b5373d3cab65cc146337b8 | |
parent | e1baefab22187c1f31e940f03645b710d7040352 (diff) | |
download | stable-queue-e2a04eb716abdbcbf6ac216a11c8e09cb996bb70.tar.gz |
6.1-stable patches
added patches:
md-move-initialization-and-destruction-of-io_acct_set-to-md.c.patch
pci-imx6-skip-controller_id-generation-logic-for-i.mx7d.patch
3 files changed, 307 insertions, 0 deletions
diff --git a/queue-6.1/md-move-initialization-and-destruction-of-io_acct_set-to-md.c.patch b/queue-6.1/md-move-initialization-and-destruction-of-io_acct_set-to-md.c.patch new file mode 100644 index 00000000000..611d5a26532 --- /dev/null +++ b/queue-6.1/md-move-initialization-and-destruction-of-io_acct_set-to-md.c.patch @@ -0,0 +1,257 @@ +From c567c86b90d4715081adfe5eb812141a5b6b4883 Mon Sep 17 00:00:00 2001 +From: Yu Kuai <yukuai3@huawei.com> +Date: Thu, 22 Jun 2023 00:51:03 +0800 +Subject: md: move initialization and destruction of 'io_acct_set' to md.c + +From: Yu Kuai <yukuai3@huawei.com> + +commit c567c86b90d4715081adfe5eb812141a5b6b4883 upstream. + +'io_acct_set' is only used for raid0 and raid456, prepare to use it for +raid1 and raid10, so that io accounting from different levels can be +consistent. + +By the way, follow up patches will also use this io clone mechanism to +make sure 'active_io' represents in flight io, not io that is dispatching, +so that mddev_suspend will wait for io to be done as designed. + +Signed-off-by: Yu Kuai <yukuai3@huawei.com> +Reviewed-by: Xiao Ni <xni@redhat.com> +Signed-off-by: Song Liu <song@kernel.org> +Link: https://lore.kernel.org/r/20230621165110.1498313-2-yukuai1@huaweicloud.com +Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> +--- + drivers/md/md.c | 27 ++++++++++----------------- + drivers/md/md.h | 2 -- + drivers/md/raid0.c | 16 ++-------------- + drivers/md/raid5.c | 41 +++++++++++------------------------------ + 4 files changed, 23 insertions(+), 63 deletions(-) + +--- a/drivers/md/md.c ++++ b/drivers/md/md.c +@@ -5965,6 +5965,13 @@ int md_run(struct mddev *mddev) + goto exit_bio_set; + } + ++ if (!bioset_initialized(&mddev->io_acct_set)) { ++ err = bioset_init(&mddev->io_acct_set, BIO_POOL_SIZE, ++ offsetof(struct md_io_acct, bio_clone), 0); ++ if (err) ++ goto exit_sync_set; ++ } ++ + spin_lock(&pers_lock); + pers = find_pers(mddev->level, mddev->clevel); + if (!pers || !try_module_get(pers->owner)) { +@@ -6142,6 +6149,8 @@ bitmap_abort: + module_put(pers->owner); + md_bitmap_destroy(mddev); + abort: ++ bioset_exit(&mddev->io_acct_set); ++exit_sync_set: + bioset_exit(&mddev->sync_set); + exit_bio_set: + bioset_exit(&mddev->bio_set); +@@ -6374,6 +6383,7 @@ static void __md_stop(struct mddev *mdde + percpu_ref_exit(&mddev->active_io); + bioset_exit(&mddev->bio_set); + bioset_exit(&mddev->sync_set); ++ bioset_exit(&mddev->io_acct_set); + } + + void md_stop(struct mddev *mddev) +@@ -8744,23 +8754,6 @@ void md_submit_discard_bio(struct mddev + } + EXPORT_SYMBOL_GPL(md_submit_discard_bio); + +-int acct_bioset_init(struct mddev *mddev) +-{ +- int err = 0; +- +- if (!bioset_initialized(&mddev->io_acct_set)) +- err = bioset_init(&mddev->io_acct_set, BIO_POOL_SIZE, +- offsetof(struct md_io_acct, bio_clone), 0); +- return err; +-} +-EXPORT_SYMBOL_GPL(acct_bioset_init); +- +-void acct_bioset_exit(struct mddev *mddev) +-{ +- bioset_exit(&mddev->io_acct_set); +-} +-EXPORT_SYMBOL_GPL(acct_bioset_exit); +- + static void md_end_io_acct(struct bio *bio) + { + struct md_io_acct *md_io_acct = bio->bi_private; +--- a/drivers/md/md.h ++++ b/drivers/md/md.h +@@ -746,8 +746,6 @@ extern void md_error(struct mddev *mddev + extern void md_finish_reshape(struct mddev *mddev); + void md_submit_discard_bio(struct mddev *mddev, struct md_rdev *rdev, + struct bio *bio, sector_t start, sector_t size); +-int acct_bioset_init(struct mddev *mddev); +-void acct_bioset_exit(struct mddev *mddev); + void md_account_bio(struct mddev *mddev, struct bio **bio); + + extern bool __must_check md_flush_request(struct mddev *mddev, struct bio *bio); +--- a/drivers/md/raid0.c ++++ b/drivers/md/raid0.c +@@ -377,7 +377,6 @@ static void raid0_free(struct mddev *mdd + struct r0conf *conf = priv; + + free_conf(mddev, conf); +- acct_bioset_exit(mddev); + } + + static int raid0_run(struct mddev *mddev) +@@ -392,16 +391,11 @@ static int raid0_run(struct mddev *mddev + if (md_check_no_bitmap(mddev)) + return -EINVAL; + +- if (acct_bioset_init(mddev)) { +- pr_err("md/raid0:%s: alloc acct bioset failed.\n", mdname(mddev)); +- return -ENOMEM; +- } +- + /* if private is not null, we are here after takeover */ + if (mddev->private == NULL) { + ret = create_strip_zones(mddev, &conf); + if (ret < 0) +- goto exit_acct_set; ++ return ret; + mddev->private = conf; + } + conf = mddev->private; +@@ -432,15 +426,9 @@ static int raid0_run(struct mddev *mddev + + ret = md_integrity_register(mddev); + if (ret) +- goto free; ++ free_conf(mddev, conf); + + return ret; +- +-free: +- free_conf(mddev, conf); +-exit_acct_set: +- acct_bioset_exit(mddev); +- return ret; + } + + /* +--- a/drivers/md/raid5.c ++++ b/drivers/md/raid5.c +@@ -7770,19 +7770,12 @@ static int raid5_run(struct mddev *mddev + struct md_rdev *rdev; + struct md_rdev *journal_dev = NULL; + sector_t reshape_offset = 0; +- int i, ret = 0; ++ int i; + long long min_offset_diff = 0; + int first = 1; + +- if (acct_bioset_init(mddev)) { +- pr_err("md/raid456:%s: alloc acct bioset failed.\n", mdname(mddev)); ++ if (mddev_init_writes_pending(mddev) < 0) + return -ENOMEM; +- } +- +- if (mddev_init_writes_pending(mddev) < 0) { +- ret = -ENOMEM; +- goto exit_acct_set; +- } + + if (mddev->recovery_cp != MaxSector) + pr_notice("md/raid:%s: not clean -- starting background reconstruction\n", +@@ -7813,8 +7806,7 @@ static int raid5_run(struct mddev *mddev + (mddev->bitmap_info.offset || mddev->bitmap_info.file)) { + pr_notice("md/raid:%s: array cannot have both journal and bitmap\n", + mdname(mddev)); +- ret = -EINVAL; +- goto exit_acct_set; ++ return -EINVAL; + } + + if (mddev->reshape_position != MaxSector) { +@@ -7839,15 +7831,13 @@ static int raid5_run(struct mddev *mddev + if (journal_dev) { + pr_warn("md/raid:%s: don't support reshape with journal - aborting.\n", + mdname(mddev)); +- ret = -EINVAL; +- goto exit_acct_set; ++ return -EINVAL; + } + + if (mddev->new_level != mddev->level) { + pr_warn("md/raid:%s: unsupported reshape required - aborting.\n", + mdname(mddev)); +- ret = -EINVAL; +- goto exit_acct_set; ++ return -EINVAL; + } + old_disks = mddev->raid_disks - mddev->delta_disks; + /* reshape_position must be on a new-stripe boundary, and one +@@ -7863,8 +7853,7 @@ static int raid5_run(struct mddev *mddev + if (sector_div(here_new, chunk_sectors * new_data_disks)) { + pr_warn("md/raid:%s: reshape_position not on a stripe boundary\n", + mdname(mddev)); +- ret = -EINVAL; +- goto exit_acct_set; ++ return -EINVAL; + } + reshape_offset = here_new * chunk_sectors; + /* here_new is the stripe we will write to */ +@@ -7886,8 +7875,7 @@ static int raid5_run(struct mddev *mddev + else if (mddev->ro == 0) { + pr_warn("md/raid:%s: in-place reshape must be started in read-only mode - aborting\n", + mdname(mddev)); +- ret = -EINVAL; +- goto exit_acct_set; ++ return -EINVAL; + } + } else if (mddev->reshape_backwards + ? (here_new * chunk_sectors + min_offset_diff <= +@@ -7897,8 +7885,7 @@ static int raid5_run(struct mddev *mddev + /* Reading from the same stripe as writing to - bad */ + pr_warn("md/raid:%s: reshape_position too early for auto-recovery - aborting.\n", + mdname(mddev)); +- ret = -EINVAL; +- goto exit_acct_set; ++ return -EINVAL; + } + pr_debug("md/raid:%s: reshape will continue\n", mdname(mddev)); + /* OK, we should be able to continue; */ +@@ -7922,10 +7909,8 @@ static int raid5_run(struct mddev *mddev + else + conf = mddev->private; + +- if (IS_ERR(conf)) { +- ret = PTR_ERR(conf); +- goto exit_acct_set; +- } ++ if (IS_ERR(conf)) ++ return PTR_ERR(conf); + + if (test_bit(MD_HAS_JOURNAL, &mddev->flags)) { + if (!journal_dev) { +@@ -8125,10 +8110,7 @@ abort: + free_conf(conf); + mddev->private = NULL; + pr_warn("md/raid:%s: failed to run raid set.\n", mdname(mddev)); +- ret = -EIO; +-exit_acct_set: +- acct_bioset_exit(mddev); +- return ret; ++ return -EIO; + } + + static void raid5_free(struct mddev *mddev, void *priv) +@@ -8136,7 +8118,6 @@ static void raid5_free(struct mddev *mdd + struct r5conf *conf = priv; + + free_conf(conf); +- acct_bioset_exit(mddev); + mddev->to_remove = &raid5_attrs_group; + } + diff --git a/queue-6.1/pci-imx6-skip-controller_id-generation-logic-for-i.mx7d.patch b/queue-6.1/pci-imx6-skip-controller_id-generation-logic-for-i.mx7d.patch new file mode 100644 index 00000000000..b88a4efc621 --- /dev/null +++ b/queue-6.1/pci-imx6-skip-controller_id-generation-logic-for-i.mx7d.patch @@ -0,0 +1,48 @@ +From f068ffdd034c93f0c768acdc87d4d2d7023c1379 Mon Sep 17 00:00:00 2001 +From: Richard Zhu <hongxing.zhu@nxp.com> +Date: Tue, 26 Nov 2024 15:56:56 +0800 +Subject: PCI: imx6: Skip controller_id generation logic for i.MX7D +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Richard Zhu <hongxing.zhu@nxp.com> + +commit f068ffdd034c93f0c768acdc87d4d2d7023c1379 upstream. + +The i.MX7D only has one PCIe controller, so controller_id should always be +0. The previous code is incorrect although yielding the correct result. + +Fix by removing "IMX7D" from the switch case branch. + +Fixes: 2d8ed461dbc9 ("PCI: imx6: Add support for i.MX8MQ") +Link: https://lore.kernel.org/r/20241126075702.4099164-5-hongxing.zhu@nxp.com +Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com> +Signed-off-by: Krzysztof WilczyĆski <kwilczynski@kernel.org> +Signed-off-by: Bjorn Helgaas <bhelgaas@google.com> +Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org> +Reviewed-by: Frank Li <Frank.Li@nxp.com> +[Because this switch case does more than just controller_id + logic, move the "IMX7D" case label instead of removing it entirely.] +Signed-off-by: Ryan Matthews <ryanmatthews@fastmail.com> +Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> +--- + drivers/pci/controller/dwc/pci-imx6.c | 5 ++--- + 1 file changed, 2 insertions(+), 3 deletions(-) + +--- a/drivers/pci/controller/dwc/pci-imx6.c ++++ b/drivers/pci/controller/dwc/pci-imx6.c +@@ -1172,11 +1172,10 @@ static int imx6_pcie_probe(struct platfo + if (IS_ERR(imx6_pcie->pcie_aux)) + return dev_err_probe(dev, PTR_ERR(imx6_pcie->pcie_aux), + "pcie_aux clock source missing or invalid\n"); +- fallthrough; +- case IMX7D: + if (dbi_base->start == IMX8MQ_PCIE2_BASE_ADDR) + imx6_pcie->controller_id = 1; +- ++ fallthrough; ++ case IMX7D: + imx6_pcie->pciephy_reset = devm_reset_control_get_exclusive(dev, + "pciephy"); + if (IS_ERR(imx6_pcie->pciephy_reset)) { diff --git a/queue-6.1/series b/queue-6.1/series index 3f32c8cbbb4..6ff1fa8e182 100644 --- a/queue-6.1/series +++ b/queue-6.1/series @@ -69,3 +69,5 @@ net-vertexcom-mse102x-fix-possible-stuck-of-spi-inte.patch net-vertexcom-mse102x-fix-len_mask.patch net-vertexcom-mse102x-add-range-check-for-cmd_rts.patch net-vertexcom-mse102x-fix-rx-error-handling.patch +md-move-initialization-and-destruction-of-io_acct_set-to-md.c.patch +pci-imx6-skip-controller_id-generation-logic-for-i.mx7d.patch |