From patchwork Fri Sep 6 12:55:29 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 173235 Delivered-To: patch@linaro.org Received: by 2002:ac9:19ad:0:0:0:0:0 with SMTP id d45csp600917oce; Fri, 6 Sep 2019 05:59:08 -0700 (PDT) X-Google-Smtp-Source: APXvYqyuWi1qAFXHgV2k5u+5xfxCmZhB7OvX0yaKqbPUD+TjLmgUQi9bOSSB4DY1YHJAtl0HfT3Q X-Received: by 2002:a17:90b:f12:: with SMTP id br18mr9046275pjb.127.1567774748002; Fri, 06 Sep 2019 05:59:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567774747; cv=none; d=google.com; s=arc-20160816; b=Ljdo7yAOvr0R1pXXk70Rdsw2k/OQLaFqPUMsSkf5sdTQPb5Z0pmuS0mVsgehrDZ/tp TsQC1P2aIv8MCUNBAsQV9YMtf0kvU9CbzTEdsidZv1t7yyUMxSSgsIaDZIhlH70Ld+Zp US2G57O/g26Uil4OQOGMesJC7XB+pvME5o4UtMTflZ70aoEv0wf+aakwyzM9+qjAU5cM V0ScozSZ/gM4glzgzgTVScqW05SVJaFTabA+0GOo91On81qiclR27YrnAG2v292MuUvi rADwAe90o5Iov+3oVUgSxPZnOfJyeXnIdLWO30BLBByNnPtvi3Ifd87flFDiIOPJTjhP zbXw== 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; bh=OI+3Gkj8g/75qk8NLN66MI+GjocoRcwYX+8hl8FoL+E=; b=YUhCp3z6+G6R9Sus/cuXXMf7PhxA6JMMpBmbk7muj96BbDbv5D7TEqZUITFAOisfcn Kkarwc602jelvVmA0sNU9IANDV9+U6O3gGPuCxqng9dROhhEzwyEWEvpxP8xiDbZLGLc izUQNI1GZY1e+LWxUrNxTalIwSCXJhAosECVwzpv72BanDBuQ1P6ro5mEqHGpn/XosY3 O58xImQaa8xlgrwjPgrXSBNJarm4r00szZhxbM6xz9rUc4AZIgb1+jT7LAfxbSieyuMX fluWcBv2tkHatZnssvdeKm5DNIbzIZgxweOIFKgZ4NGI+cP0xyJMn58DP14I3qe86K6h AtSQ== 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 132si4334929pgc.134.2019.09.06.05.59.07; Fri, 06 Sep 2019 05:59:07 -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 S2405055AbfIFM7H (ORCPT + 28 others); Fri, 6 Sep 2019 08:59:07 -0400 Received: from szxga04-in.huawei.com ([45.249.212.190]:7135 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2404905AbfIFM6O (ORCPT ); Fri, 6 Sep 2019 08:58:14 -0400 Received: from DGGEMS407-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id DBDFB2FA6EC3306F9B8B; Fri, 6 Sep 2019 20:58:10 +0800 (CST) Received: from localhost.localdomain (10.67.212.75) by DGGEMS407-HUB.china.huawei.com (10.3.19.207) with Microsoft SMTP Server id 14.3.439.0; Fri, 6 Sep 2019 20:58:02 +0800 From: John Garry To: , CC: , , , Xiang Chen , "John Garry" Subject: [PATCH 05/13] scsi: hisi_sas: Retry 3 times TMF IO for SAS disks when init device Date: Fri, 6 Sep 2019 20:55:29 +0800 Message-ID: <1567774537-20003-6-git-send-email-john.garry@huawei.com> X-Mailer: git-send-email 2.8.1 In-Reply-To: <1567774537-20003-1-git-send-email-john.garry@huawei.com> References: <1567774537-20003-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: Xiang Chen When init device for SAS disks, it will send TMF IO to clear disks. At that times TMF IO is broken by some operations such as injecting controller reset from HW RAs event, the TMF IO will be timeout, and at last device will be gone. Print is as followed: hisi_sas_v3_hw 0000:74:02.0: dev[240:1] found ... hisi_sas_v3_hw 0000:74:02.0: controller resetting... hisi_sas_v3_hw 0000:74:02.0: phyup: phy7 link_rate=10(sata) hisi_sas_v3_hw 0000:74:02.0: phyup: phy0 link_rate=9(sata) hisi_sas_v3_hw 0000:74:02.0: phyup: phy1 link_rate=9(sata) hisi_sas_v3_hw 0000:74:02.0: phyup: phy2 link_rate=9(sata) hisi_sas_v3_hw 0000:74:02.0: phyup: phy3 link_rate=9(sata) hisi_sas_v3_hw 0000:74:02.0: phyup: phy6 link_rate=10(sata) hisi_sas_v3_hw 0000:74:02.0: phyup: phy5 link_rate=11 hisi_sas_v3_hw 0000:74:02.0: phyup: phy4 link_rate=11 hisi_sas_v3_hw 0000:74:02.0: controller reset complete hisi_sas_v3_hw 0000:74:02.0: abort tmf: TMF task timeout and not done hisi_sas_v3_hw 0000:74:02.0: dev[240:1] is gone sas: driver on host 0000:74:02.0 cannot handle device 5000c500a75a860d, error:5 To improve the reliability, retry TMF IO max of 3 times for SAS disks which is the same as softreset does. Signed-off-by: Xiang Chen Signed-off-by: John Garry --- drivers/scsi/hisi_sas/hisi_sas_main.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) -- 2.17.1 diff --git a/drivers/scsi/hisi_sas/hisi_sas_main.c b/drivers/scsi/hisi_sas/hisi_sas_main.c index 247268983df9..4c279a285c20 100644 --- a/drivers/scsi/hisi_sas/hisi_sas_main.c +++ b/drivers/scsi/hisi_sas/hisi_sas_main.c @@ -698,13 +698,13 @@ static struct hisi_sas_device *hisi_sas_alloc_dev(struct domain_device *device) return sas_dev; } -#define HISI_SAS_SRST_ATA_DISK_CNT 3 +#define HISI_SAS_DISK_RECOVER_CNT 3 static int hisi_sas_init_device(struct domain_device *device) { int rc = TMF_RESP_FUNC_COMPLETE; struct scsi_lun lun; struct hisi_sas_tmf_task tmf_task; - int retry = HISI_SAS_SRST_ATA_DISK_CNT; + int retry = HISI_SAS_DISK_RECOVER_CNT; struct hisi_hba *hisi_hba = dev_to_hisi_hba(device); struct device *dev = hisi_hba->dev; struct sas_phy *local_phy; @@ -714,10 +714,14 @@ static int hisi_sas_init_device(struct domain_device *device) int_to_scsilun(0, &lun); tmf_task.tmf = TMF_CLEAR_TASK_SET; - rc = hisi_sas_debug_issue_ssp_tmf(device, lun.scsi_lun, - &tmf_task); - if (rc == TMF_RESP_FUNC_COMPLETE) - hisi_sas_release_task(hisi_hba, device); + while (retry-- > 0) { + rc = hisi_sas_debug_issue_ssp_tmf(device, lun.scsi_lun, + &tmf_task); + if (rc == TMF_RESP_FUNC_COMPLETE) { + hisi_sas_release_task(hisi_hba, device); + break; + } + } break; case SAS_SATA_DEV: case SAS_SATA_PM: