99 lines
3.4 KiB
Diff
99 lines
3.4 KiB
Diff
From 022ef921e55a9e9d864d5a478cee8cec03bdd7b4 Mon Sep 17 00:00:00 2001
|
|
From: Luo Jiaxing <luojiaxing@huawei.com>
|
|
Date: Tue, 3 Aug 2021 14:48:02 +0800
|
|
Subject: [PATCH 078/108] scsi: hisi_sas: Run I_T nexus resets in parallel for
|
|
clear nexus reset
|
|
|
|
mainline inclusion
|
|
from mainline-v5.14-rc1
|
|
commit 0f757339919d31533aeadbbfd62f2dd4a49e851f
|
|
category: feature
|
|
bugzilla: https://gitee.com/src-openeuler/kernel/issues/I8F82P
|
|
|
|
Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=0f757339919d31533aeadbbfd62f2dd4a49e851f
|
|
|
|
----------------------------------------------------------------------
|
|
|
|
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 <luojiaxing@huawei.com>
|
|
Signed-off-by: John Garry <john.garry@huawei.com>
|
|
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
|
|
Reviewed-by: Ouyangdelong <ouyangdelong@huawei.com>
|
|
Signed-off-by: Nifujia <nifujia1@hisilicon.com>
|
|
Signed-off-by: Zheng Zengkai <zhengzengkai@huawei.com>
|
|
Signed-off-by: YunYi Yang <yangyunyi2@huawei.com>
|
|
---
|
|
drivers/scsi/hisi_sas/hisi_sas.h | 1 +
|
|
drivers/scsi/hisi_sas/hisi_sas_main.c | 23 +++++++++++++++++------
|
|
2 files changed, 18 insertions(+), 6 deletions(-)
|
|
|
|
diff --git a/drivers/scsi/hisi_sas/hisi_sas.h b/drivers/scsi/hisi_sas/hisi_sas.h
|
|
index cbcb8a1da74f..6fd4ca989194 100644
|
|
--- a/drivers/scsi/hisi_sas/hisi_sas.h
|
|
+++ b/drivers/scsi/hisi_sas/hisi_sas.h
|
|
@@ -13,6 +13,7 @@
|
|
#define _HISI_SAS_H_
|
|
|
|
#include <linux/acpi.h>
|
|
+#include <linux/async.h>
|
|
#include <linux/clk.h>
|
|
#include <linux/debugfs.h>
|
|
#include <linux/dmapool.h>
|
|
diff --git a/drivers/scsi/hisi_sas/hisi_sas_main.c b/drivers/scsi/hisi_sas/hisi_sas_main.c
|
|
index d0b5f8d84ad5..4070ffe3af8c 100644
|
|
--- a/drivers/scsi/hisi_sas/hisi_sas_main.c
|
|
+++ b/drivers/scsi/hisi_sas/hisi_sas_main.c
|
|
@@ -1954,12 +1954,24 @@ static int hisi_sas_lu_reset(struct domain_device *device, u8 *lun)
|
|
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);
|
|
@@ -1974,12 +1986,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;
|
|
--
|
|
2.27.0
|
|
|