From patchwork Thu May 31 12:50:47 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 137380 Delivered-To: patch@linaro.org Received: by 2002:a2e:9706:0:0:0:0:0 with SMTP id r6-v6csp6561534lji; Thu, 31 May 2018 05:52:44 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJyJafYc3n5d1QEHisWsuwcnC9/H/BgDZ8WXsTbL8g9BMtS3HrDWTeXHpnOdMlhQpqo+BSA X-Received: by 2002:a17:902:a5c7:: with SMTP id t7-v6mr6950589plq.360.1527771163916; Thu, 31 May 2018 05:52:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527771163; cv=none; d=google.com; s=arc-20160816; b=kvMOgkcth6WcwyJarse0ZDkl0RBs95DJm3dUCmXbk+4E04V8gC3tQxUCjEpEi5b+Dc yXledFsi8iDkr8rgpJvFjLGOtzdJKE4X0CHVPSZBtuBVtibbgyjONoVNndsxxRehwLt4 UrtI85dhULsv78vmcHe/ZV20VGXIhqcK6ogHLT0RvKNrrL+pL7eU+pqoc4LRBvx7TOT+ 1Xgn+ke8DslqmigDmV3dzR5utyA2gDMSnwJ2v7d7DjfR3z+j5mmrCYNufuyJNpvpS10K Qg23p7W0Re5UIc/A5EEl/e2CqnMdMTy8jMjzpIwyV+tvETTJvgf4JEQGkArnxwpNTHoL ye3Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:arc-authentication-results; bh=9SIJsYtmMZVBNE41neSSgQ3xOeFL341w79GbWHef5YE=; b=dkIU+FIHChe3muGZsho1rdQojLq4pOLgL6PRoR9O9Fqrz5nFboWvWMOPu915IH5Vlr DjzpDrPXH1FX3FWaWfuwjqQK5qA/6srRoGTcx+2w63uRJM6TrmdVeu0ck9c2hw6Omp0+ H9FAnFyEBZkTJTzHdBQibSx1c3q+hYCJPQhUiSuMy0p7O2LjbFYd8InLvacavgI3DnV7 BbXeEHpEWEVQBMyUYvaecW5xlbZRz5SGrXEXGXr7t1fg97CzSQR891CEDXJr8i3J5tGG dOicil1QufxYRhqExl5xhQzA1+DUDb9GaJjpMbF6qroqAGNv1CCkP4To9r+aP2fW1YUG HR0A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q2-v6si37041758plh.136.2018.05.31.05.52.43; Thu, 31 May 2018 05:52:43 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755228AbeEaMwl (ORCPT + 30 others); Thu, 31 May 2018 08:52:41 -0400 Received: from szxga05-in.huawei.com ([45.249.212.191]:8237 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1755171AbeEaMwe (ORCPT ); Thu, 31 May 2018 08:52:34 -0400 Received: from DGGEMS406-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id 3BCA51E64C9CB; Thu, 31 May 2018 20:52:20 +0800 (CST) Received: from localhost.localdomain (10.67.212.75) by DGGEMS406-HUB.china.huawei.com (10.3.19.206) with Microsoft SMTP Server id 14.3.382.0; Thu, 31 May 2018 20:52:12 +0800 From: John Garry To: , CC: , , , Xiaofei Tan , "John Garry" Subject: [PATCH 6/9] scsi: hisi_sas: Release all remaining resources in clear nexus ha Date: Thu, 31 May 2018 20:50:47 +0800 Message-ID: <1527771050-200916-7-git-send-email-john.garry@huawei.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1527771050-200916-1-git-send-email-john.garry@huawei.com> References: <1527771050-200916-1-git-send-email-john.garry@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.67.212.75] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Xiaofei Tan In host reset, we use TMF or soft-reset to re-init device, and if success, we will release all LLDD resources of this device. If the init fails - maybe because the device was removed or link has not come up - then do not release the LLDD resources, but rather rely on SCSI EH to handle the timeout for these resources later on. But if clear nexus ha calls host reset, which is the last effort of SCSI EH, we should release all LLDD remain resources. Because SCSI EH will release all tasks after clear nexus ha. Before release, we do I_T nexus reset to try to clear target remain IOs. Signed-off-by: Xiaofei Tan Signed-off-by: John Garry --- drivers/scsi/hisi_sas/hisi_sas_main.c | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) -- 1.9.1 diff --git a/drivers/scsi/hisi_sas/hisi_sas_main.c b/drivers/scsi/hisi_sas/hisi_sas_main.c index 006e776..da1d5fe 100644 --- a/drivers/scsi/hisi_sas/hisi_sas_main.c +++ b/drivers/scsi/hisi_sas/hisi_sas_main.c @@ -1652,14 +1652,32 @@ static int hisi_sas_lu_reset(struct domain_device *device, u8 *lun) 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; queue_work(hisi_hba->wq, &r.work); wait_for_completion(r.completion); - if (r.done) - return TMF_RESP_FUNC_COMPLETE; + if (!r.done) + return TMF_RESP_FUNC_FAILED; + + for (i = 0; i < HISI_SAS_MAX_DEVICES; i++) { + struct hisi_sas_device *sas_dev = &hisi_hba->devices[i]; + struct domain_device *device = sas_dev->sas_device; + + if ((sas_dev->dev_type == SAS_PHY_UNUSED) || !device || + 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); + } + + hisi_sas_release_tasks(hisi_hba); - return TMF_RESP_FUNC_FAILED; + return TMF_RESP_FUNC_COMPLETE; } static int hisi_sas_query_task(struct sas_task *task)