Re: [PATCH V2 3/3] pm80xx : Wait for PHY startup before draining libsas queue.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 24/06/2020 13:03, Deepak Ukey wrote:


From: peter chang <dpf@xxxxxxxxxx>

The host's scan finish waits for the libsas queue to drain. However,
if the PHYs are still in the process of starting then the queue will
be empty. This means that we declare the scan finished before it has
even started. Here we wait for various events from the firmware-side.

But we still report the phy up even to libsas later, so should revalidate the domain and discover the device.


The wait behavior can be configured using the module parameter
"wait_for_phy_startup", if the parameter is enabled, the driver will wait
for the phy event from the firmware, before proceeding with load.

If this is to circumvent a deficiency in udev (which you mentioned in the v1 in this series, but fail to mention here), then better to fix udev.


Signed-off-by: Viswas G <Viswas.G@xxxxxxxxxxxxx>

Author != first Signed-off-by

Signed-off-by: peter chang <dpf@xxxxxxxxxx>
Signed-off-by: Radha Ramachandran <radha@xxxxxxxxxx>
Signed-off-by: Deepak Ukey <Deepak.Ukey@xxxxxxxxxxxxx>
---
  drivers/scsi/pm8001/pm8001_ctl.c  | 36 +++++++++++++++++++++
  drivers/scsi/pm8001/pm8001_defs.h |  6 ++--
  drivers/scsi/pm8001/pm8001_init.c | 22 +++++++++++++
  drivers/scsi/pm8001/pm8001_sas.c  | 67 +++++++++++++++++++++++++++++++++++++--
  drivers/scsi/pm8001/pm8001_sas.h  |  4 +++
  drivers/scsi/pm8001/pm80xx_hwi.c  | 67 ++++++++++++++++++++++++++++++++-------
  6 files changed, 185 insertions(+), 17 deletions(-)

diff --git a/drivers/scsi/pm8001/pm8001_ctl.c b/drivers/scsi/pm8001/pm8001_ctl.c
index 3c9f42779dd0..eae629610a5f 100644
--- a/drivers/scsi/pm8001/pm8001_ctl.c
+++ b/drivers/scsi/pm8001/pm8001_ctl.c
@@ -88,6 +88,41 @@ static ssize_t controller_fatal_error_show(struct device *cdev,
  }
  static DEVICE_ATTR_RO(controller_fatal_error);
+/**
+ * phy_startup_timeout_show - per-phy discovery timeout
+ * @cdev: pointer to embedded class device
+ * @buf: the buffer returned
+ *
+ * A sysfs 'read/write' shost attribute.
+ */
+static ssize_t phy_startup_timeout_show(struct device *cdev,
+	struct device_attribute *attr, char *buf)
+{
+	struct Scsi_Host *shost = class_to_shost(cdev);
+	struct sas_ha_struct *sha = SHOST_TO_SAS_HA(shost);
+	struct pm8001_hba_info *pm8001_ha = sha->lldd_ha;
+
+	return snprintf(buf, PAGE_SIZE, "%08xh\n",
+		pm8001_ha->phy_startup_timeout / HZ);
+}
+
+static ssize_t phy_startup_timeout_store(struct device *cdev,
+	struct device_attribute *attr, const char *buf, size_t count)
+{
+	struct Scsi_Host *shost = class_to_shost(cdev);
+	struct sas_ha_struct *sha = SHOST_TO_SAS_HA(shost);
+	struct pm8001_hba_info *pm8001_ha = sha->lldd_ha;
+	int val = 0;
+
+	if (kstrtoint(buf, 0, &val) < 0)
+		return -EINVAL;
+
+	pm8001_ha->phy_startup_timeout = val * HZ;
+	return strlen(buf);

I don't see how this can be used.

+}
+
+static DEVICE_ATTR_RW(phy_startup_timeout);
+

>
>   	case HW_EVENT_SAS_PHY_UP:
> @@ -4975,6 +5015,9 @@ pm80xx_chip_phy_start_req(struct pm8001_hba_info *pm8001_ha, u8 phy_id)
>
>   	PM8001_INIT_DBG(pm8001_ha,
>   		pm8001_printk("PHY START REQ for phy_id %d\n", phy_id));
> +	set_bit(phy_id, &pm8001_ha->phy_mask);
> +	pm8001_ha->phy[phy_id].start_timeout =
> +		jiffies + pm8001_ha->phy_startup_timeout;
>
>   	payload.ase_sh_lm_slr_phyid = cpu_to_le32(SPINHOLD_ENABLE |
>   			LINKMODE_AUTO | pm8001_ha->link_rate | phy_id);
> --

If there is nothing attached to the phy, then it would never come up, right? If so, how do you handle this?

Thanks,
john




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]

  Powered by Linux