Received: by 2002:a05:7412:b130:b0:e2:908c:2ebd with SMTP id az48csp378184rdb; Fri, 17 Nov 2023 01:05:31 -0800 (PST) X-Google-Smtp-Source: AGHT+IElE19hcValRzNQS09RS9l26ylUoYLVUf6HdAgUD1AdOijzey9/UWHfCTq+NPDm1fHkI1Yx X-Received: by 2002:a17:90b:3b8d:b0:283:3f5f:b29b with SMTP id pc13-20020a17090b3b8d00b002833f5fb29bmr16182081pjb.27.1700211931489; Fri, 17 Nov 2023 01:05:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700211931; cv=none; d=google.com; s=arc-20160816; b=IcDcFSoqR56LDgZGaHAwWpMdtd1nXH96JcAZico9PrfzPc5TOqe2LplbBw/FYyzDzn MHhigqwH5gvaU/upgX6BgYUWXvrptxfcbYB7Wru+i/jNmcYgadQkRW9WjfjWaMdExBZK NZzxQjTYt3RBLQL9BtCoMQTUsxsIcLpPn/wcKKqiBANiuc3vg0QW0lwirUiRS/NDFbYa d4RCwCXL/149370nOlj/lS+MDJf0DYDKwqQLdrFQPgAAVtVFTO/1u8+p8419XGlpF8AI o+FaeYRForC3C7PUrAW7REI8kDxenKGIyeWNmlGPl9VMDziCxIv2QZyFDvKYdq3tEGQL EUCA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id; bh=cjLtcScJpDJCPGYm81vI9M51uOumo3mQkLv44RQbzgY=; fh=FMUtMVcC97y9iqAdjmGS6ZYlnJVKN4YLZDGNjnXxe0A=; b=J9asvl/wtCZUXpOSQWCc6RxjF5RNdEvhRBklq9DzWeEC/X9nNUS1LACE4xTWTglppQ m2pZwGH1ijeKhZ4AJB+XMZ3x0kx02NNc/HsSeVt3uSwMKNhQP20lm8qjmb1YA3CosIss zRx26IwSGYIUqO2c0AqaVeUmFd7NdTGAE4+5VAaFw2OUX9JsL+rKFYO2eylmNteYvhBK rdXdX/FH7Ec/jXWq1Tcw3FzUeP2QmU3G/ey2XaFHJChnfo7vRI6kH987fw0hCzDogUw8 HskheXZ6Zgz9PEjht814LMjkO2UbTOnxJgK0spSBV8PyVyqJtQFXoGo/JyoJu8QTQRzX sRWQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 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 agentk.vger.email (agentk.vger.email. [2620:137:e000::3:2]) by mx.google.com with ESMTPS id pf2-20020a17090b1d8200b00282ecadd91csi4248562pjb.15.2023.11.17.01.05.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 Nov 2023 01:05:31 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) client-ip=2620:137:e000::3:2; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id 04F9A81C70AA; Fri, 17 Nov 2023 01:05:29 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234934AbjKQJFX (ORCPT + 99 others); Fri, 17 Nov 2023 04:05:23 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42004 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230293AbjKQJFW (ORCPT ); Fri, 17 Nov 2023 04:05:22 -0500 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 355D9D4F; Fri, 17 Nov 2023 01:05:19 -0800 (PST) Received: from dggpemd100001.china.huawei.com (unknown [172.30.72.53]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4SWrZf3lZyzvQqg; Fri, 17 Nov 2023 17:04:58 +0800 (CST) Received: from [10.67.120.108] (10.67.120.108) by dggpemd100001.china.huawei.com (7.185.36.94) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.2.1258.23; Fri, 17 Nov 2023 17:05:16 +0800 Message-ID: <9fa0cf22-38fd-9390-8f3d-f70e283da302@huawei.com> Date: Fri, 17 Nov 2023 17:05:16 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.3.1 Subject: Re: [PATCH v3] scsi: libsas: Fix set zero-address when device-type != NO_DEVICE Content-Language: en-CA To: John Garry , , , , CC: , , , , , References: <20231116035241.13730-1-yangxingui@huawei.com> <9cc196d7-0c4f-ef09-53b8-362d5eb599a6@huawei.com> From: yangxingui In-Reply-To: Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [10.67.120.108] X-ClientProxiedBy: dggpemm100005.china.huawei.com (7.185.36.231) To dggpemd100001.china.huawei.com (7.185.36.94) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-4.0 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Fri, 17 Nov 2023 01:05:29 -0800 (PST) Hi John, On 2023/11/17 0:54, John Garry wrote: > On 16/11/2023 13:45, yangxingui wrote: >>> I think that patch title can be improved, but I would need to know >>> more about the problem before suggesting an improvement. >> How about "Fix port add phy failed" ? >>> >>>> Firstly, when ex_phy is added to the parent port, ex_phy->port is >>>> not set. >>> >>> That seems correct, but why mention this now? >>> >>>> As a result, sas_port_delete_phy() won't be called in >>>> sas_unregister_devs_sas_addr(), and although ex_phy's sas_address is >>>> zero, >>>> it is not deleted from the parent port's phy_list. >>> >>> I am not sure why you mention this now either. You seem to be >>> describing how the problem occurs without actually mentioning what >>> the problem is. >>> ohn >>>> >>>> Secondly, phy->attached_sas_addr will be set to a zero-address when >>>> phy->linkrate < SAS_LINK_RATE_1_5_GBPS and device-type != NO_DEVICE >>>> during >>>> device registration, such as stp. It will create a new port and all >>>> other >>>> ex_phys whose addresses are zero will be added to the new port in >>>> sas_ex_get_linkrate(), and it may trigger BUG() as follows: >>> >>> I think that it would be better to first mention this crash, i.e. the >>> problem, how you recreate it, and then describe how and why it >>> happens, and then tell us how you will fix it >> How about follows: >> >> The following processes trigger a BUG(). A new port port-7:7:0 that >> created by a new zero-address sata device tries to add phy-7:7:19 had >> the same zero-address, but phy-7:7:19 is already part of another port. > > I would like to know how to recreate, which gives a lot more context and > helps me understand what the problem is. I have update a new version based on your suggestion. Thanks, Xingui .