From patchwork Mon Jun 7 09:29:36 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 455271 Delivered-To: patch@linaro.org Received: by 2002:a02:735a:0:0:0:0:0 with SMTP id a26csp2590129jae; Mon, 7 Jun 2021 02:35:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwcb7YdZmyNqaArRkTPR4AkAU7uLx9oM+tJi4ocjLM71uTNma09FfL7T3imL600pCXP7HgA X-Received: by 2002:a17:906:b191:: with SMTP id w17mr17177991ejy.200.1623058502052; Mon, 07 Jun 2021 02:35:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623058502; cv=none; d=google.com; s=arc-20160816; b=J4MllelkjROYuVrU6LRGf5azaXjxIbp9bVn4jvyyX5OS3xU3x0CxWL7YvzpT7FISfY cTU92FSA3dUqwjFB4lx/0twyTeCFjmqjVPpaPSXRer9ljADXhnDpITa0xSLbgHr4ZIUe 3nGS4PvnlxrDhkeDvqrKdDwOHdbnzp6sITklEerukMJACd+itr6vO2BoqPavVANVguwe fN6JCTkSyayh++xp6kkqsQoQCDj2gU1YkCiIssxNWkHwnQMFwuceTqd3bVj3bTg9rUj8 Wflw4Dtsvqw+jHOIai4C3MCEBXEI2T3q4YXrmk5o7ALI+gtpdKrQrlXAdQs2aU5wiSuD E2WA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from; bh=Gy7s/PYo6d2N2PIax765Y459pZuUlelXKjBz9Lx1Fp0=; b=oWhrSg0macpmGeVfyR1yqTJP8vpRAmndndt3ZEgDk5dBv/8hjnVM9IdPrwdUZi7dgf hoV5KT8EN8VjZZfj9TZQGlDLFdWgLEBlcMdOEq/272gu/kQDfeDZJVYP7eXw6SG1RELI 0k7ASaRJb6MT8rLVlBgiRlRIGuC0b2QMFRX60+SdgD6MCq85xue2AsgZ3SMiAbzjdAWi wKB7LMHRH3qlHTOB4jF/h+034+cN296ylAt0cCm97xrBqPI2M09CfG+gjRn5oiFwWf5e g+lw3x5c2TOvOgVwYfUf92c9hvOZTkC2iONnxUnPvt7S7kIhq9q+ksogIlxkLTyEVLU0 5Gfg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-scsi-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-scsi-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v12si12128395ejb.163.2021.06.07.02.35.01 for ; Mon, 07 Jun 2021 02:35:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-scsi-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-scsi-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-scsi-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230435AbhFGJgK (ORCPT ); Mon, 7 Jun 2021 05:36:10 -0400 Received: from frasgout.his.huawei.com ([185.176.79.56]:3159 "EHLO frasgout.his.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230409AbhFGJgI (ORCPT ); Mon, 7 Jun 2021 05:36:08 -0400 Received: from fraeml714-chm.china.huawei.com (unknown [172.18.147.207]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4Fz7Ly23vWz6G7L8; Mon, 7 Jun 2021 17:27:38 +0800 (CST) Received: from lhreml724-chm.china.huawei.com (10.201.108.75) by fraeml714-chm.china.huawei.com (10.206.15.33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.2; Mon, 7 Jun 2021 11:34:16 +0200 Received: from localhost.localdomain (10.69.192.58) by lhreml724-chm.china.huawei.com (10.201.108.75) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.2; Mon, 7 Jun 2021 10:34:13 +0100 From: John Garry To: , CC: , , , Luo Jiaxing , John Garry Subject: [PATCH 2/5] scsi: hisi_sas: Run I_T nexus resets in parallel for clear nexus reset Date: Mon, 7 Jun 2021 17:29:36 +0800 Message-ID: <1623058179-80434-3-git-send-email-john.garry@huawei.com> X-Mailer: git-send-email 2.8.1 In-Reply-To: <1623058179-80434-1-git-send-email-john.garry@huawei.com> References: <1623058179-80434-1-git-send-email-john.garry@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.69.192.58] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To lhreml724-chm.china.huawei.com (10.201.108.75) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org From: Luo Jiaxing 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. Signed-off-by: Luo Jiaxing Signed-off-by: John Garry --- drivers/scsi/hisi_sas/hisi_sas.h | 1 + drivers/scsi/hisi_sas/hisi_sas_main.c | 23 +++++++++++++++++------ 2 files changed, 18 insertions(+), 6 deletions(-) -- 2.26.2 diff --git a/drivers/scsi/hisi_sas/hisi_sas.h b/drivers/scsi/hisi_sas/hisi_sas.h index 8e36ede12cf1..fbecdf756c77 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 50420741fc81..856cdc1b32d5 100644 --- a/drivers/scsi/hisi_sas/hisi_sas_main.c +++ b/drivers/scsi/hisi_sas/hisi_sas_main.c @@ -1886,12 +1886,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); @@ -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;