From: Luo Jiaxing Date: Mon, 7 Jun 2021 09:29:36 +0000 (+0800) Subject: scsi: hisi_sas: Run I_T nexus resets in parallel for clear nexus reset X-Git-Tag: accepted/tizen/unified/20230118.172025~6832^2~109 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=0f757339919d31533aeadbbfd62f2dd4a49e851f;p=platform%2Fkernel%2Flinux-rpi.git scsi: hisi_sas: Run I_T nexus resets in parallel for clear nexus reset For a clear nexus reset operation, the I_T nexus resets are executed serially for each device. For devices attached through an expander, this may take 2s per device; so, in total, could take a long time. Reduce the total time by running the I_T nexus resets in parallel through async operations. Link: https://lore.kernel.org/r/1623058179-80434-3-git-send-email-john.garry@huawei.com Signed-off-by: Luo Jiaxing Signed-off-by: John Garry Signed-off-by: Martin K. Petersen --- diff --git a/drivers/scsi/hisi_sas/hisi_sas.h b/drivers/scsi/hisi_sas/hisi_sas.h index 8e36ede..fbecdf7 100644 --- a/drivers/scsi/hisi_sas/hisi_sas.h +++ b/drivers/scsi/hisi_sas/hisi_sas.h @@ -8,6 +8,7 @@ #define _HISI_SAS_H_ #include +#include #include #include #include diff --git a/drivers/scsi/hisi_sas/hisi_sas_main.c b/drivers/scsi/hisi_sas/hisi_sas_main.c index 5042074..856cdc1 100644 --- a/drivers/scsi/hisi_sas/hisi_sas_main.c +++ b/drivers/scsi/hisi_sas/hisi_sas_main.c @@ -1886,12 +1886,24 @@ out: return rc; } +static void hisi_sas_async_I_T_nexus_reset(void *data, async_cookie_t cookie) +{ + struct domain_device *device = data; + struct hisi_hba *hisi_hba = dev_to_hisi_hba(device); + int rc; + + rc = hisi_sas_debug_I_T_nexus_reset(device); + if (rc != TMF_RESP_FUNC_COMPLETE) + dev_info(hisi_hba->dev, "I_T_nexus reset fail for dev:%016llx rc=%d\n", + SAS_ADDR(device->sas_addr), rc); +} + static int hisi_sas_clear_nexus_ha(struct sas_ha_struct *sas_ha) { struct hisi_hba *hisi_hba = sas_ha->lldd_ha; - struct device *dev = hisi_hba->dev; HISI_SAS_DECLARE_RST_WORK_ON_STACK(r); - int rc, i; + ASYNC_DOMAIN_EXCLUSIVE(async); + int i; queue_work(hisi_hba->wq, &r.work); wait_for_completion(r.completion); @@ -1906,12 +1918,11 @@ static int hisi_sas_clear_nexus_ha(struct sas_ha_struct *sas_ha) dev_is_expander(device->dev_type)) continue; - rc = hisi_sas_debug_I_T_nexus_reset(device); - if (rc != TMF_RESP_FUNC_COMPLETE) - dev_info(dev, "clear nexus ha: for device[%d] rc=%d\n", - sas_dev->device_id, rc); + async_schedule_domain(hisi_sas_async_I_T_nexus_reset, + device, &async); } + async_synchronize_full_domain(&async); hisi_sas_release_tasks(hisi_hba); return TMF_RESP_FUNC_COMPLETE;