public inbox for stable@vger.kernel.org
 help / color / mirror / Atom feed
From: Sagar Biradar <sagar.biradar@microchip.com>
To: "Martin K . Petersen" <martin.petersen@oracle.com>,
	James Bottomley <James.Bottomley@HansenPartnership.com>,
	Jack Wang <jinpu.wang@cloud.ionos.com>
Cc: linux-scsi <linux-scsi@vger.kernel.org>, <stable@vger.kernel.org>,
	"Brian King" <brking@linux.vnet.ibm.com>,
	Don Brace <don.brace@microchip.com>,
	"Raja VS" <raja.vs@microchip.com>,
	Kumar Meiyappan <kumar.meiyappan@microchip.com>,
	Abhinav Kuchibhotla <abhinav.kuchibhotla@microchip.com>,
	Uday kumar Bagam <udaykumar.bagam@microchip.com>,
	Advait Churi <advait.churi@microchip.com>,
	Sagar Biradar <sagar.biradar@microchip.com>
Subject: [PATCH] scsi: pm8001: do not wait for port reset timeout after link down
Date: Thu, 16 Apr 2026 15:54:03 +0000	[thread overview]
Message-ID: <20260416155403.416374-1-sagar.biradar@microchip.com> (raw)

From: Kumar Meiyappan <kumar.meiyappan@microchip.com>

During SATA hot removal with I/O in flight, commands may time out
and enter the abort path. As part of abort handling, the driver
issues a local PHY reset and then waits for the PORT_RESET_TMO
event from firmware.

However, once the link is already down, firmware does not generate
that event. The abort path then waits for a completion that will
never arrive, which can lead to a call trace or stalled recovery
during device removal.

Avoid waiting for port reset completion when the PHY link is
already down.

Signed-off-by: Kumar Meiyappan <kumar.meiyappan@microchip.com>
Signed-off-by: Sagar Biradar <sagar.biradar@microchip.com>
---
 drivers/scsi/pm8001/pm8001_sas.c | 36 +++++++++++++++++---------------
 1 file changed, 19 insertions(+), 17 deletions(-)

diff --git a/drivers/scsi/pm8001/pm8001_sas.c b/drivers/scsi/pm8001/pm8001_sas.c
index 645524f3fe2d..5d45c489d7f6 100644
--- a/drivers/scsi/pm8001/pm8001_sas.c
+++ b/drivers/scsi/pm8001/pm8001_sas.c
@@ -1148,24 +1148,26 @@ int pm8001_abort_task(struct sas_task *task)
 				phy->reset_completion = NULL;
 			} else {
 				/* 3. Wait for Port Reset complete or
-				 * Port reset TMO
+				 * Port reset TMO, if Phy Link is still up
 				 */
-				pm8001_dbg(pm8001_ha, MSG,
-					   "Waiting for Port reset\n");
-				ret = wait_for_completion_timeout(
-					&completion_reset,
-					PM8001_TASK_TIMEOUT * HZ);
-				if (!ret)
-					phy->reset_completion = NULL;
-				WARN_ON(phy->port_reset_status ==
-						PORT_RESET_TMO);
-				if (phy->port_reset_status == PORT_RESET_TMO) {
-					pm8001_dev_gone_notify(dev);
-					PM8001_CHIP_DISP->hw_event_ack_req(
-						pm8001_ha, 0,
-						0x07, /*HW_EVENT_PHY_DOWN ack*/
-						port_id, phy_id, 0, 0);
-					goto out;
+				if (phy->phy_state != PHY_LINK_DISABLE) {
+					pm8001_dbg(pm8001_ha, MSG,
+						   "Waiting for Port reset\n");
+					ret = wait_for_completion_timeout(
+						&completion_reset,
+						PM8001_TASK_TIMEOUT * HZ);
+					if (!ret)
+						phy->reset_completion = NULL;
+					WARN_ON(phy->port_reset_status ==
+							PORT_RESET_TMO);
+					if (phy->port_reset_status == PORT_RESET_TMO) {
+						pm8001_dev_gone_notify(dev);
+						PM8001_CHIP_DISP->hw_event_ack_req(
+							pm8001_ha, 0,
+							0x07, /*HW_EVENT_PHY_DOWN ack*/
+							port_id, phy_id, 0, 0);
+						goto out;
+					}
 				}
 			}
 
-- 
2.43.0


                 reply	other threads:[~2026-04-16 16:15 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260416155403.416374-1-sagar.biradar@microchip.com \
    --to=sagar.biradar@microchip.com \
    --cc=James.Bottomley@HansenPartnership.com \
    --cc=abhinav.kuchibhotla@microchip.com \
    --cc=advait.churi@microchip.com \
    --cc=brking@linux.vnet.ibm.com \
    --cc=don.brace@microchip.com \
    --cc=jinpu.wang@cloud.ionos.com \
    --cc=kumar.meiyappan@microchip.com \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=raja.vs@microchip.com \
    --cc=stable@vger.kernel.org \
    --cc=udaykumar.bagam@microchip.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox