Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp78606yba; Mon, 20 May 2019 05:19:54 -0700 (PDT) X-Google-Smtp-Source: APXvYqyzMXnRiHE1xonDTtk0xJRfxh6wMMIxxtjuYwqx0Y3tLwv1IWHwDPA9g1hA7W5Wdo2Nb0eM X-Received: by 2002:a17:902:bf07:: with SMTP id bi7mr37549660plb.248.1558354794031; Mon, 20 May 2019 05:19:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558354794; cv=none; d=google.com; s=arc-20160816; b=sDlefRidyUwo1SSLhECvx866Bw4wYXLjucp15SRiylZuRxhZ55LI8AbPhVl69oT7PE NIsnJTdiz8tuJHB20wXEb0Ni0XeCB3b7kTlmrIslJKSxx8JjMT8/VeWeW/XBxt7fmZjQ SyYQ40DyIzIQiB64qEBLetUlA97MNmumBqgKdT9QoZsEgKpbzOXIikKw948Rf8a1t5hf jSIlY0ie4zgYs1GspY6yRHgJBY2bSwIM6Ajr1zzqysMcI1LVGBov4DGm/TIncX8/BjzW NHSaLoAwtuQMwXdRztg6/pNsdipk7sGdQ4aBDybmmBxmV0AoF0jLCDz5nSwYLhUB0O8j YRbA== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=fdx5vPH997zah4he6k9D2vG+lX2dFPyIDsQNsgX246A=; b=E7B4L8hrZmZLi4P+IZco14BKFb1hLxFIjZnth9NHsDIyFpJwe8bRayKRjQ4dsm8n6p WH3JhiGTJuJDteI17fZYDYpfzGAhz54lBC8V0LInxhUaoMgZ5Fbr0eiPhmwNhYbB4hVG liDW9f88yyNxYk7iveR7uQCdkWqV3777Pz8XC5M6YOBEZiw/snXzAZh6qz/uBl8y1H4q 4UCE47+2rGperiS/RDr6IYpFotaNb+v8fpmnvkjduYXOuyCvUuGpRlTCKqAXkPfjf1cc ig7IMxkeGTq1MZvCptwVL4eVlvmrScEhEPryEZa5CAxSUDSDE/8o8A8+ZYjyF4yzZ07A +NhQ== 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 192si3833220pfu.177.2019.05.20.05.19.39; Mon, 20 May 2019 05:19:54 -0700 (PDT) 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 S1732473AbfETMG4 (ORCPT + 99 others); Mon, 20 May 2019 08:06:56 -0400 Received: from szxga05-in.huawei.com ([45.249.212.191]:8223 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1730534AbfETMGz (ORCPT ); Mon, 20 May 2019 08:06:55 -0400 Received: from DGGEMS407-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id 921034F4A39CAD7CB22B; Mon, 20 May 2019 20:06:51 +0800 (CST) Received: from [127.0.0.1] (10.177.96.203) by DGGEMS407-HUB.china.huawei.com (10.3.19.207) with Microsoft SMTP Server id 14.3.439.0; Mon, 20 May 2019 20:06:45 +0800 Subject: Re: [PATCH] scsi: libsas: no need to join wide port again in sas_ex_discover_dev() To: John Garry , , CC: , , , , , , , , , References: <20190518094057.18046-1-yanaijie@huawei.com> <1860c624-1216-bb84-7091-d41a4d43f244@huawei.com> From: Jason Yan Message-ID: <61b6d28d-7b5f-f078-c035-77e855fbe8bf@huawei.com> Date: Mon, 20 May 2019 20:06:43 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.5.0 MIME-Version: 1.0 In-Reply-To: <1860c624-1216-bb84-7091-d41a4d43f244@huawei.com> Content-Type: text/plain; charset="windows-1252"; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit X-Originating-IP: [10.177.96.203] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2019/5/20 18:54, John Garry wrote: > On 18/05/2019 10:40, Jason Yan wrote: >> Since we are processing events synchronously now, the second call of >> sas_ex_join_wide_port() in sas_ex_discover_dev() is not needed. There >> will be no races with other works in disco workqueue. So remove the >> second sas_ex_join_wide_port(). >> >> I did not change the return value of 'res' to error when discover failed >> because we need to continue to discover other phys if one phy discover >> failed. So let's keep that logic as before and just add a debug log to >> detect the failure. >> >> Signed-off-by: Jason Yan >> --- >> ?drivers/scsi/libsas/sas_expander.c | 24 +++--------------------- >> ?1 file changed, 3 insertions(+), 21 deletions(-) >> >> diff --git a/drivers/scsi/libsas/sas_expander.c >> b/drivers/scsi/libsas/sas_expander.c >> index 83f2fd70ce76..8f90dd497dfe 100644 >> --- a/drivers/scsi/libsas/sas_expander.c >> +++ b/drivers/scsi/libsas/sas_expander.c >> @@ -1116,27 +1116,9 @@ static int sas_ex_discover_dev(struct >> domain_device *dev, int phy_id) >> ???????? break; >> ???? } >> >> -??? if (child) { >> -??????? int i; >> - >> -??????? for (i = 0; i < ex->num_phys; i++) { >> -??????????? if (ex->ex_phy[i].phy_state == PHY_VACANT || >> -??????????????? ex->ex_phy[i].phy_state == PHY_NOT_PRESENT) >> -??????????????? continue; >> -??????????? /* >> -???????????? * Due to races, the phy might not get added to the >> -???????????? * wide port, so we add the phy to the wide port here. >> -???????????? */ >> -??????????? if (SAS_ADDR(ex->ex_phy[i].attached_sas_addr) == >> -??????????????? SAS_ADDR(child->sas_addr)) { >> -??????????????? ex->ex_phy[i].phy_state= PHY_DEVICE_DISCOVERED; >> -??????????????? if (sas_ex_join_wide_port(dev, i)) >> -??????????????????? pr_debug("Attaching ex phy%02d to wide port >> %016llx\n", >> -???????????????????????? i, SAS_ADDR(ex->ex_phy[i].attached_sas_addr)); >> -??????????? } >> -??????? } >> -??? } > > This change looks ok. > >> - >> +??? if (!child) >> +??????? pr_debug("Ex %016llx phy%02d failed to discover\n", >> +???????????? SAS_ADDR(dev->sas_addr), phy_id); > > nit: > /s/Ex/ex/ OK. > > In case of "second fanout expander...", before this, we don't attempt to > discover, and just disable the PHY. In that case, is the log proper? > In that case the log is not proper. I think we can directly return in the case of "second fanout expander..."? Actually nothing to do after the phy is disabled. > And, if indeed proper, it would seem to merit a higher log level than > debug, maybe notice is better. > Yes, notice should be better. > >> ???? return res; >> ?} >> >> > > > > . >