All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jie Zhan <zhanjie9@hisilicon.com>
To: <jejb@linux.ibm.com>, <martin.petersen@oracle.com>
Cc: <chenxiang66@hisilicon.com>, <john.g.garry@oracle.com>,
	<damien.lemoal@opensource.wdc.com>, <yanaijie@huawei.com>,
	<johannes.thumshirn@wdc.com>, <duoming@zju.edu.cn>,
	<zhanjie9@hisilicon.com>, <liyihang9@huawei.com>,
	<yangxingui@huawei.com>, <prime.zeng@hisilicon.com>,
	<linuxarm@huawei.com>, <linux-scsi@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>
Subject: [PATCH for-next 4/5] scsi: hisi_sas: Fix SATA devices missing issue during I_T nexus reset
Date: Fri, 18 Nov 2022 16:37:13 +0800	[thread overview]
Message-ID: <20221118083714.4034612-5-zhanjie9@hisilicon.com> (raw)
In-Reply-To: <20221118083714.4034612-1-zhanjie9@hisilicon.com>

SATA devices on an expander may be removed and not be found again
when I_T nexus reset and revalidation are processed simultaneously.

The issue comes from:

- Revalidation can remove SATA devices in link reset, e.g. in
  hisi_sas_clear_nexus_ha().

- However, hisi_sas_debug_I_T_nexus_reset() polls the state of a SATA
  device on an expander after sending link_reset, where it calls:
   hisi_sas_debug_I_T_nexus_reset
    sas_ata_wait_after_reset
     ata_wait_after_reset
      ata_wait_ready
       smp_ata_check_ready
        sas_ex_phy_discover
         sas_ex_phy_discover_helper
          sas_set_ex_phy
  The ex_phy's change count is updated in sas_set_ex_phy(), so SATA devices
  after a link reset may not be found later through revalidation.

A similar issue was reported in:
commit 0f3fce5cc77e ("[SCSI] libsas: fix ata_eh clobbering ex_phys via
smp_ata_check_ready")
commit 87c8331fcf72 ("[SCSI] libsas: prevent domain rediscovery competing
with ata error handling").

To address this issue, in hisi_sas_debug_I_T_nexus_reset(), we now call
smp_ata_check_ready_type() that only polls the device type while not
updating the ex_phy's data of libsas.

Fixes: 71453bd9d1bf ("scsi: hisi_sas: Use sas_ata_wait_after_reset() in IT nexus reset")
Signed-off-by: Jie Zhan <zhanjie9@hisilicon.com>
---
 drivers/scsi/hisi_sas/hisi_sas_main.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/scsi/hisi_sas/hisi_sas_main.c b/drivers/scsi/hisi_sas/hisi_sas_main.c
index 62080d0fad6f..41ba22f6c7f0 100644
--- a/drivers/scsi/hisi_sas/hisi_sas_main.c
+++ b/drivers/scsi/hisi_sas/hisi_sas_main.c
@@ -1694,13 +1694,15 @@ static int hisi_sas_debug_I_T_nexus_reset(struct domain_device *device)
 		return rc;
 	}
 
+	/* Remote phy */
 	if (rc)
 		return rc;
 
-	/* Remote phy */
 	if (dev_is_sata(device)) {
-		rc = sas_ata_wait_after_reset(device,
-					HISI_SAS_WAIT_PHYUP_TIMEOUT);
+		struct ata_link *link = &device->sata_dev.ap->link;
+
+		rc = ata_wait_after_reset(link, HISI_SAS_WAIT_PHYUP_TIMEOUT,
+					  smp_ata_check_ready_type);
 	} else {
 		msleep(2000);
 	}
-- 
2.30.0


  parent reply	other threads:[~2022-11-18  8:38 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-18  8:37 [PATCH for-next 0/5] scsi: hisi_sas/libsas: Fix SATA devices missing issue during hisi_sas_debug_I_T_nexus_reset() Jie Zhan
2022-11-18  8:37 ` [PATCH for-next 1/5] Revert "scsi: hisi_sas: Drain bcast events in hisi_sas_rescan_topology()" Jie Zhan
2022-11-18  8:37 ` [PATCH for-next 2/5] Revert "scsi: hisi_sas: Don't send bcast events from HW during nexus HA reset" Jie Zhan
2022-11-18  8:37 ` [PATCH for-next 3/5] scsi: libsas: Add smp_ata_check_ready_type() Jie Zhan
2022-11-18  8:37 ` Jie Zhan [this message]
2022-11-18  8:37 ` [PATCH for-next 5/5] scsi: libsas: Do not export sas_ata_wait_after_reset() Jie Zhan
2022-11-26  3:08 ` [PATCH for-next 0/5] scsi: hisi_sas/libsas: Fix SATA devices missing issue during hisi_sas_debug_I_T_nexus_reset() Martin K. Petersen
2022-12-01  3:45 ` Martin K. Petersen

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=20221118083714.4034612-5-zhanjie9@hisilicon.com \
    --to=zhanjie9@hisilicon.com \
    --cc=chenxiang66@hisilicon.com \
    --cc=damien.lemoal@opensource.wdc.com \
    --cc=duoming@zju.edu.cn \
    --cc=jejb@linux.ibm.com \
    --cc=johannes.thumshirn@wdc.com \
    --cc=john.g.garry@oracle.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=linuxarm@huawei.com \
    --cc=liyihang9@huawei.com \
    --cc=martin.petersen@oracle.com \
    --cc=prime.zeng@hisilicon.com \
    --cc=yanaijie@huawei.com \
    --cc=yangxingui@huawei.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.