From patchwork Tue Aug 24 10:00:56 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 501798 Delivered-To: patch@linaro.org Received: by 2002:a02:6f15:0:0:0:0:0 with SMTP id x21csp2993860jab; Tue, 24 Aug 2021 03:06:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx85sRlIoAyxyAs3fM2iZIXOkg4BM4U3rp5i1wANH5o5yZMeMIgLD6WkONo0Ietibo6+Kkz X-Received: by 2002:a05:6638:29a:: with SMTP id c26mr33701167jaq.58.1629799560256; Tue, 24 Aug 2021 03:06:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629799560; cv=none; d=google.com; s=arc-20160816; b=Ju5xUbGfjmC+oK14ipcvMu8fvxdFtm7ahWsC83ssLrPLYL5+g9aN4iHl7JB/S795O2 GKMq6GxoYKC1g8Ymuz7GQ2f0E2JGeKckdwiuwyFU9ZFJOFvpGUV4MqFEGa45jKoBpzT+ HEC5YQf84MtbaCGPRADk+9wK11Y7kfXKtltF+pRteQY6P5RTHjigj/XDh2QUIGLpPSII WyoQCZR7xtMIEvOYMa/DGUDXmN/oPoinizLLZ8AixSgFUWyQyBD7XowLStJFSi5/xt8D Pev8oGOATxYeYrLf5crmrkoLZABSM+WWjDwREgZdh6HR85IJRJ96NfTn21ouEY0988lK 811w== 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=U8T0/+cXaIpV6zcqTlnHcwjVY7PbCKx63DZOTT11RQM=; b=CTkuQLhz2bP41ENEFyZkG4OOWtR/Qe0tOum0JZcDmeVhAKHVDCYZyK7HnZG860RPma e7zGPLsqXSrNQbfyzrIFfxTfqFJUiM3p3Vo37boezvF7cn9rOxkKX41McjoaLEqlm7a+ s/pXfcyhzy1gR8XaxcXVrPy2vc6Md0FyJpQhyKVZP5iSHdex/AEyY8/O5WEKmQMyO5QN 0XxBMeboI+5N1TFz+uGU89gZy2nEUsGzvhBWsDHsAwAeDyTM9Gv6TyNFYaDbRyg7a92d 1c8jp2MWXV4MZ2+/E+wCRHqQ/VIGJNPkptXmsodndshfVvF6usc/vh4gjtMmJj/uyyf2 IcQA== 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 y21si2919315jat.7.2021.08.24.03.06.00 for ; Tue, 24 Aug 2021 03:06:00 -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 S236059AbhHXKGk (ORCPT ); Tue, 24 Aug 2021 06:06:40 -0400 Received: from frasgout.his.huawei.com ([185.176.79.56]:3682 "EHLO frasgout.his.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236001AbhHXKGe (ORCPT ); Tue, 24 Aug 2021 06:06:34 -0400 Received: from fraeml702-chm.china.huawei.com (unknown [172.18.147.206]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4Gv4Th4Q14z67P4M; Tue, 24 Aug 2021 18:04:40 +0800 (CST) Received: from lhreml724-chm.china.huawei.com (10.201.108.75) by fraeml702-chm.china.huawei.com (10.206.15.51) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2308.8; Tue, 24 Aug 2021 12:05:49 +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.2308.8; Tue, 24 Aug 2021 11:05:47 +0100 From: John Garry To: , CC: , , , Xiang Chen , John Garry Subject: [PATCH 1/5] scsi: hisi_sas: Use managed PCI functions Date: Tue, 24 Aug 2021 18:00:56 +0800 Message-ID: <1629799260-120116-2-git-send-email-john.garry@huawei.com> X-Mailer: git-send-email 2.8.1 In-Reply-To: <1629799260-120116-1-git-send-email-john.garry@huawei.com> References: <1629799260-120116-1-git-send-email-john.garry@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.69.192.58] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) 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: Xiang Chen Use managed PCI functions such as pcim_enable_device() and pcim_iomap_regions() to simplify exception handling code. Signed-off-by: Xiang Chen Signed-off-by: John Garry --- drivers/scsi/hisi_sas/hisi_sas_v3_hw.c | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) -- 2.26.2 diff --git a/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c b/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c index 3ab669dc806f..e3be5743e77b 100644 --- a/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c +++ b/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c @@ -518,6 +518,8 @@ struct hisi_sas_err_record_v3 { #define CHNL_INT_STS_INT2_MSK BIT(3) #define CHNL_WIDTH 4 +#define BAR_NO_V3_HW 5 + enum { DSM_FUNC_ERR_HANDLE_MSI = 0, }; @@ -4676,15 +4678,15 @@ hisi_sas_v3_probe(struct pci_dev *pdev, const struct pci_device_id *id) struct sas_ha_struct *sha; int rc, phy_nr, port_nr, i; - rc = pci_enable_device(pdev); + rc = pcim_enable_device(pdev); if (rc) goto err_out; pci_set_master(pdev); - rc = pci_request_regions(pdev, DRV_NAME); + rc = pcim_iomap_regions(pdev, 1 << BAR_NO_V3_HW, DRV_NAME); if (rc) - goto err_out_disable_device; + goto err_out; rc = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64)); if (rc) @@ -4692,20 +4694,20 @@ hisi_sas_v3_probe(struct pci_dev *pdev, const struct pci_device_id *id) if (rc) { dev_err(dev, "No usable DMA addressing method\n"); rc = -ENODEV; - goto err_out_regions; + goto err_out; } shost = hisi_sas_shost_alloc_pci(pdev); if (!shost) { rc = -ENOMEM; - goto err_out_regions; + goto err_out; } sha = SHOST_TO_SAS_HA(shost); hisi_hba = shost_priv(shost); dev_set_drvdata(dev, sha); - hisi_hba->regs = pcim_iomap(pdev, 5, 0); + hisi_hba->regs = pcim_iomap_table(pdev)[BAR_NO_V3_HW]; if (!hisi_hba->regs) { dev_err(dev, "cannot map register\n"); rc = -ENOMEM; @@ -4799,10 +4801,6 @@ hisi_sas_v3_probe(struct pci_dev *pdev, const struct pci_device_id *id) err_out_ha: hisi_sas_free(hisi_hba); scsi_host_put(shost); -err_out_regions: - pci_release_regions(pdev); -err_out_disable_device: - pci_disable_device(pdev); err_out: return rc; } @@ -4840,8 +4838,6 @@ static void hisi_sas_v3_remove(struct pci_dev *pdev) sas_remove_host(sha->core.shost); hisi_sas_v3_destroy_irqs(pdev, hisi_hba); - pci_release_regions(pdev); - pci_disable_device(pdev); hisi_sas_free(hisi_hba); debugfs_exit_v3_hw(hisi_hba); scsi_host_put(shost); From patchwork Tue Aug 24 10:00:57 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 501799 Delivered-To: patch@linaro.org Received: by 2002:a02:6f15:0:0:0:0:0 with SMTP id x21csp2993930jab; Tue, 24 Aug 2021 03:06:05 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxr/x5FMeGqy9qr471ORw9CmPnTnRsA+5LcaYZoSiITBaQQtbfyFtv6kV9TWXvGx+qwg7aQ X-Received: by 2002:a05:6e02:1546:: with SMTP id j6mr25582319ilu.154.1629799565413; Tue, 24 Aug 2021 03:06:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629799565; cv=none; d=google.com; s=arc-20160816; b=TSFItXDeb9iiKuRBejE2PmaxWxPDimEeB+aTjs5PN15m4++QCBYhu3/Un3pHQWn44Y WsndqwMkpDEDzfcVeZgMWHwtrLYA+sytWomdHuJrB1/uNZYjq2Z2QPLqNEmf9NiYoS9z USBfnPYLY59KPIYk6r0/NWhoZ5/6J1xcxJ7hz75Yc/F5W7quEen5AZbgDE3SU+dIqEjk o2mbEI0kkzhFSawCXJ/SQIIaZe4Wf0SebqHQHDCDjD2Fme0juB2HB8K+3knaa9mOpBbe CDKR1MExn+LgWGl0uQoJGUqEjoYAWkxqBle+HRIigmULs8kga81DGW5+5+2ivTMX1jzb tLJA== 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=yZtZ9IhTXYxe4S9NaQJrxPkpIYdEFbkJOoa+RMuF5R8=; b=Cd4xVJ4rSfczBeeHbmQysAvzLAOMHI5dUxNMdzWDDCnV3V4nJ/mq8jNdUituY0MCOb ghR3C0Az9w+qJRIbGDKq6eyIJf6v028EQGD9bsILxDmH5B1NEAzMtOlNI/6hlQASH6Y8 lSf2tEfkzjFu+HCkgiuRuQ3bqXC0tk37FoVLnGDtaSp3DAZ5+sSIQ9xAseKMwZWs9+Zm Vg24DeHMJWxXI1OsUzhd+nMUZO7aFUsm2C8QoOTdtMklBO09qxKTeHEn+RmJ6glkjSpU D///UWK5wuUbL8AlsJjCzzb6YaitC+DsaClXdGH7BNQWmb74lv2ZY02YBEaxsaXovjtd VDFQ== 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 j12si13874034ils.66.2021.08.24.03.06.05 for ; Tue, 24 Aug 2021 03:06:05 -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 S236120AbhHXKGr (ORCPT ); Tue, 24 Aug 2021 06:06:47 -0400 Received: from frasgout.his.huawei.com ([185.176.79.56]:3683 "EHLO frasgout.his.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235963AbhHXKGg (ORCPT ); Tue, 24 Aug 2021 06:06:36 -0400 Received: from fraeml701-chm.china.huawei.com (unknown [172.18.147.207]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4Gv4Tk62g8z67X6t; Tue, 24 Aug 2021 18:04:42 +0800 (CST) Received: from lhreml724-chm.china.huawei.com (10.201.108.75) by fraeml701-chm.china.huawei.com (10.206.15.50) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2308.8; Tue, 24 Aug 2021 12:05:51 +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.2308.8; Tue, 24 Aug 2021 11:05:49 +0100 From: John Garry To: , CC: , , , John Garry Subject: [PATCH 2/5] scsi: hisi_sas: Remove print in v3 hw probe about #hw queues Date: Tue, 24 Aug 2021 18:00:57 +0800 Message-ID: <1629799260-120116-3-git-send-email-john.garry@huawei.com> X-Mailer: git-send-email 2.8.1 In-Reply-To: <1629799260-120116-1-git-send-email-john.garry@huawei.com> References: <1629799260-120116-1-git-send-email-john.garry@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.69.192.58] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) 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 The count of HW queues is available from sysfs, so remove the print in the v3 hw probe function. Signed-off-by: John Garry --- drivers/scsi/hisi_sas/hisi_sas_v3_hw.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.26.2 diff --git a/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c b/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c index e3be5743e77b..f57d9f488a42 100644 --- a/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c +++ b/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c @@ -4762,7 +4762,7 @@ hisi_sas_v3_probe(struct pci_dev *pdev, const struct pci_device_id *id) rc = interrupt_preinit_v3_hw(hisi_hba); if (rc) goto err_out_debugfs; - dev_err(dev, "%d hw queues\n", shost->nr_hw_queues); + rc = scsi_add_host(shost, dev); if (rc) goto err_out_free_irq_vectors; From patchwork Tue Aug 24 10:00:58 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 501800 Delivered-To: patch@linaro.org Received: by 2002:a02:6f15:0:0:0:0:0 with SMTP id x21csp2993970jab; Tue, 24 Aug 2021 03:06:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz8juhHe8R5RCyHsXfFct2UEr5uoMFTDHKW4tuEyd41yCd21F6YkEri+94aJv32pIxov2pE X-Received: by 2002:a92:c846:: with SMTP id b6mr17059534ilq.84.1629799569059; Tue, 24 Aug 2021 03:06:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629799569; cv=none; d=google.com; s=arc-20160816; b=NUeVg9P3rwzqls2Z5HgJM/dYS+XcvYy3Pbhd26Af/XxXXtzIqqI3DwUD65hpPxYUnI gzB9Er2ERMbFcv0/cEgxddpbz9EimCa3x8hfRYUnURQSxDmp1loXse9EUzPblJLVCKFA 4vYjpX4ebuA5NEzHgmDNuPwYWyOz1K2Z5p5L1iyHKDzVkDxlgcdBPic2pH0/AVid0Ulg 0b4r9h+kEczJnhkR91lg0p/06LD/yDKHRF99+d+TcgCv++vOzYpDlQwPIbV0jNOsSdbA 5WUMyeO4f6mkmMyx45si3tBv/3BfO3c4lPSrA/RatDh8RfZE2Ss+s1DG3NcLfM9seVGY Uy8A== 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=pDoTw8Pt5RjX88+2u29KR1pKzmJ5vNuTQXZlgjqRm28=; b=DoOrCDqNzlR0GW892cyzvMSxnVzy8Wr0x2M6CEHbdAQfCvAw2pGuRKZs0NQpeIBGjN eWHdL91FNCSPZg3/O1Q6IXxcdCM8XhMRdyRIa/Bcc+PBCUMsnhYh4hjXW0vHFuw4YPJc oI6Vou4MzdkVxTbqEKRmyAEAYtHciUXrj+clWGh+TwRUXEspsprlVlcFgfo48/1LnVQZ 9WJkFL7RdsqWRxlk4BVZx/gH7SIp1vki1N30YB8m0Hqy+A8M1WZ6cEa9rPNrDFZQbKLA 2xe4OCO1cblklRqCrb/mhY3LUJGBDI7FYo4/j4JzCkuNVDf/gxKiU7kq8PRjcYZBc+TF rqPQ== 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 v5si13300111ilg.86.2021.08.24.03.06.09 for ; Tue, 24 Aug 2021 03:06:09 -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 S236041AbhHXKGv (ORCPT ); Tue, 24 Aug 2021 06:06:51 -0400 Received: from frasgout.his.huawei.com ([185.176.79.56]:3684 "EHLO frasgout.his.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236033AbhHXKGj (ORCPT ); Tue, 24 Aug 2021 06:06:39 -0400 Received: from fraeml745-chm.china.huawei.com (unknown [172.18.147.201]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4Gv4Tf2NmMz67byN; Tue, 24 Aug 2021 18:04:38 +0800 (CST) Received: from lhreml724-chm.china.huawei.com (10.201.108.75) by fraeml745-chm.china.huawei.com (10.206.15.226) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.8; Tue, 24 Aug 2021 12:05:53 +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.2308.8; Tue, 24 Aug 2021 11:05:51 +0100 From: John Garry To: , CC: , , , Luo Jiaxing , John Garry Subject: [PATCH 3/5] scsi: hisi_sas: Rename HISI_SAS_{RESET -> RESETTING}_BIT Date: Tue, 24 Aug 2021 18:00:58 +0800 Message-ID: <1629799260-120116-4-git-send-email-john.garry@huawei.com> X-Mailer: git-send-email 2.8.1 In-Reply-To: <1629799260-120116-1-git-send-email-john.garry@huawei.com> References: <1629799260-120116-1-git-send-email-john.garry@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.69.192.58] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) 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 HISI_SAS_RESET_BIT means that the controller is being reset, and so the name is a bit vague. Rename it to HISI_SAS_RESETTING_BIT. Signed-off-by: Luo Jiaxing Signed-off-by: John Garry --- drivers/scsi/hisi_sas/hisi_sas.h | 2 +- drivers/scsi/hisi_sas/hisi_sas_main.c | 12 ++++++------ drivers/scsi/hisi_sas/hisi_sas_v1_hw.c | 2 +- drivers/scsi/hisi_sas/hisi_sas_v2_hw.c | 2 +- drivers/scsi/hisi_sas/hisi_sas_v3_hw.c | 10 +++++----- 5 files changed, 14 insertions(+), 14 deletions(-) -- 2.26.2 diff --git a/drivers/scsi/hisi_sas/hisi_sas.h b/drivers/scsi/hisi_sas/hisi_sas.h index 436d174f2194..57be32ba0109 100644 --- a/drivers/scsi/hisi_sas/hisi_sas.h +++ b/drivers/scsi/hisi_sas/hisi_sas.h @@ -35,7 +35,7 @@ #define HISI_SAS_QUEUE_SLOTS 4096 #define HISI_SAS_MAX_ITCT_ENTRIES 1024 #define HISI_SAS_MAX_DEVICES HISI_SAS_MAX_ITCT_ENTRIES -#define HISI_SAS_RESET_BIT 0 +#define HISI_SAS_RESETTING_BIT 0 #define HISI_SAS_REJECT_CMD_BIT 1 #define HISI_SAS_PM_BIT 2 #define HISI_SAS_HW_FAULT_BIT 3 diff --git a/drivers/scsi/hisi_sas/hisi_sas_main.c b/drivers/scsi/hisi_sas/hisi_sas_main.c index 9515c45affa5..fec4db46c76c 100644 --- a/drivers/scsi/hisi_sas/hisi_sas_main.c +++ b/drivers/scsi/hisi_sas/hisi_sas_main.c @@ -724,7 +724,7 @@ static int hisi_sas_init_device(struct domain_device *device) */ local_phy = sas_get_local_phy(device); if (!scsi_is_sas_phy_local(local_phy) && - !test_bit(HISI_SAS_RESET_BIT, &hisi_hba->flags)) { + !test_bit(HISI_SAS_RESETTING_BIT, &hisi_hba->flags)) { unsigned long deadline = ata_deadline(jiffies, 20000); struct sata_device *sata_dev = &device->sata_dev; struct ata_host *ata_host = sata_dev->ata_host; @@ -1072,7 +1072,7 @@ static void hisi_sas_dev_gone(struct domain_device *device) sas_dev->device_id, sas_dev->dev_type); down(&hisi_hba->sem); - if (!test_bit(HISI_SAS_RESET_BIT, &hisi_hba->flags)) { + if (!test_bit(HISI_SAS_RESETTING_BIT, &hisi_hba->flags)) { hisi_sas_internal_task_abort(hisi_hba, device, HISI_SAS_INT_ABT_DEV, 0, true); @@ -1576,7 +1576,7 @@ void hisi_sas_controller_reset_done(struct hisi_hba *hisi_hba) hisi_sas_reset_init_all_devices(hisi_hba); up(&hisi_hba->sem); scsi_unblock_requests(shost); - clear_bit(HISI_SAS_RESET_BIT, &hisi_hba->flags); + clear_bit(HISI_SAS_RESETTING_BIT, &hisi_hba->flags); hisi_sas_rescan_topology(hisi_hba, hisi_hba->phy_state); } @@ -1587,7 +1587,7 @@ static int hisi_sas_controller_prereset(struct hisi_hba *hisi_hba) if (!hisi_hba->hw->soft_reset) return -1; - if (test_and_set_bit(HISI_SAS_RESET_BIT, &hisi_hba->flags)) + if (test_and_set_bit(HISI_SAS_RESETTING_BIT, &hisi_hba->flags)) return -1; if (hisi_sas_debugfs_enable && hisi_hba->debugfs_itct[0].itct) @@ -1611,7 +1611,7 @@ static int hisi_sas_controller_reset(struct hisi_hba *hisi_hba) clear_bit(HISI_SAS_REJECT_CMD_BIT, &hisi_hba->flags); up(&hisi_hba->sem); scsi_unblock_requests(shost); - clear_bit(HISI_SAS_RESET_BIT, &hisi_hba->flags); + clear_bit(HISI_SAS_RESETTING_BIT, &hisi_hba->flags); return rc; } @@ -2251,7 +2251,7 @@ void hisi_sas_phy_down(struct hisi_hba *hisi_hba, int phy_no, int rdy, } else { struct hisi_sas_port *port = phy->port; - if (test_bit(HISI_SAS_RESET_BIT, &hisi_hba->flags) || + if (test_bit(HISI_SAS_RESETTING_BIT, &hisi_hba->flags) || phy->in_reset) { dev_info(dev, "ignore flutter phy%d down\n", phy_no); return; diff --git a/drivers/scsi/hisi_sas/hisi_sas_v1_hw.c b/drivers/scsi/hisi_sas/hisi_sas_v1_hw.c index afe639994f3d..862f4e8b7eb5 100644 --- a/drivers/scsi/hisi_sas/hisi_sas_v1_hw.c +++ b/drivers/scsi/hisi_sas/hisi_sas_v1_hw.c @@ -1422,7 +1422,7 @@ static irqreturn_t int_bcast_v1_hw(int irq, void *p) goto end; } - if (!test_bit(HISI_SAS_RESET_BIT, &hisi_hba->flags)) + if (!test_bit(HISI_SAS_RESETTING_BIT, &hisi_hba->flags)) sas_notify_port_event(sas_phy, PORTE_BROADCAST_RCVD, GFP_ATOMIC); diff --git a/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c b/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c index b0b2361e63fe..a5fc79b3f732 100644 --- a/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c +++ b/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c @@ -2824,7 +2824,7 @@ static void phy_bcast_v2_hw(int phy_no, struct hisi_hba *hisi_hba) hisi_sas_phy_write32(hisi_hba, phy_no, SL_RX_BCAST_CHK_MSK, 1); bcast_status = hisi_sas_phy_read32(hisi_hba, phy_no, RX_PRIMS_STATUS); if ((bcast_status & RX_BCAST_CHG_MSK) && - !test_bit(HISI_SAS_RESET_BIT, &hisi_hba->flags)) + !test_bit(HISI_SAS_RESETTING_BIT, &hisi_hba->flags)) sas_notify_port_event(sas_phy, PORTE_BROADCAST_RCVD, GFP_ATOMIC); hisi_sas_phy_write32(hisi_hba, phy_no, CHL_INT0, diff --git a/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c b/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c index f57d9f488a42..b137e5619da1 100644 --- a/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c +++ b/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c @@ -1617,7 +1617,7 @@ static irqreturn_t phy_bcast_v3_hw(int phy_no, struct hisi_hba *hisi_hba) hisi_sas_phy_write32(hisi_hba, phy_no, SL_RX_BCAST_CHK_MSK, 1); bcast_status = hisi_sas_phy_read32(hisi_hba, phy_no, RX_PRIMS_STATUS); if ((bcast_status & RX_BCAST_CHG_MSK) && - !test_bit(HISI_SAS_RESET_BIT, &hisi_hba->flags)) + !test_bit(HISI_SAS_RESETTING_BIT, &hisi_hba->flags)) sas_notify_port_event(sas_phy, PORTE_BROADCAST_RCVD, GFP_ATOMIC); hisi_sas_phy_write32(hisi_hba, phy_no, CHL_INT0, @@ -4851,7 +4851,7 @@ static void hisi_sas_reset_prepare_v3_hw(struct pci_dev *pdev) int rc; dev_info(dev, "FLR prepare\n"); - set_bit(HISI_SAS_RESET_BIT, &hisi_hba->flags); + set_bit(HISI_SAS_RESETTING_BIT, &hisi_hba->flags); hisi_sas_controller_reset_prepare(hisi_hba); rc = disable_host_v3_hw(hisi_hba); @@ -4897,7 +4897,7 @@ static int _suspend_v3_hw(struct device *device) return -ENODEV; } - if (test_and_set_bit(HISI_SAS_RESET_BIT, &hisi_hba->flags)) + if (test_and_set_bit(HISI_SAS_RESETTING_BIT, &hisi_hba->flags)) return -1; scsi_block_requests(shost); @@ -4908,7 +4908,7 @@ static int _suspend_v3_hw(struct device *device) if (rc) { dev_err(dev, "PM suspend: disable host failed rc=%d\n", rc); clear_bit(HISI_SAS_REJECT_CMD_BIT, &hisi_hba->flags); - clear_bit(HISI_SAS_RESET_BIT, &hisi_hba->flags); + clear_bit(HISI_SAS_RESETTING_BIT, &hisi_hba->flags); scsi_unblock_requests(shost); return rc; } @@ -4947,7 +4947,7 @@ static int _resume_v3_hw(struct device *device) } phys_init_v3_hw(hisi_hba); sas_resume_ha(sha); - clear_bit(HISI_SAS_RESET_BIT, &hisi_hba->flags); + clear_bit(HISI_SAS_RESETTING_BIT, &hisi_hba->flags); return 0; } From patchwork Tue Aug 24 10:00:59 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 501801 Delivered-To: patch@linaro.org Received: by 2002:a02:6f15:0:0:0:0:0 with SMTP id x21csp2993976jab; Tue, 24 Aug 2021 03:06:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzRdJcsxKjSS1Qt3H0YU7OMoWIo6SuGT+7dD/ZsuKvNM3MNhDoAGsVIgHFRnG2hEbiEtRxj X-Received: by 2002:a92:d646:: with SMTP id x6mr21842406ilp.280.1629799569865; Tue, 24 Aug 2021 03:06:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629799569; cv=none; d=google.com; s=arc-20160816; b=fMyedKDSOGpop3LT8M+K9hkdFlsIDAwJvf8sRnYtwRjgzdCZcNadId0s7tPGQnIcAQ voVKui5Cs1mH+xfENvDUkZ9Z0JqrnwbrOU7+nd3tVAR8f8ctTJIFVWlP4oxl0psrJLRT mr7FEtBF2fqsuHpaH1QcdhXOfMFd9IqYqHmYPo/BdG5tRk1N1K37KcRErneMeRbcAU2u lmwPoPGUNr3TLn35iUBVbQkHIdGJ1sEdONyzn7I+RjPb4XTscj6KsZOoqJQAPjYXsEUF eQ6NkeMemtRkbVD+3PjQrAVjs0ZuqrgPmYMiRCIxbw/iHT3o0+rOpB2nM23aCpY/TA1Q lujw== 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=rNThDFrxaK9LKPag9EeWIKghaJyQ4iux/kSVB7360Fs=; b=p78HCQbhqz0TKmpI5GfZCqdMMghNG7b/fsNdHZxTnFfcVA3mgEQmRVJOaTGMJGwPHO faJKT1tHbnm3e9C+KxjuOhPXJrKsdN+jRMRx6EfJXwRr9A2dy1gig6oLDb4Gjn/gD2a7 UgJGa5PMkkx3giod8bCexaocOX7tTaByKMj6Zhha7x1ahUtoYhotgAHx6xVZLbiGd/FY 3QRh5Sk6wv70bQEPREcbRqepVcsvige11whc2CXoOnUr+gKsTayDXGMpQSBCrOOTTF6v 7TgNkEzfxUHqk8xI+Jzw+a+1Ex3g3B5+i5tZwiz7XHOCJcNimc9mVKn+l64cHj54QZ+D WpMQ== 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 v5si13300111ilg.86.2021.08.24.03.06.09 for ; Tue, 24 Aug 2021 03:06:09 -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 S236056AbhHXKGw (ORCPT ); Tue, 24 Aug 2021 06:06:52 -0400 Received: from frasgout.his.huawei.com ([185.176.79.56]:3685 "EHLO frasgout.his.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236063AbhHXKGk (ORCPT ); Tue, 24 Aug 2021 06:06:40 -0400 Received: from fraeml744-chm.china.huawei.com (unknown [172.18.147.226]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4Gv4Th1qXWz6F96r; Tue, 24 Aug 2021 18:04:40 +0800 (CST) Received: from lhreml724-chm.china.huawei.com (10.201.108.75) by fraeml744-chm.china.huawei.com (10.206.15.225) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.8; Tue, 24 Aug 2021 12:05:55 +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.2308.8; Tue, 24 Aug 2021 11:05:53 +0100 From: John Garry To: , CC: , , , Xiang Chen , John Garry Subject: [PATCH 4/5] scsi: hisi_sas: Replace some del_timer() calls with del_timer_sync() Date: Tue, 24 Aug 2021 18:00:59 +0800 Message-ID: <1629799260-120116-5-git-send-email-john.garry@huawei.com> X-Mailer: git-send-email 2.8.1 In-Reply-To: <1629799260-120116-1-git-send-email-john.garry@huawei.com> References: <1629799260-120116-1-git-send-email-john.garry@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.69.192.58] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) 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: Xiang Chen Some usage of del_timer() in the driver is potentially unsafe. For when running the sas_task->slow_task timer in hisi_sas_exec_internal_tmf_task(), execution may be blocked in function hisi_sas_task_exec(); so it is possible that the timer is running when the callback to disable the timer is running. This could be dangerous, as we immediately release resources which the timer callback uses after disabling the timer. The same situation may be found at other sites, such as _hisi_sas_internal_task_abort(). So change calls to del_timer() to del_timer_sync() as necessary, to ensure any timer has finished when disabling. Also remove calls to timer_pending() prior to del_timer() as it is not necessary. Signed-off-by: Xiang Chen Signed-off-by: John Garry --- drivers/scsi/hisi_sas/hisi_sas_main.c | 12 +++++------- drivers/scsi/hisi_sas/hisi_sas_v2_hw.c | 6 +++--- drivers/scsi/hisi_sas/hisi_sas_v3_hw.c | 3 +-- 3 files changed, 9 insertions(+), 12 deletions(-) -- 2.26.2 diff --git a/drivers/scsi/hisi_sas/hisi_sas_main.c b/drivers/scsi/hisi_sas/hisi_sas_main.c index fec4db46c76c..bb1c8ef3a76f 100644 --- a/drivers/scsi/hisi_sas/hisi_sas_main.c +++ b/drivers/scsi/hisi_sas/hisi_sas_main.c @@ -1171,7 +1171,7 @@ static int hisi_sas_control_phy(struct asd_sas_phy *sas_phy, enum phy_func func, static void hisi_sas_task_done(struct sas_task *task) { - del_timer(&task->slow_task->timer); + del_timer_sync(&task->slow_task->timer); complete(&task->slow_task->completion); } @@ -1229,7 +1229,7 @@ static int hisi_sas_exec_internal_tmf_task(struct domain_device *device, res = hisi_sas_task_exec(task, GFP_KERNEL, 1, tmf); if (res) { - del_timer(&task->slow_task->timer); + del_timer_sync(&task->slow_task->timer); dev_err(dev, "abort tmf: executing internal task failed: %d\n", res); goto ex_err; @@ -1554,8 +1554,7 @@ void hisi_sas_controller_reset_prepare(struct hisi_hba *hisi_hba) scsi_block_requests(shost); hisi_hba->hw->wait_cmds_complete_timeout(hisi_hba, 100, 5000); - if (timer_pending(&hisi_hba->timer)) - del_timer_sync(&hisi_hba->timer); + del_timer_sync(&hisi_hba->timer); set_bit(HISI_SAS_REJECT_CMD_BIT, &hisi_hba->flags); } @@ -2097,7 +2096,7 @@ _hisi_sas_internal_task_abort(struct hisi_hba *hisi_hba, res = hisi_sas_internal_abort_task_exec(hisi_hba, sas_dev->device_id, task, abort_flag, tag, dq); if (res) { - del_timer(&task->slow_task->timer); + del_timer_sync(&task->slow_task->timer); dev_err(dev, "internal task abort: executing internal task failed: %d\n", res); goto exit; @@ -2769,8 +2768,7 @@ int hisi_sas_remove(struct platform_device *pdev) struct hisi_hba *hisi_hba = sha->lldd_ha; struct Scsi_Host *shost = sha->core.shost; - if (timer_pending(&hisi_hba->timer)) - del_timer(&hisi_hba->timer); + del_timer_sync(&hisi_hba->timer); sas_unregister_ha(sha); sas_remove_host(sha->core.shost); diff --git a/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c b/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c index a5fc79b3f732..236cf65c2f97 100644 --- a/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c +++ b/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c @@ -2368,18 +2368,18 @@ static void slot_complete_v2_hw(struct hisi_hba *hisi_hba, case STAT_IO_COMPLETE: /* internal abort command complete */ ts->stat = TMF_RESP_FUNC_SUCC; - del_timer(&slot->internal_abort_timer); + del_timer_sync(&slot->internal_abort_timer); goto out; case STAT_IO_NO_DEVICE: ts->stat = TMF_RESP_FUNC_COMPLETE; - del_timer(&slot->internal_abort_timer); + del_timer_sync(&slot->internal_abort_timer); goto out; case STAT_IO_NOT_VALID: /* abort single io, controller don't find * the io need to abort */ ts->stat = TMF_RESP_FUNC_FAILED; - del_timer(&slot->internal_abort_timer); + del_timer_sync(&slot->internal_abort_timer); goto out; default: break; diff --git a/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c b/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c index b137e5619da1..cbc6c2d86745 100644 --- a/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c +++ b/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c @@ -4830,8 +4830,7 @@ static void hisi_sas_v3_remove(struct pci_dev *pdev) struct Scsi_Host *shost = sha->core.shost; pm_runtime_get_noresume(dev); - if (timer_pending(&hisi_hba->timer)) - del_timer(&hisi_hba->timer); + del_timer_sync(&hisi_hba->timer); sas_unregister_ha(sha); flush_workqueue(hisi_hba->wq); From patchwork Tue Aug 24 10:01:00 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 501802 Delivered-To: patch@linaro.org Received: by 2002:a02:6f15:0:0:0:0:0 with SMTP id x21csp2993983jab; Tue, 24 Aug 2021 03:06:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyU9qQ9ncnRzhs/WJZEp1gDjYW2gvs3ZsLv2fb7zFBAEUPndiJUj34k7C/PSzBZ8IKFywxN X-Received: by 2002:a92:da0c:: with SMTP id z12mr25883415ilm.205.1629799570547; Tue, 24 Aug 2021 03:06:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629799570; cv=none; d=google.com; s=arc-20160816; b=FA45cS54dNuVfeF6qS+gOSKoQGNfZ/TyoB0KynZhqRnIPnitbSba1s8qZJEvDJUttN JZrjcYLRPDAolxKPoasALLNrQ2dq84kyX7lNXvEK4Eier3h94tpkZ2bCFJKDBc+yK1Iz Slk5BQgL3PBevCO7t/VrQPH5/x432FK3D4VGig9XRu0ZMG8tfKipaGqiu5zSDipKguFk VTwW4dZ/9WhKz8wdMF6fPcSVB9Wlm0FwTkJNEXE3aATe8SGLIPSSLvF/7ZApNgS3p629 wwPGka2nAntIbRF04Gdm75soPK8oyU6dfDxQ/R3b/9CvGeHzCi7ejkKDJ9qUg1+TZ2aY YWSg== 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=miMAW8yvGAShIiN25MckWUYK6tVzwixUIXdc86Z4plY=; b=fAsibY3l/DKpH2glkH4aZLRi6YR/d57DDDRD3ifvKQ0MV3jCbUQV/w308SGQHIgj0k 6J/eSJhQFz0dGqMlBprHPIjQEW5jdshFBJPXv0FahXKDlbpDJeSEqEjOXPLW7uaLe7dZ XYgt/53qpzRykDXStPyJ3/AfcRZtiqzhjSvLcC0AOn6Y1fsKfU7rw8yol50H+Yh5hXlB uEz3oJJRoVvllFOsNl4KyTLAtzWXy2Vy+EzEoCbdE0eObxd93L/pRT35PYJXhCE9xNg+ bZg2ju5M5u80+1WL7GmUK70qupjYDHd10C/9uXp9W6AzdThioicFba0aGuoqQV2c9dHQ VC+g== 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 v5si13300111ilg.86.2021.08.24.03.06.10 for ; Tue, 24 Aug 2021 03:06:10 -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 S236204AbhHXKGx (ORCPT ); Tue, 24 Aug 2021 06:06:53 -0400 Received: from frasgout.his.huawei.com ([185.176.79.56]:3686 "EHLO frasgout.his.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236068AbhHXKGm (ORCPT ); Tue, 24 Aug 2021 06:06:42 -0400 Received: from fraeml743-chm.china.huawei.com (unknown [172.18.147.206]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4Gv4Tj03klz67Mm9; Tue, 24 Aug 2021 18:04:41 +0800 (CST) Received: from lhreml724-chm.china.huawei.com (10.201.108.75) by fraeml743-chm.china.huawei.com (10.206.15.224) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.8; Tue, 24 Aug 2021 12:05:57 +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.2308.8; Tue, 24 Aug 2021 11:05:55 +0100 From: John Garry To: , CC: , , , Luo Jiaxing , John Garry Subject: [PATCH 5/5] scsi: hisi_sas: Increase debugfs_dump_index after dump is completed Date: Tue, 24 Aug 2021 18:01:00 +0800 Message-ID: <1629799260-120116-6-git-send-email-john.garry@huawei.com> X-Mailer: git-send-email 2.8.1 In-Reply-To: <1629799260-120116-1-git-send-email-john.garry@huawei.com> References: <1629799260-120116-1-git-send-email-john.garry@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.69.192.58] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) 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 The hisi_hba debugfs_dump_index member should increased after a dump insertion completed, and not before it has started, so fix the code to do so. Signed-off-by: Luo Jiaxing Signed-off-by: John Garry --- drivers/scsi/hisi_sas/hisi_sas_v3_hw.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.26.2 diff --git a/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c b/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c index cbc6c2d86745..f4517f3eb922 100644 --- a/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c +++ b/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c @@ -3688,7 +3688,6 @@ static void debugfs_snapshot_regs_v3_hw(struct hisi_hba *hisi_hba) do_div(timestamp, NSEC_PER_MSEC); hisi_hba->debugfs_timestamp[debugfs_dump_index] = timestamp; - hisi_hba->debugfs_dump_index++; debugfs_snapshot_prepare_v3_hw(hisi_hba); @@ -3704,6 +3703,7 @@ static void debugfs_snapshot_regs_v3_hw(struct hisi_hba *hisi_hba) debugfs_create_files_v3_hw(hisi_hba); debugfs_snapshot_restore_v3_hw(hisi_hba); + hisi_hba->debugfs_dump_index++; } static ssize_t debugfs_trigger_dump_v3_hw_write(struct file *file,