From patchwork Fri Dec 8 17:16:36 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 121204 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp865573qgn; Fri, 8 Dec 2017 08:33:21 -0800 (PST) X-Google-Smtp-Source: AGs4zMbN+wqksuyhL/s2p+j1uzbtRAQITrwYkyAm56iAvXS3Fo9ede2IpLXMS7SFLXYt783WHFfP X-Received: by 10.99.119.134 with SMTP id s128mr30184708pgc.409.1512750801653; Fri, 08 Dec 2017 08:33:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1512750801; cv=none; d=google.com; s=arc-20160816; b=PV0DahgDfN5+QoyEAYEw2CQYkK9xw/1ix09lg46yjnrlzbBnSxBQCcY2Gr3YQqvDzL 4m3h4BfJ/3rDtbr7SmD7XPCZ1WsFZ9RLHe8DfXnQYKnql/JrCbWkJ58QZByaxgocZmO2 iVpIsO+xEmpsI9GogmcyJ+Kgsg/B6iyWutYCLdYaVU99R20Cbn0aRSa4SXCIL2659RYc Cd2xek1khFeimtlPskSTQUXRhTTEPqMNLm3Pu1dpI1GqwqZeSBkFNYoLzO24eudGNXQW y0Zyzec9fMoJSjmMkGix5TMAvCL7oLvRJEYeR92d4Y4AEzqH75IWjrIOFC9oxkAqLRXd 81Pg== 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=GkB8syUwn++SLEKoYPGX63+mA+AHvppsg02czwfIKnk=; b=sXMu40EiJX6lgardFJY3V8ExLK0Oopogt3PSFheVho70Y/9vVGGj8cRNcQjqZj8Kzv p6Rpa8w5WbjZpX6aFjxerNqgSgehdiJuexKw0g2FCSZaNLJrZJY2/uK5f1wDNKEsbj2e gnEHss+uVjai1HQTAG8zqiQynHgiBX735ibu4CnAuwmKD0Uj4uYJecqCPw19PBpaTC47 c5BxBUH2gYSr1Vxq3BE95Uj0qQl/YluUcv82cimHYtHe1avTYI1aGpVzH/4Z2uOJtcfc 2rhGtUvVWV980/YMvBZ0GrSeTZ7c716R6h18F/9PbSoorz0ife2A3o3/prVflLboXSiD OYhg== 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 3si5769485pgi.649.2017.12.08.08.33.20; Fri, 08 Dec 2017 08:33:21 -0800 (PST) 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 S1754602AbdLHQbK (ORCPT + 18 others); Fri, 8 Dec 2017 11:31:10 -0500 Received: from szxga04-in.huawei.com ([45.249.212.190]:2228 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753210AbdLHQbD (ORCPT ); Fri, 8 Dec 2017 11:31:03 -0500 Received: from DGGEMS407-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id B1C0632AD07B0; Sat, 9 Dec 2017 00:30:44 +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.361.1; Sat, 9 Dec 2017 00:30:37 +0800 From: John Garry To: , CC: , , , Xiaofei Tan , "John Garry" Subject: [PATCH 05/19] scsi: hisi_sas: some optimizations of host controller reset Date: Sat, 9 Dec 2017 01:16:36 +0800 Message-ID: <1512753410-50924-6-git-send-email-john.garry@huawei.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1512753410-50924-1-git-send-email-john.garry@huawei.com> References: <1512753410-50924-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 This patch do following optimizations to host controller reset: 1. Unblock scsi requests before rescanning topology, as SCSI command need be used if new device is found during rescanning topology. 2. Remove drain_workqueue(hisi_hba->wq) and drain_workqueue(shost->work_q), as there is no need to ensure that all PHYs event are done before exiting host reset. 3. Improve message print level of host reset. Host reset is an important and very few occurrence event. We should know its progress even when not debugging. Signed-off-by: Xiaofei Tan Signed-off-by: John Garry --- drivers/scsi/hisi_sas/hisi_sas_main.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 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 326ecb2..64d51a8 100644 --- a/drivers/scsi/hisi_sas/hisi_sas_main.c +++ b/drivers/scsi/hisi_sas/hisi_sas_main.c @@ -1061,8 +1061,6 @@ static void hisi_sas_rescan_topology(struct hisi_hba *hisi_hba, u32 old_state, hisi_sas_phy_down(hisi_hba, phy_no, 0); } - - drain_workqueue(hisi_hba->shost->work_q); } static int hisi_sas_controller_reset(struct hisi_hba *hisi_hba) @@ -1079,7 +1077,7 @@ static int hisi_sas_controller_reset(struct hisi_hba *hisi_hba) if (test_and_set_bit(HISI_SAS_RESET_BIT, &hisi_hba->flags)) return -1; - dev_dbg(dev, "controller resetting...\n"); + dev_info(dev, "controller resetting...\n"); old_state = hisi_hba->hw->get_phys_state(hisi_hba); scsi_block_requests(shost); @@ -1088,6 +1086,7 @@ static int hisi_sas_controller_reset(struct hisi_hba *hisi_hba) if (rc) { dev_warn(dev, "controller reset failed (%d)\n", rc); clear_bit(HISI_SAS_REJECT_CMD_BIT, &hisi_hba->flags); + scsi_unblock_requests(shost); goto out; } spin_lock_irqsave(&hisi_hba->lock, flags); @@ -1100,15 +1099,13 @@ static int hisi_sas_controller_reset(struct hisi_hba *hisi_hba) hisi_hba->hw->phys_init(hisi_hba); msleep(1000); hisi_sas_refresh_port_id(hisi_hba); - drain_workqueue(hisi_hba->wq); - drain_workqueue(shost->work_q); + scsi_unblock_requests(shost); state = hisi_hba->hw->get_phys_state(hisi_hba); hisi_sas_rescan_topology(hisi_hba, old_state, state); - dev_dbg(dev, "controller reset complete\n"); + dev_info(dev, "controller reset complete\n"); out: - scsi_unblock_requests(shost); clear_bit(HISI_SAS_RESET_BIT, &hisi_hba->flags); return rc;