The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* [PATCH AUTOSEL 6.14 01/30] scsi: hisi_sas: Fix I/O errors caused by hardware port ID changes
@ 2025-04-22  2:15 Sasha Levin
  2025-04-22  2:15 ` [PATCH AUTOSEL 6.14 02/30] scsi: ufs: exynos: Ensure pre_link() executes before exynos_ufs_phy_init() Sasha Levin
                   ` (28 more replies)
  0 siblings, 29 replies; 30+ messages in thread
From: Sasha Levin @ 2025-04-22  2:15 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Xingui Yang, Martin K . Petersen, Sasha Levin, liyihang9,
	James.Bottomley, linux-scsi

From: Xingui Yang <yangxingui@huawei.com>

[ Upstream commit daff37f00c7506ca322ccfce95d342022f06ec58 ]

The hw port ID of phy may change when inserting disks in batches, causing
the port ID in hisi_sas_port and itct to be inconsistent with the hardware,
resulting in I/O errors. The solution is to set the device state to gone to
intercept I/O sent to the device, and then execute linkreset to discard and
find the disk to re-update its information.

Signed-off-by: Xingui Yang <yangxingui@huawei.com>
Link: https://lore.kernel.org/r/20250312095135.3048379-3-yangxingui@huawei.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/scsi/hisi_sas/hisi_sas_main.c | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/drivers/scsi/hisi_sas/hisi_sas_main.c b/drivers/scsi/hisi_sas/hisi_sas_main.c
index 3596414d970b2..7a484ad0f9abe 100644
--- a/drivers/scsi/hisi_sas/hisi_sas_main.c
+++ b/drivers/scsi/hisi_sas/hisi_sas_main.c
@@ -935,8 +935,28 @@ static void hisi_sas_phyup_work_common(struct work_struct *work,
 		container_of(work, typeof(*phy), works[event]);
 	struct hisi_hba *hisi_hba = phy->hisi_hba;
 	struct asd_sas_phy *sas_phy = &phy->sas_phy;
+	struct asd_sas_port *sas_port = sas_phy->port;
+	struct hisi_sas_port *port = phy->port;
+	struct device *dev = hisi_hba->dev;
+	struct domain_device *port_dev;
 	int phy_no = sas_phy->id;
 
+	if (!test_bit(HISI_SAS_RESETTING_BIT, &hisi_hba->flags) &&
+	    sas_port && port && (port->id != phy->port_id)) {
+		dev_info(dev, "phy%d's hw port id changed from %d to %llu\n",
+				phy_no, port->id, phy->port_id);
+		port_dev = sas_port->port_dev;
+		if (port_dev && !dev_is_expander(port_dev->dev_type)) {
+			/*
+			 * Set the device state to gone to block
+			 * sending IO to the device.
+			 */
+			set_bit(SAS_DEV_GONE, &port_dev->state);
+			hisi_sas_notify_phy_event(phy, HISI_PHYE_LINK_RESET);
+			return;
+		}
+	}
+
 	phy->wait_phyup_cnt = 0;
 	if (phy->identify.target_port_protocols == SAS_PROTOCOL_SSP)
 		hisi_hba->hw->sl_notify_ssp(hisi_hba, phy_no);
-- 
2.39.5


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

end of thread, other threads:[~2025-04-22  2:17 UTC | newest]

Thread overview: 30+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-22  2:15 [PATCH AUTOSEL 6.14 01/30] scsi: hisi_sas: Fix I/O errors caused by hardware port ID changes Sasha Levin
2025-04-22  2:15 ` [PATCH AUTOSEL 6.14 02/30] scsi: ufs: exynos: Ensure pre_link() executes before exynos_ufs_phy_init() Sasha Levin
2025-04-22  2:15 ` [PATCH AUTOSEL 6.14 03/30] scsi: ufs: exynos: Enable PRDT pre-fetching with UFSHCD_CAP_CRYPTO Sasha Levin
2025-04-22  2:15 ` [PATCH AUTOSEL 6.14 04/30] scsi: ufs: exynos: Move phy calls to .exit() callback Sasha Levin
2025-04-22  2:15 ` [PATCH AUTOSEL 6.14 05/30] scsi: ufs: exynos: gs101: Put UFS device in reset on .suspend() Sasha Levin
2025-04-22  2:15 ` [PATCH AUTOSEL 6.14 06/30] scsi: pm80xx: Set phy_attached to zero when device is gone Sasha Levin
2025-04-22  2:15 ` [PATCH AUTOSEL 6.14 07/30] ASoC: fsl_asrc_dma: get codec or cpu dai from backend Sasha Levin
2025-04-22  2:15 ` [PATCH AUTOSEL 6.14 08/30] ASoC: codecs: Add of_match_table for aw888081 driver Sasha Levin
2025-04-22  2:15 ` [PATCH AUTOSEL 6.14 09/30] x86/i8253: Call clockevent_i8253_disable() with interrupts disabled Sasha Levin
2025-04-22  2:15 ` [PATCH AUTOSEL 6.14 10/30] platform/x86: x86-android-tablets: Add "9v" to Vexia EDU ATLA 10 tablet symbols Sasha Levin
2025-04-22  2:15 ` [PATCH AUTOSEL 6.14 11/30] platform/x86: x86-android-tablets: Add Vexia Edu Atla 10 tablet 5V data Sasha Levin
2025-04-22  2:15 ` [PATCH AUTOSEL 6.14 12/30] netfs: Only create /proc/fs/netfs with CONFIG_PROC_FS Sasha Levin
2025-04-22  2:15 ` [PATCH AUTOSEL 6.14 13/30] iomap: skip unnecessary ifs_block_is_uptodate check Sasha Levin
2025-04-22  2:15 ` [PATCH AUTOSEL 6.14 14/30] riscv: Provide all alternative macros all the time Sasha Levin
2025-04-22  2:15 ` [PATCH AUTOSEL 6.14 15/30] ksmbd: fix WARNING "do not call blocking ops when !TASK_RUNNING" Sasha Levin
2025-04-22  2:15 ` [PATCH AUTOSEL 6.14 16/30] loop: aio inherit the ioprio of original request Sasha Levin
2025-04-22  2:15 ` [PATCH AUTOSEL 6.14 17/30] spi: tegra210-quad: use WARN_ON_ONCE instead of WARN_ON for timeouts Sasha Levin
2025-04-22  2:15 ` [PATCH AUTOSEL 6.14 18/30] spi: tegra210-quad: add rate limiting and simplify timeout error message Sasha Levin
2025-04-22  2:15 ` [PATCH AUTOSEL 6.14 19/30] hardening: Disable GCC randstruct for COMPILE_TEST Sasha Levin
2025-04-22  2:15 ` [PATCH AUTOSEL 6.14 20/30] ubsan: Fix panic from test_ubsan_out_of_bounds Sasha Levin
2025-04-22  2:15 ` [PATCH AUTOSEL 6.14 21/30] nvmet: pci-epf: cleanup link state management Sasha Levin
2025-04-22  2:15 ` [PATCH AUTOSEL 6.14 22/30] x86/cpu: Add CPU model number for Bartlett Lake CPUs with Raptor Cove cores Sasha Levin
2025-04-22  2:15 ` [PATCH AUTOSEL 6.14 23/30] md/raid1: Add check for missing source disk in process_checks() Sasha Levin
2025-04-22  2:15 ` [PATCH AUTOSEL 6.14 24/30] riscv: Avoid fortify warning in syscall_get_arguments() Sasha Levin
2025-04-22  2:15 ` [PATCH AUTOSEL 6.14 25/30] drm/amdgpu: use a dummy owner for sysfs triggered cleaner shaders v4 Sasha Levin
2025-04-22  2:15 ` [PATCH AUTOSEL 6.14 26/30] drm/amd: Forbid suspending into non-default suspend states Sasha Levin
2025-04-22  2:15 ` [PATCH AUTOSEL 6.14 27/30] drm/amdgpu: Use the right function for hdp flush Sasha Levin
2025-04-22  2:15 ` [PATCH AUTOSEL 6.14 28/30] ublk: add ublk_force_abort_dev() Sasha Levin
2025-04-22  2:15 ` [PATCH AUTOSEL 6.14 29/30] ublk: rely on ->canceling for dealing with ublk_nosrv_dev_should_queue_io Sasha Levin
2025-04-22  2:15 ` [PATCH AUTOSEL 6.14 30/30] spi: spi-imx: Add check for spi_imx_setupxfer() Sasha Levin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox