linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH AUTOSEL 5.10 01/11] genirq: PM: Use runtime PM for chained interrupts
@ 2022-06-21 20:50 Sasha Levin
  2022-06-21 20:50 ` [PATCH AUTOSEL 5.10 02/11] irqchip/uniphier-aidet: Add compatible string for NX1 SoC Sasha Levin
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: Sasha Levin @ 2022-06-21 20:50 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Marc Zyngier, Lucas Stach, Liu Ying, Sasha Levin, tglx

From: Marc Zyngier <maz@kernel.org>

[ Upstream commit 668a9fe5c6a1bcac6b65d5e9b91a9eca86f782a3 ]

When requesting an interrupt, we correctly call into the runtime
PM framework to guarantee that the underlying interrupt controller
is up and running.

However, we fail to do so for chained interrupt controllers, as
the mux interrupt is not requested along the same path.

Augment __irq_do_set_handler() to call into the runtime PM code
in this case, making sure the PM flow is the same for all interrupts.

Reported-by: Lucas Stach <l.stach@pengutronix.de>
Tested-by: Liu Ying <victor.liu@nxp.com>
Signed-off-by: Marc Zyngier <maz@kernel.org>
Link: https://lore.kernel.org/r/26973cddee5f527ea17184c0f3fccb70bc8969a0.camel@pengutronix.de
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 kernel/irq/chip.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/kernel/irq/chip.c b/kernel/irq/chip.c
index 0b70811fd956..6400760b7136 100644
--- a/kernel/irq/chip.c
+++ b/kernel/irq/chip.c
@@ -1038,8 +1038,10 @@ __irq_do_set_handler(struct irq_desc *desc, irq_flow_handler_t handle,
 		if (desc->irq_data.chip != &no_irq_chip)
 			mask_ack_irq(desc);
 		irq_state_set_disabled(desc);
-		if (is_chained)
+		if (is_chained) {
 			desc->action = NULL;
+			WARN_ON(irq_chip_pm_put(irq_desc_get_irq_data(desc)));
+		}
 		desc->depth = 1;
 	}
 	desc->handle_irq = handle;
@@ -1065,6 +1067,7 @@ __irq_do_set_handler(struct irq_desc *desc, irq_flow_handler_t handle,
 		irq_settings_set_norequest(desc);
 		irq_settings_set_nothread(desc);
 		desc->action = &chained_action;
+		WARN_ON(irq_chip_pm_get(irq_desc_get_irq_data(desc)));
 		irq_activate_and_startup(desc, IRQ_RESEND);
 	}
 }
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH AUTOSEL 5.10 02/11] irqchip/uniphier-aidet: Add compatible string for NX1 SoC
  2022-06-21 20:50 [PATCH AUTOSEL 5.10 01/11] genirq: PM: Use runtime PM for chained interrupts Sasha Levin
@ 2022-06-21 20:50 ` Sasha Levin
  2022-06-21 20:50 ` [PATCH AUTOSEL 5.10 03/11] mei: me: set internal pg flag to off on hardware reset Sasha Levin
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: Sasha Levin @ 2022-06-21 20:50 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Kunihiko Hayashi, Marc Zyngier, Sasha Levin, tglx, mhiramat,
	linux-arm-kernel

From: Kunihiko Hayashi <hayashi.kunihiko@socionext.com>

[ Upstream commit e3f056a7aafabe4ac3ad4b7465ba821b44a7e639 ]

Add the compatible string to support UniPhier NX1 SoC, which has the same
kinds of controls as the other UniPhier SoCs.

Signed-off-by: Kunihiko Hayashi <hayashi.kunihiko@socionext.com>
Signed-off-by: Marc Zyngier <maz@kernel.org>
Link: https://lore.kernel.org/r/1653023822-19229-3-git-send-email-hayashi.kunihiko@socionext.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/irqchip/irq-uniphier-aidet.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/irqchip/irq-uniphier-aidet.c b/drivers/irqchip/irq-uniphier-aidet.c
index 89121b39be26..716b1bb88bf2 100644
--- a/drivers/irqchip/irq-uniphier-aidet.c
+++ b/drivers/irqchip/irq-uniphier-aidet.c
@@ -237,6 +237,7 @@ static const struct of_device_id uniphier_aidet_match[] = {
 	{ .compatible = "socionext,uniphier-ld11-aidet" },
 	{ .compatible = "socionext,uniphier-ld20-aidet" },
 	{ .compatible = "socionext,uniphier-pxs3-aidet" },
+	{ .compatible = "socionext,uniphier-nx1-aidet" },
 	{ /* sentinel */ }
 };
 
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH AUTOSEL 5.10 03/11] mei: me: set internal pg flag to off on hardware reset
  2022-06-21 20:50 [PATCH AUTOSEL 5.10 01/11] genirq: PM: Use runtime PM for chained interrupts Sasha Levin
  2022-06-21 20:50 ` [PATCH AUTOSEL 5.10 02/11] irqchip/uniphier-aidet: Add compatible string for NX1 SoC Sasha Levin
@ 2022-06-21 20:50 ` Sasha Levin
  2022-06-21 20:50 ` [PATCH AUTOSEL 5.10 04/11] nvme-pci: add trouble shooting steps for timeouts Sasha Levin
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: Sasha Levin @ 2022-06-21 20:50 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Alexander Usyskin, Tomas Winkler, Greg Kroah-Hartman, Sasha Levin

From: Alexander Usyskin <alexander.usyskin@intel.com>

[ Upstream commit 9f4639373e6756e1ccf0029f861f1061db3c3616 ]

Link reset flow is always performed in the runtime resumed state.
The internal PG state may be left as ON after the suspend
and will not be updated upon the resume if the D0i3 is not supported.

Ensure that the internal PG state is set to the right value on the flow
entrance in case the firmware does not support D0i3.

Signed-off-by: Alexander Usyskin <alexander.usyskin@intel.com>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Link: https://lore.kernel.org/r/20220606144225.282375-1-tomas.winkler@intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/misc/mei/hw-me.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/misc/mei/hw-me.c b/drivers/misc/mei/hw-me.c
index cda0829ac589..c6de2132ed2f 100644
--- a/drivers/misc/mei/hw-me.c
+++ b/drivers/misc/mei/hw-me.c
@@ -1154,6 +1154,8 @@ static int mei_me_hw_reset(struct mei_device *dev, bool intr_enable)
 			ret = mei_me_d0i3_exit_sync(dev);
 			if (ret)
 				return ret;
+		} else {
+			hw->pg_state = MEI_PG_OFF;
 		}
 	}
 
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH AUTOSEL 5.10 04/11] nvme-pci: add trouble shooting steps for timeouts
  2022-06-21 20:50 [PATCH AUTOSEL 5.10 01/11] genirq: PM: Use runtime PM for chained interrupts Sasha Levin
  2022-06-21 20:50 ` [PATCH AUTOSEL 5.10 02/11] irqchip/uniphier-aidet: Add compatible string for NX1 SoC Sasha Levin
  2022-06-21 20:50 ` [PATCH AUTOSEL 5.10 03/11] mei: me: set internal pg flag to off on hardware reset Sasha Levin
@ 2022-06-21 20:50 ` Sasha Levin
  2022-06-21 20:50 ` [PATCH AUTOSEL 5.10 05/11] nvme-pci: phison e12 has bogus namespace ids Sasha Levin
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: Sasha Levin @ 2022-06-21 20:50 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Keith Busch, Chaitanya Kulkarni, Christoph Hellwig, Sasha Levin,
	axboe, sagi, linux-nvme

From: Keith Busch <kbusch@kernel.org>

[ Upstream commit 4641a8e6e145f595059e695f0f8dbbe608134086 ]

Many users have encountered IO timeouts with a CSTS value of 0xffffffff,
which indicates a failure to read the register. While there are various
potential causes for this observation, faulty NVMe APST has been the
culprit quite frequently. Add the recommended troubleshooting steps in
the error output when this condition occurs.

Signed-off-by: Keith Busch <kbusch@kernel.org>
Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/nvme/host/pci.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c
index 7de24a10dd92..26f451b70511 100644
--- a/drivers/nvme/host/pci.c
+++ b/drivers/nvme/host/pci.c
@@ -1252,6 +1252,14 @@ static void nvme_warn_reset(struct nvme_dev *dev, u32 csts)
 		dev_warn(dev->ctrl.device,
 			 "controller is down; will reset: CSTS=0x%x, PCI_STATUS read failed (%d)\n",
 			 csts, result);
+
+	if (csts != ~0)
+		return;
+
+	dev_warn(dev->ctrl.device,
+		 "Does your device have a faulty power saving mode enabled?\n");
+	dev_warn(dev->ctrl.device,
+		 "Try \"nvme_core.default_ps_max_latency_us=0 pcie_aspm=off\" and report a bug\n");
 }
 
 static enum blk_eh_timer_return nvme_timeout(struct request *req, bool reserved)
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH AUTOSEL 5.10 05/11] nvme-pci: phison e12 has bogus namespace ids
  2022-06-21 20:50 [PATCH AUTOSEL 5.10 01/11] genirq: PM: Use runtime PM for chained interrupts Sasha Levin
                   ` (2 preceding siblings ...)
  2022-06-21 20:50 ` [PATCH AUTOSEL 5.10 04/11] nvme-pci: add trouble shooting steps for timeouts Sasha Levin
@ 2022-06-21 20:50 ` Sasha Levin
  2022-06-21 20:51 ` [PATCH AUTOSEL 5.10 06/11] nvme-pci: smi " Sasha Levin
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: Sasha Levin @ 2022-06-21 20:50 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Keith Busch, Christoph Hellwig, Sasha Levin, axboe, sagi, linux-nvme

From: Keith Busch <kbusch@kernel.org>

[ Upstream commit 2cf7a77ed5f8903606f4f7833d02d67b08650442 ]

Add the quirk.

Link: https://bugzilla.kernel.org/show_bug.cgi?id=216049
Signed-off-by: Keith Busch <kbusch@kernel.org>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/nvme/host/pci.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c
index 26f451b70511..b806fb3f0f3a 100644
--- a/drivers/nvme/host/pci.c
+++ b/drivers/nvme/host/pci.c
@@ -3242,6 +3242,8 @@ static const struct pci_device_id nvme_id_table[] = {
 		.driver_data = NVME_QUIRK_DELAY_BEFORE_CHK_RDY |
 				NVME_QUIRK_DISABLE_WRITE_ZEROES|
 				NVME_QUIRK_IGNORE_DEV_SUBNQN, },
+	{ PCI_DEVICE(0x1987, 0x5012),	/* Phison E12 */
+		.driver_data = NVME_QUIRK_BOGUS_NID, },
 	{ PCI_DEVICE(0x1987, 0x5016),	/* Phison E16 */
 		.driver_data = NVME_QUIRK_IGNORE_DEV_SUBNQN, },
 	{ PCI_DEVICE(0x1b4b, 0x1092),	/* Lexar 256 GB SSD */
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH AUTOSEL 5.10 06/11] nvme-pci: smi has bogus namespace ids
  2022-06-21 20:50 [PATCH AUTOSEL 5.10 01/11] genirq: PM: Use runtime PM for chained interrupts Sasha Levin
                   ` (3 preceding siblings ...)
  2022-06-21 20:50 ` [PATCH AUTOSEL 5.10 05/11] nvme-pci: phison e12 has bogus namespace ids Sasha Levin
@ 2022-06-21 20:51 ` Sasha Levin
  2022-06-21 20:51 ` [PATCH AUTOSEL 5.10 07/11] nvme-pci: sk hynix p31 " Sasha Levin
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: Sasha Levin @ 2022-06-21 20:51 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Keith Busch, Christoph Hellwig, Sasha Levin, axboe, sagi, linux-nvme

From: Keith Busch <kbusch@kernel.org>

[ Upstream commit c98a879312caf775c9768faed25ce1c013b4df04 ]

Add the quirk.

Link: https://bugzilla.kernel.org/show_bug.cgi?id=216096
Signed-off-by: Keith Busch <kbusch@kernel.org>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/nvme/host/pci.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c
index b806fb3f0f3a..610cf8c2a6a8 100644
--- a/drivers/nvme/host/pci.c
+++ b/drivers/nvme/host/pci.c
@@ -3226,7 +3226,8 @@ static const struct pci_device_id nvme_id_table[] = {
 	{ PCI_VDEVICE(REDHAT, 0x0010),	/* Qemu emulated controller */
 		.driver_data = NVME_QUIRK_BOGUS_NID, },
 	{ PCI_DEVICE(0x126f, 0x2263),	/* Silicon Motion unidentified */
-		.driver_data = NVME_QUIRK_NO_NS_DESC_LIST, },
+		.driver_data = NVME_QUIRK_NO_NS_DESC_LIST |
+				NVME_QUIRK_BOGUS_NID, },
 	{ PCI_DEVICE(0x1bb1, 0x0100),   /* Seagate Nytro Flash Storage */
 		.driver_data = NVME_QUIRK_DELAY_BEFORE_CHK_RDY |
 				NVME_QUIRK_NO_NS_DESC_LIST, },
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH AUTOSEL 5.10 07/11] nvme-pci: sk hynix p31 has bogus namespace ids
  2022-06-21 20:50 [PATCH AUTOSEL 5.10 01/11] genirq: PM: Use runtime PM for chained interrupts Sasha Levin
                   ` (4 preceding siblings ...)
  2022-06-21 20:51 ` [PATCH AUTOSEL 5.10 06/11] nvme-pci: smi " Sasha Levin
@ 2022-06-21 20:51 ` Sasha Levin
  2022-06-21 20:51 ` [PATCH AUTOSEL 5.10 08/11] ext4: improve write performance with disabled delalloc Sasha Levin
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: Sasha Levin @ 2022-06-21 20:51 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Keith Busch, Christoph Hellwig, Sasha Levin, axboe, sagi, linux-nvme

From: Keith Busch <kbusch@kernel.org>

[ Upstream commit c4f01a776b28378f4f61b53f8cb0e358f4fa3721 ]

Add the quirk.

Link: https://bugzilla.kernel.org/show_bug.cgi?id=216049
Signed-off-by: Keith Busch <kbusch@kernel.org>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/nvme/host/pci.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c
index 610cf8c2a6a8..1c9fd718cd8a 100644
--- a/drivers/nvme/host/pci.c
+++ b/drivers/nvme/host/pci.c
@@ -3263,6 +3263,8 @@ static const struct pci_device_id nvme_id_table[] = {
 				NVME_QUIRK_IGNORE_DEV_SUBNQN, },
 	{ PCI_DEVICE(0x1c5c, 0x1504),   /* SK Hynix PC400 */
 		.driver_data = NVME_QUIRK_DISABLE_WRITE_ZEROES, },
+	{ PCI_DEVICE(0x1c5c, 0x174a),   /* SK Hynix P31 SSD */
+		.driver_data = NVME_QUIRK_BOGUS_NID, },
 	{ PCI_DEVICE(0x15b7, 0x2001),   /*  Sandisk Skyhawk */
 		.driver_data = NVME_QUIRK_DISABLE_WRITE_ZEROES, },
 	{ PCI_DEVICE(0x2646, 0x2262),   /* KINGSTON SKC2000 NVMe SSD */
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH AUTOSEL 5.10 08/11] ext4: improve write performance with disabled delalloc
  2022-06-21 20:50 [PATCH AUTOSEL 5.10 01/11] genirq: PM: Use runtime PM for chained interrupts Sasha Levin
                   ` (5 preceding siblings ...)
  2022-06-21 20:51 ` [PATCH AUTOSEL 5.10 07/11] nvme-pci: sk hynix p31 " Sasha Levin
@ 2022-06-21 20:51 ` Sasha Levin
  2022-06-21 20:51 ` [PATCH AUTOSEL 5.10 09/11] blk-mq: protect q->elevator by ->sysfs_lock in blk_mq_elv_switch_none Sasha Levin
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: Sasha Levin @ 2022-06-21 20:51 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Jan Kara, Theodore Ts'o, Sasha Levin, adilger.kernel, linux-ext4

From: Jan Kara <jack@suse.cz>

[ Upstream commit 8d5459c11f548131ce48b2fbf45cccc5c382558f ]

When delayed allocation is disabled (either through mount option or
because we are running low on free space), ext4_write_begin() allocates
blocks with EXT4_GET_BLOCKS_IO_CREATE_EXT flag. With this flag extent
merging is disabled and since ext4_write_begin() is called for each page
separately, we end up with a *lot* of 1 block extents in the extent tree
and following writeback is writing 1 block at a time which results in
very poor write throughput (4 MB/s instead of 200 MB/s). These days when
ext4_get_block_unwritten() is used only by ext4_write_begin(),
ext4_page_mkwrite() and inline data conversion, we can safely allow
extent merging to happen from these paths since following writeback will
happen on different boundaries anyway. So use
EXT4_GET_BLOCKS_CREATE_UNRIT_EXT instead which restores the performance.

Signed-off-by: Jan Kara <jack@suse.cz>
Link: https://lore.kernel.org/r/20220520111402.4252-1-jack@suse.cz
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 fs/ext4/inode.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
index 72e3f55f1e07..6837b0122e2c 100644
--- a/fs/ext4/inode.c
+++ b/fs/ext4/inode.c
@@ -823,7 +823,7 @@ int ext4_get_block_unwritten(struct inode *inode, sector_t iblock,
 	ext4_debug("ext4_get_block_unwritten: inode %lu, create flag %d\n",
 		   inode->i_ino, create);
 	return _ext4_get_block(inode, iblock, bh_result,
-			       EXT4_GET_BLOCKS_IO_CREATE_EXT);
+			       EXT4_GET_BLOCKS_CREATE_UNWRIT_EXT);
 }
 
 /* Maximum number of blocks we map for direct IO at once. */
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH AUTOSEL 5.10 09/11] blk-mq: protect q->elevator by ->sysfs_lock in blk_mq_elv_switch_none
  2022-06-21 20:50 [PATCH AUTOSEL 5.10 01/11] genirq: PM: Use runtime PM for chained interrupts Sasha Levin
                   ` (6 preceding siblings ...)
  2022-06-21 20:51 ` [PATCH AUTOSEL 5.10 08/11] ext4: improve write performance with disabled delalloc Sasha Levin
@ 2022-06-21 20:51 ` Sasha Levin
  2022-06-21 20:51 ` [PATCH AUTOSEL 5.10 10/11] blk-mq: don't clear flush_rq from tags->rqs[] Sasha Levin
  2022-06-21 20:51 ` [PATCH AUTOSEL 5.10 11/11] ext4: correct the judgment of BUG in ext4_mb_normalize_request Sasha Levin
  9 siblings, 0 replies; 11+ messages in thread
From: Sasha Levin @ 2022-06-21 20:51 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Ming Lei, Christoph Hellwig, Jens Axboe, Sasha Levin, linux-block

From: Ming Lei <ming.lei@redhat.com>

[ Upstream commit 5fd7a84a09e640016fe106dd3e992f5210e23dc7 ]

elevator can be tore down by sysfs switch interface or disk release, so
hold ->sysfs_lock before referring to q->elevator, then potential
use-after-free can be avoided.

Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Ming Lei <ming.lei@redhat.com>
Link: https://lore.kernel.org/r/20220616014401.817001-2-ming.lei@redhat.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 block/blk-mq.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/block/blk-mq.c b/block/blk-mq.c
index 15a11a217cd0..d5979cfcf8d8 100644
--- a/block/blk-mq.c
+++ b/block/blk-mq.c
@@ -3641,12 +3641,14 @@ static bool blk_mq_elv_switch_none(struct list_head *head,
 	if (!qe)
 		return false;
 
+	/* q->elevator needs protection from ->sysfs_lock */
+	mutex_lock(&q->sysfs_lock);
+
 	INIT_LIST_HEAD(&qe->node);
 	qe->q = q;
 	qe->type = q->elevator->type;
 	list_add(&qe->node, head);
 
-	mutex_lock(&q->sysfs_lock);
 	/*
 	 * After elevator_switch_mq, the previous elevator_queue will be
 	 * released by elevator_release. The reference of the io scheduler
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH AUTOSEL 5.10 10/11] blk-mq: don't clear flush_rq from tags->rqs[]
  2022-06-21 20:50 [PATCH AUTOSEL 5.10 01/11] genirq: PM: Use runtime PM for chained interrupts Sasha Levin
                   ` (7 preceding siblings ...)
  2022-06-21 20:51 ` [PATCH AUTOSEL 5.10 09/11] blk-mq: protect q->elevator by ->sysfs_lock in blk_mq_elv_switch_none Sasha Levin
@ 2022-06-21 20:51 ` Sasha Levin
  2022-06-21 20:51 ` [PATCH AUTOSEL 5.10 11/11] ext4: correct the judgment of BUG in ext4_mb_normalize_request Sasha Levin
  9 siblings, 0 replies; 11+ messages in thread
From: Sasha Levin @ 2022-06-21 20:51 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Ming Lei, Christoph Hellwig, Yu Kuai, Jens Axboe, Sasha Levin,
	linux-block

From: Ming Lei <ming.lei@redhat.com>

[ Upstream commit 6cfeadbff3f8905f2854735ebb88e581402c16c4 ]

commit 364b61818f65 ("blk-mq: clearing flush request reference in
tags->rqs[]") is added to clear the to-be-free flush request from
tags->rqs[] for avoiding use-after-free on the flush rq.

Yu Kuai reported that blk_mq_clear_flush_rq_mapping() slows down boot time
by ~8s because running scsi probe which may create and remove lots of
unpresent LUNs on megaraid-sas which uses BLK_MQ_F_TAG_HCTX_SHARED and
each request queue has lots of hw queues.

Improve the situation by not running blk_mq_clear_flush_rq_mapping if
disk isn't added when there can't be any flush request issued.

Reviewed-by: Christoph Hellwig <hch@lst.de>
Reported-by: Yu Kuai <yukuai3@huawei.com>
Signed-off-by: Ming Lei <ming.lei@redhat.com>
Link: https://lore.kernel.org/r/20220616014401.817001-4-ming.lei@redhat.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 block/blk-mq.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/block/blk-mq.c b/block/blk-mq.c
index d5979cfcf8d8..00459f727ce5 100644
--- a/block/blk-mq.c
+++ b/block/blk-mq.c
@@ -2645,8 +2645,9 @@ static void blk_mq_exit_hctx(struct request_queue *q,
 	if (blk_mq_hw_queue_mapped(hctx))
 		blk_mq_tag_idle(hctx);
 
-	blk_mq_clear_flush_rq_mapping(set->tags[hctx_idx],
-			set->queue_depth, flush_rq);
+	if (blk_queue_init_done(q))
+		blk_mq_clear_flush_rq_mapping(set->tags[hctx_idx],
+				set->queue_depth, flush_rq);
 	if (set->ops->exit_request)
 		set->ops->exit_request(set, flush_rq, hctx_idx);
 
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH AUTOSEL 5.10 11/11] ext4: correct the judgment of BUG in ext4_mb_normalize_request
  2022-06-21 20:50 [PATCH AUTOSEL 5.10 01/11] genirq: PM: Use runtime PM for chained interrupts Sasha Levin
                   ` (8 preceding siblings ...)
  2022-06-21 20:51 ` [PATCH AUTOSEL 5.10 10/11] blk-mq: don't clear flush_rq from tags->rqs[] Sasha Levin
@ 2022-06-21 20:51 ` Sasha Levin
  9 siblings, 0 replies; 11+ messages in thread
From: Sasha Levin @ 2022-06-21 20:51 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Baokun Li, Ritesh Harjani, Theodore Ts'o, Sasha Levin,
	adilger.kernel, linux-ext4

From: Baokun Li <libaokun1@huawei.com>

[ Upstream commit cf4ff938b47fc5c00b0ccce53a3b50eca9b32281 ]

ext4_mb_normalize_request() can move logical start of allocated blocks
to reduce fragmentation and better utilize preallocation. However logical
block requested as a start of allocation (ac->ac_o_ex.fe_logical) should
always be covered by allocated blocks so we should check that by
modifying and to or in the assertion.

Signed-off-by: Baokun Li <libaokun1@huawei.com>
Reviewed-by: Ritesh Harjani <ritesh.list@gmail.com>
Link: https://lore.kernel.org/r/20220528110017.354175-3-libaokun1@huawei.com
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 fs/ext4/mballoc.c | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c
index 15223b5a3af9..a5e6cbd8ec1f 100644
--- a/fs/ext4/mballoc.c
+++ b/fs/ext4/mballoc.c
@@ -3592,7 +3592,22 @@ ext4_mb_normalize_request(struct ext4_allocation_context *ac,
 	}
 	rcu_read_unlock();
 
-	if (start + size <= ac->ac_o_ex.fe_logical &&
+	/*
+	 * In this function "start" and "size" are normalized for better
+	 * alignment and length such that we could preallocate more blocks.
+	 * This normalization is done such that original request of
+	 * ac->ac_o_ex.fe_logical & fe_len should always lie within "start" and
+	 * "size" boundaries.
+	 * (Note fe_len can be relaxed since FS block allocation API does not
+	 * provide gurantee on number of contiguous blocks allocation since that
+	 * depends upon free space left, etc).
+	 * In case of inode pa, later we use the allocated blocks
+	 * [pa_start + fe_logical - pa_lstart, fe_len/size] from the preallocated
+	 * range of goal/best blocks [start, size] to put it at the
+	 * ac_o_ex.fe_logical extent of this inode.
+	 * (See ext4_mb_use_inode_pa() for more details)
+	 */
+	if (start + size <= ac->ac_o_ex.fe_logical ||
 			start > ac->ac_o_ex.fe_logical) {
 		ext4_msg(ac->ac_sb, KERN_ERR,
 			 "start %lu, size %lu, fe_logical %lu",
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2022-06-21 21:05 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-21 20:50 [PATCH AUTOSEL 5.10 01/11] genirq: PM: Use runtime PM for chained interrupts Sasha Levin
2022-06-21 20:50 ` [PATCH AUTOSEL 5.10 02/11] irqchip/uniphier-aidet: Add compatible string for NX1 SoC Sasha Levin
2022-06-21 20:50 ` [PATCH AUTOSEL 5.10 03/11] mei: me: set internal pg flag to off on hardware reset Sasha Levin
2022-06-21 20:50 ` [PATCH AUTOSEL 5.10 04/11] nvme-pci: add trouble shooting steps for timeouts Sasha Levin
2022-06-21 20:50 ` [PATCH AUTOSEL 5.10 05/11] nvme-pci: phison e12 has bogus namespace ids Sasha Levin
2022-06-21 20:51 ` [PATCH AUTOSEL 5.10 06/11] nvme-pci: smi " Sasha Levin
2022-06-21 20:51 ` [PATCH AUTOSEL 5.10 07/11] nvme-pci: sk hynix p31 " Sasha Levin
2022-06-21 20:51 ` [PATCH AUTOSEL 5.10 08/11] ext4: improve write performance with disabled delalloc Sasha Levin
2022-06-21 20:51 ` [PATCH AUTOSEL 5.10 09/11] blk-mq: protect q->elevator by ->sysfs_lock in blk_mq_elv_switch_none Sasha Levin
2022-06-21 20:51 ` [PATCH AUTOSEL 5.10 10/11] blk-mq: don't clear flush_rq from tags->rqs[] Sasha Levin
2022-06-21 20:51 ` [PATCH AUTOSEL 5.10 11/11] ext4: correct the judgment of BUG in ext4_mb_normalize_request Sasha Levin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).