Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp6892890imu; Thu, 31 Jan 2019 01:13:00 -0800 (PST) X-Google-Smtp-Source: ALg8bN6z6HsRAsLFIgVkyvstHYa2KgIIr2T7L9hRKmIe1CBWApNtitnZ/oeQhTT6mfR5VoTRih/Z X-Received: by 2002:a63:e156:: with SMTP id h22mr30819128pgk.255.1548925980193; Thu, 31 Jan 2019 01:13:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548925980; cv=none; d=google.com; s=arc-20160816; b=tY1I98cHJAaEC0UH1dh6pSbLmUc2JZzdWwz69WR+Da6S6m7EHlYPCwkpty0+/3sVoX bgHw5WmfVbmnNFVzjNhxmuBokTDmzFzu7EIsFBxo32XdRn2C3v8R+Qrc4r+g0Ox+gnwu uNBZKWScVjfKAU0KyLheTO3IuXjamagxTkDnp2/jRzgdOI8T4OGbIGyKLRfAth15qEi2 /OShQtUnAe6MIJd3w0kR3RJVA4GBVDckvIjv4V5L4h2eXSnD/2SWUumPmm2+QKMjQ/9x P2UegPIQ2LVVhSy2lsAV2EcLbSq0ZN8BcX7X9qlTr80j3itpKJdaVvzsHLFTf+B+6j74 Fx/g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:in-reply-to :mime-version:user-agent:date:message-id:from:cc:references:to :subject; bh=HhEff+auQ1qDpVtJNkVR3/pqNQB46NcxOlyvZKuuLK0=; b=POjEuiRAxQGs8y/zwNlUl/IyLhQWIOgfNippukMb+XGRz7jzu86F7IE9+NGt965hg/ Kx38hgu3xdAfwqZSHdRHU0i8hCDcro843QxgLKqV4x6TxczpdjnRXoPUgIWAgiTaNNz3 +uLyThnygyPEfbYLQgtJX8ybz4afUJk7msPOH+Q2BccZ/TXXPoibgmqjSftDtIlj0ufs Pcdyb900dMh5tjUWkCKaVqQin0AzffPLdus9KJNe+9QZxYWWKpAbt+Fp14YMYgkkQZMc d2102Uyp+FBwWF1OKKnrjQlwuqbjmPkWPQV5DA5CAJFPKAZ05wNrozGlHgj2p0ce7zdC nJKg== 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 f15si3907552plr.144.2019.01.31.01.12.44; Thu, 31 Jan 2019 01:13:00 -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 S1730191AbfAaJKr (ORCPT + 99 others); Thu, 31 Jan 2019 04:10:47 -0500 Received: from szxga07-in.huawei.com ([45.249.212.35]:32940 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726183AbfAaJKr (ORCPT ); Thu, 31 Jan 2019 04:10:47 -0500 Received: from DGGEMS411-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id 9A7FE94499B9AEA19806; Thu, 31 Jan 2019 17:10:44 +0800 (CST) Received: from [127.0.0.1] (10.202.226.43) by DGGEMS411-HUB.china.huawei.com (10.3.19.211) with Microsoft SMTP Server id 14.3.408.0; Thu, 31 Jan 2019 17:10:33 +0800 Subject: Re: [PATCH v2 6/7] scsi: libsas: reset the phy address if discover failed To: Jason Yan , , References: <20190130082412.9357-1-yanaijie@huawei.com> <20190130082412.9357-7-yanaijie@huawei.com> <5C5259B4.10005@huawei.com> CC: , , , , , , , , , , , , Xiaofei Tan , Ewan Milne , Tomas Henzl From: John Garry Message-ID: <8ca27632-bf8c-b8eb-bb56-00e04c559ac1@huawei.com> Date: Thu, 31 Jan 2019 09:10:24 +0000 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.3.0 MIME-Version: 1.0 In-Reply-To: <5C5259B4.10005@huawei.com> Content-Type: text/plain; charset="windows-1252"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [10.202.226.43] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 31/01/2019 02:13, Jason Yan wrote: > > > On 2019/1/31 1:36, John Garry wrote: >> On 30/01/2019 08:24, Jason Yan wrote: >>> When we failed to discover the device, the phy address is still kept /s/phy/PHY/ >>> in ex_phy. So when the next time we revalidate this phy the >>> address and device type is the same, it will be considered as flutter >>> and will not be discovered again. So the device will not be brought up. >>> >>> Fix this by reset the phy address to the initial value. Then >>> in the next revalidation the device will be discovered agian. >> >> Why fail to discover the device? I wonder in which scenario you have >> seen this, such that it is worth rediscovery. >> > > The test guys have seen this for several times, especially after LLDD > changed the logic of lldd_dev_found and may return error now. We're finding that a specific SATA disk stays in STP pending for some time and we fail the init in lldd dev found, like you say. However, I think that we should ensure that this passes, as with your change I find we get some looping of dev found and lost until it finally recovers. Regardless, I think that your change on its own is ok, so: Reviewed-by: John Garry > > >>> >>> Tested-by: Chen Liangfei >>> Signed-off-by: Jason Yan >>> CC: Xiaofei Tan >>> CC: John Garry >>> CC: Johannes Thumshirn >>> CC: Ewan Milne >>> CC: Christoph Hellwig >>> CC: Tomas Henzl >>> CC: Dan Williams >>> CC: Hannes Reinecke >>> --- >>> drivers/scsi/libsas/sas_expander.c | 7 +++++++ >>> 1 file changed, 7 insertions(+) >>> >>> diff --git a/drivers/scsi/libsas/sas_expander.c >>> b/drivers/scsi/libsas/sas_expander.c >>> index 6e56ebdc2148..e781941a7088 100644 >>> --- a/drivers/scsi/libsas/sas_expander.c >>> +++ b/drivers/scsi/libsas/sas_expander.c >>> @@ -1100,6 +1100,13 @@ static int sas_ex_discover_dev(struct >>> domain_device *dev, int phy_id) >>> i, SAS_ADDR(ex->ex_phy[i].attached_sas_addr)); >>> } >>> } >>> + } else { >>> + /* if we failed to discover this device, we have to >>> + * reset the expander phy attached address so that we >>> + * will not treat the phy as flutter in the next >>> + * revalidation >>> + */ >>> + memset(ex_phy->attached_sas_addr, 0, SAS_ADDR_SIZE); >>> } >>> >>> return res; >>> >> >> >> >> . >> > > > . >