Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp527859rwb; Tue, 27 Sep 2022 00:27:28 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4IB/SyDxRwkWye2NtrW9ET14KDH1QtgS/B8gZlUFGJs31PWplfDUoz37G9CMzGSaYjgvaU X-Received: by 2002:a05:6402:538a:b0:457:b602:d5a6 with SMTP id ew10-20020a056402538a00b00457b602d5a6mr1009177edb.371.1664263648679; Tue, 27 Sep 2022 00:27:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664263648; cv=none; d=google.com; s=arc-20160816; b=v1YSpGAGxs0+MN11zdAJKE5pCU90VkMEWyycdL8/LtWFgag7pI2Bdju63UR5KC09ve /DmGpug6s/gZPpp0EJQ9xrjJhJhN6+XUqVzF9tFM2G8cAFb34xeTOloAsj2X3als+Nxc Xd3au2vIcauylWraM6NuaywjjuMYBzi+SkmSU8mQw2XS1iMIj9VQ1O772IqIFJpp8t2C a8Ck1YDlDU80LAhwj8f9/+spbvGWIUn5YKEFIZqu6GGizQwX0YykZUWBeVNgivVe/y2E knPHExUz0BZMjVLgU59dhNu/g2fHxwNvclmt7Y/jGwZiTLh7Km2yBoa3sZH1thG1BwVQ dOXQ== 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=Ej7izSpBmuKGY2qnxCNTm6UzoSSvPHPgYQBf6tsrSsc=; b=JsEyp8EU9/drrZaiDDuXwspb0r+F6rBewgVd54mEvA4RZFtVrqKZflnZW917H5KngR tI4NlnGBhHEWeMK4Wf3zGrnhYXxQbnoUuAoijv+9qL85XgC2CncrhOLNguLxAcr3xiKY wWqxKuz6rr7JPp7YxBXlgNNpWyWinOUx/zeBrBJrRTB3BmNJSqTHz97xNhDZrv7fQARV sYGqwX1/uaC56UrlkJ5cC/Wo5OQlsL7qqV1M/sIEdMDQ5zEm0E9H8UNbxEKYRZhiq1MQ sjzciQcSIY9iJwHmObIfbhgkVdv/ikOPtgsjRAyI/Zfe5FfoCZtqlustleXJ66VJqQ7i wSXw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l11-20020a50cbcb000000b00456ea7cddbasi870018edi.114.2022.09.27.00.27.02; Tue, 27 Sep 2022 00:27:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230354AbiI0HMI (ORCPT + 99 others); Tue, 27 Sep 2022 03:12:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39698 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230271AbiI0HLp (ORCPT ); Tue, 27 Sep 2022 03:11:45 -0400 Received: from frasgout.his.huawei.com (frasgout.his.huawei.com [185.176.79.56]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4D421A7228; Tue, 27 Sep 2022 00:11:44 -0700 (PDT) Received: from fraeml705-chm.china.huawei.com (unknown [172.18.147.207]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4Mc9kY4ycZz67ykV; Tue, 27 Sep 2022 15:10:29 +0800 (CST) Received: from lhrpeml500003.china.huawei.com (7.191.162.67) by fraeml705-chm.china.huawei.com (10.206.15.54) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2375.31; Tue, 27 Sep 2022 09:11:41 +0200 Received: from localhost.localdomain (10.69.192.58) by lhrpeml500003.china.huawei.com (7.191.162.67) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Tue, 27 Sep 2022 08:11:38 +0100 From: John Garry To: , , , CC: , , , , , "John Garry" Subject: [PATCH v5 4/7] scsi: hisi_sas: Modify v3 HW SATA disk error state completion processing Date: Tue, 27 Sep 2022 15:04:55 +0800 Message-ID: <1664262298-239952-5-git-send-email-john.garry@huawei.com> X-Mailer: git-send-email 2.8.1 In-Reply-To: <1664262298-239952-1-git-send-email-john.garry@huawei.com> References: <1664262298-239952-1-git-send-email-john.garry@huawei.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.69.192.58] X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To lhrpeml500003.china.huawei.com (7.191.162.67) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Xingui Yang When an NCQ error occurs, the controller will abnormally complete the I/Os that are newly delivered to disk, and bit8 in CQ dw3 will be set which indicates that the SATA disk is in error state. The current processing flow is to set ts->stat to SAS_OPEN_REJECT and then sas_ata_task_done() will set FIS stat to ATA_ERR. After analyzing the IO by ata_eh_analyze_tf(), err_mask will set to AC_ERR_HSM. If media error occurs for four times within 10 minutes and the chip rejects new I/Os for four times, NCQ will be disabled due to excessive errors, which is undesirable. Therefore, use sas_task_abort() to handle abnormally completed I/Os when SATA disk is in error state, as these abnormally completed I/Os are already processed by sas_ata_device_link_abort() and qc->flag are set to ATA_QCFLAG_FAILED. If sas_task_abort() is used, qc->err_mask will not be modified in EH. Unlike the current process flow, it will not increase the count of ECAT_TOUT_HSM and not turn off NCQ. Like other I/Os on the disk that do not have an error but do not return after the NCQ error, they are retried after the EH. Signed-off-by: Xingui Yang Signed-off-by: John Garry --- drivers/scsi/hisi_sas/hisi_sas_v3_hw.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c b/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c index 4278d3482ebb..9d0a54043883 100644 --- a/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c +++ b/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c @@ -428,6 +428,8 @@ #define CMPLT_HDR_DEV_ID_OFF 16 #define CMPLT_HDR_DEV_ID_MSK (0xffff << CMPLT_HDR_DEV_ID_OFF) /* dw3 */ +#define SATA_DISK_IN_ERROR_STATUS_OFF 8 +#define SATA_DISK_IN_ERROR_STATUS_MSK (0x1 << SATA_DISK_IN_ERROR_STATUS_OFF) #define CMPLT_HDR_SATA_DISK_ERR_OFF 16 #define CMPLT_HDR_SATA_DISK_ERR_MSK (0x1 << CMPLT_HDR_SATA_DISK_ERR_OFF) #define CMPLT_HDR_IO_IN_TARGET_OFF 17 @@ -2219,7 +2221,8 @@ slot_err_v3_hw(struct hisi_hba *hisi_hba, struct sas_task *task, } else if (dma_rx_err_type & RX_DATA_LEN_UNDERFLOW_MSK) { ts->residual = trans_tx_fail_type; ts->stat = SAS_DATA_UNDERRUN; - } else if (dw3 & CMPLT_HDR_IO_IN_TARGET_MSK) { + } else if ((dw3 & CMPLT_HDR_IO_IN_TARGET_MSK) || + (dw3 & SATA_DISK_IN_ERROR_STATUS_MSK)) { ts->stat = SAS_PHY_DOWN; slot->abort = 1; } else { -- 2.35.3