Received: by 2002:a05:6358:bb9e:b0:b9:5105:a5b4 with SMTP id df30csp3043071rwb; Mon, 5 Sep 2022 05:44:11 -0700 (PDT) X-Google-Smtp-Source: AA6agR5R9c5MQQiTo5riGZwg/C4pngySXTW8uUQ4gaVTIha6UlJFJFdf4q7809BU8dcIiQVAoOEj X-Received: by 2002:a65:6d0f:0:b0:42b:42f8:efe0 with SMTP id bf15-20020a656d0f000000b0042b42f8efe0mr42972658pgb.197.1662381850927; Mon, 05 Sep 2022 05:44:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662381850; cv=none; d=google.com; s=arc-20160816; b=j+Up7dWYjMOGgjD1+hGSESo44HXHr+JbBfmc03FBl8RSP0KTPHrEnHgvFy0UADn+S2 DXlUGdA6zN8iBnutalb5jOLXtxTm8bnWw8KVwXt82zyRA7i+VAsX51e/uFf4PVbQEbDa fmwAuel2+eOxWXxVjF1OoLiVH1Iu0LJRN9Cfd0v7xy3ZR8ij/+a6KF5LYHkexgDeL28H sJ/Tji1wsXrl14uujxZWD2gO1q63CTY2ufEfjjeGB72Ystr8i2WECWqMREAzKa2HIIMn R55KTx7CzAkyJKEUXs6xJvqppJGjPiiZgL57sI/E26K9yLywH5Vhmt5JIAx70xRK/sKY WYQA== 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=9Acuy/dPVoMkd6GEGph5nak8h0682x/Yr3jzpW+rgTQ=; b=SjCKmLyvwiXNwvnw6GeT4d6Li++CZJmbqjZrzSHUMKRbdOQw71HXbxTWS8aQ5jpg1k r9JuTVqEyYFRj66IvBJeZ5MS08LGUYdpawkzxBgtWnSqAmj0mJyxc1DjM9aCOCngZCKj ohfV3MvJDUl4T6xY4h25s5Ke17nPNfAS1TL1THMaaaQk2F35DZUO3C8AgEBjVJvdnkYW teWx41RKMtV8Vt4Dk+7e/UgMqo4xybYelOkt2n5vFi7BZo9GC6lFkH4G4xmw/c6f7vmc 5ddm/62xbc2UJYnn1BjofOZCasliqpwmsnrmFixGxnoi5ME/CzvE1UL/6aLyzbhE5/aq oP0Q== 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 k1-20020a636f01000000b0042b804ca112si10992641pgc.785.2022.09.05.05.43.59; Mon, 05 Sep 2022 05:44:10 -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 S238278AbiIEL4C (ORCPT + 99 others); Mon, 5 Sep 2022 07:56:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47294 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237449AbiIELzo (ORCPT ); Mon, 5 Sep 2022 07:55:44 -0400 Received: from frasgout.his.huawei.com (frasgout.his.huawei.com [185.176.79.56]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3C29643622; Mon, 5 Sep 2022 04:55:35 -0700 (PDT) Received: from fraeml712-chm.china.huawei.com (unknown [172.18.147.206]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4MLn12564fz68B7b; Mon, 5 Sep 2022 19:51:34 +0800 (CST) Received: from lhrpeml500003.china.huawei.com (7.191.162.67) by fraeml712-chm.china.huawei.com (10.206.15.61) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Mon, 5 Sep 2022 13:55:33 +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; Mon, 5 Sep 2022 12:55:25 +0100 From: John Garry To: , CC: , , , John Garry Subject: [PATCH 3/5] scsi: hisi_sas: Drain bcast events in hisi_sas_rescan_topology() Date: Mon, 5 Sep 2022 19:48:47 +0800 Message-ID: <1662378529-101489-4-git-send-email-john.garry@huawei.com> X-Mailer: git-send-email 2.8.1 In-Reply-To: <1662378529-101489-1-git-send-email-john.garry@huawei.com> References: <1662378529-101489-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: dggems705-chm.china.huawei.com (10.3.19.182) 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,T_SCC_BODY_TEXT_LINE 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 In resetting the controller, SATA devices may be lost. The issue is that when we insert the bcast events to rescan the topology in hisi_sas_rescan_topology(), when we subsequently nexus reset the SATA devices in hisi_sas_async_I_T_nexus_reset(), there is a small timing window in which the remote phy is down and we process the bcast event (meaning that libsas judges that the disk is lost). Ensure that all bcast events are processed prior to the nexus reset to close this window. Signed-off-by: John Garry --- drivers/scsi/hisi_sas/hisi_sas_main.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/scsi/hisi_sas/hisi_sas_main.c b/drivers/scsi/hisi_sas/hisi_sas_main.c index a33d46a5d7cd..2edadd4008c0 100644 --- a/drivers/scsi/hisi_sas/hisi_sas_main.c +++ b/drivers/scsi/hisi_sas/hisi_sas_main.c @@ -1341,6 +1341,7 @@ static void hisi_sas_refresh_port_id(struct hisi_hba *hisi_hba) static void hisi_sas_rescan_topology(struct hisi_hba *hisi_hba, u32 state) { + struct sas_ha_struct *sas_ha = &hisi_hba->sha; struct asd_sas_port *_sas_port = NULL; int phy_no; @@ -1369,6 +1370,12 @@ static void hisi_sas_rescan_topology(struct hisi_hba *hisi_hba, u32 state) hisi_sas_phy_down(hisi_hba, phy_no, 0, GFP_KERNEL); } } + /* + * Ensure any bcast events are processed prior to calling async nexus + * reset calls from hisi_sas_clear_nexus_ha() -> + * hisi_sas_async_I_T_nexus_reset() + */ + sas_drain_work(sas_ha); } static void hisi_sas_reset_init_all_devices(struct hisi_hba *hisi_hba) -- 2.35.3