From patchwork Fri Apr 12 08:57:54 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 162098 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp364750jan; Fri, 12 Apr 2019 01:58:33 -0700 (PDT) X-Google-Smtp-Source: APXvYqzRuWRrHbUMFX0R2sxEAzS5571vqjtrIDVCTBP+Ha/uo0ZJ8I7UIQ50IUtynnDh8uO3OfQ2 X-Received: by 2002:a17:902:7d81:: with SMTP id a1mr55591861plm.202.1555059513004; Fri, 12 Apr 2019 01:58:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555059513; cv=none; d=google.com; s=arc-20160816; b=R2CBQlgwcqNcEtacmB5H0p+zJEwFXE2rg3KK+Xq2w1ojGaxmn3mLXhjORZmhy+6Jux wQvvkBK48Nd/bHEjpHLxllqCBVNJEinUln3yDwREpdspeJvr3RnWHtQBEAXkeqh2wZO+ YkPz7FZkW100aEHz+XQt3CmT6CaGaH0RFQsRsWe2Jo/lzkJFtiXeq0hnvMpNhJzxNksf Dpo3CRaJgh7yJ+yIX8kyDMn/ciM3SR8m/mo4aBQCSaM8bFWshJc2aqtgMPboJx7kf/+c 0LGUCwX9Vm6qKlnjIdJq1Ymdq+3ivPPjdLSTxhp6GNmmazqUvm/K2pasF5sVUDcBQnSZ IMvQ== 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; bh=u/Ic1c8hJTP8D4SOGF5AwD29DWGLhJSRKbzzSB+BGxQ=; b=RKy3Ww4/lml1l/8EV1jSR1Evgo0MKG3iCEiWwGpfJAw1WCPPwJnLKYgAL1HnF/aKYA jxaCBxt879awEyxeh+XsSGbOjy4ScnYFAbYaNkmMEuv0k+valHcPEdqqwbJcN/S6d9nn +ECcMqgnyrN7hF2eh5a2a5AU7+5EzE6nqgUNno5KTf7QbPRg3bNTcrrNmCt3YFZKHCIc 7i0rFxSnQU7HTuG+m8Wfws8NJCWr7eNKkyP1J4SK1FboJCKAryYDK8a3RQjVyOOt5rVB udmpuoz7Sm2Xzd86mKZ+ypUpSczJITnGY5FESveDmKF6WEYEuY0xsFNBBa2C9eAg4UOA +VGg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-scsi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-scsi-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 b2si36052809pgt.494.2019.04.12.01.58.32; Fri, 12 Apr 2019 01:58:32 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-scsi-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-scsi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-scsi-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727497AbfDLI6b (ORCPT + 1 other); Fri, 12 Apr 2019 04:58:31 -0400 Received: from szxga05-in.huawei.com ([45.249.212.191]:6738 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727445AbfDLI63 (ORCPT ); Fri, 12 Apr 2019 04:58:29 -0400 Received: from DGGEMS405-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id C747261A9F825433AED7; Fri, 12 Apr 2019 16:58:24 +0800 (CST) Received: from localhost.localdomain (10.67.212.75) by DGGEMS405-HUB.china.huawei.com (10.3.19.205) with Microsoft SMTP Server id 14.3.408.0; Fri, 12 Apr 2019 16:58:15 +0800 From: John Garry To: , CC: , , , , , , John Garry Subject: [PATCH 3/6] scsi: libsas: Improve vague log in SAS rediscovery Date: Fri, 12 Apr 2019 16:57:54 +0800 Message-ID: <1555059478-36224-4-git-send-email-john.garry@huawei.com> X-Mailer: git-send-email 2.8.1 In-Reply-To: <1555059478-36224-1-git-send-email-john.garry@huawei.com> References: <1555059478-36224-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-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org When an expander PHY which was part of a wideport disconnects, we would see a log like this from sas_rediscover(): [ 39.695554] sas: phy20 part of wide port with phy16 Here, phy20 is the PHY that disconnected, and phy16 is the lowest indexed member PHY of the wideport. The log implies the phy20 is still part of the wideport with phy16, so is misleading or, at least, vague. Improve the logs in SAS rediscovery by removing this log and adding a log in sas_rediscover_dev() to tell what's really going on. While we're at it, also make the logs in sas_find_bcast_dev() more informative (and more consistent with the reset of the expander logs). Signed-off-by: John Garry --- drivers/scsi/libsas/sas_expander.c | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) -- 2.17.1 diff --git a/drivers/scsi/libsas/sas_expander.c b/drivers/scsi/libsas/sas_expander.c index dfdf3c94d326..6f569a65d791 100644 --- a/drivers/scsi/libsas/sas_expander.c +++ b/drivers/scsi/libsas/sas_expander.c @@ -1876,10 +1876,12 @@ static int sas_find_bcast_dev(struct domain_device *dev, if (phy_id != -1) { *src_dev = dev; ex->ex_change_count = ex_change_count; - pr_info("Expander phy change count has changed\n"); + pr_info("ex %016llx phy%d change count has changed\n", + SAS_ADDR(dev->sas_addr), phy_id); return res; } else - pr_info("Expander phys DID NOT change\n"); + pr_info("ex %016llx phys DID NOT change\n", + SAS_ADDR(dev->sas_addr)); } list_for_each_entry(ch, &ex->children, siblings) { if (ch->dev_type == SAS_EDGE_EXPANDER_DEVICE || ch->dev_type == SAS_FANOUT_EXPANDER_DEVICE) { @@ -2028,14 +2030,22 @@ static bool dev_type_flutter(enum sas_device_type new, enum sas_device_type old) return false; } -static int sas_rediscover_dev(struct domain_device *dev, int phy_id, bool last) +static int sas_rediscover_dev(struct domain_device *dev, int phy_id, + bool last, int sibling) { struct expander_device *ex = &dev->ex_dev; struct ex_phy *phy = &ex->ex_phy[phy_id]; enum sas_device_type type = SAS_PHY_UNUSED; u8 sas_addr[SAS_ADDR_SIZE]; + char msg[80] = ""; int res; + if (!last) + sprintf(msg, ", part of a wide port with phy%d", sibling); + + pr_debug("ex %016llx rediscovering phy%d%s\n", SAS_ADDR(dev->sas_addr), + phy_id, msg); + memset(sas_addr, 0, SAS_ADDR_SIZE); res = sas_get_phy_attached_dev(dev, phy_id, sas_addr, &type); switch (res) { @@ -2115,13 +2125,11 @@ static int sas_rediscover(struct domain_device *dev, const int phy_id) continue; if (SAS_ADDR(phy->attached_sas_addr) == SAS_ADDR(changed_phy->attached_sas_addr)) { - pr_debug("phy%d part of wide port with phy%d\n", - phy_id, i); last = false; break; } } - res = sas_rediscover_dev(dev, phy_id, last); + res = sas_rediscover_dev(dev, phy_id, last, i); } else res = sas_discover_new(dev, phy_id); return res;