Received: by 2002:ac0:8c9a:0:0:0:0:0 with SMTP id r26csp407042ima; Thu, 31 Jan 2019 19:26:13 -0800 (PST) X-Google-Smtp-Source: ALg8bN47Cxwlo5TG4DPbLsV/a7dxdfN5jr1BFXjhdwxy+a7b4BaQSKWvG9oXPhcgt6Wr7CM13OoC X-Received: by 2002:a62:2c81:: with SMTP id s123mr37199434pfs.174.1548991573807; Thu, 31 Jan 2019 19:26:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548991573; cv=none; d=google.com; s=arc-20160816; b=kofUk06qIB/yNRDGhxr0OyI0M2SW4zLhzyvf/upF8SB8DCwGQ3XAcbE/4JVluA0vbA +2vt9yEzR+LwpBWiNqUjAu3rZkvtWYt6nACQ+vPL7hEow8W7I9oZLPIppLwctC99mIHG W+keaWq5Vgm26D9SJs8EtsxyiKWGRzEqOWvXb7l7Mf5LjXMtbWMKZ7whhGbPvSVaJ8JS 5yWXrn818U/QdbCaAbKXvpZlHtYBZL1TqsjjIQ+ryUtmyTvo0sZEfgOr9H1LxlaF8LRz EZiM9Pr2exUqAzmT+cqcuQCRdrvobgwdLBcyO6o3LwNEV/rTCp9T7ywgyDAKoXKa2C0v tCEA== 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=4ru8AH4PMSnuPC9FeBUpxwOD3pDZ2qyZ/AE5/s+GzZI=; b=NW3esnCCLjTw8NjnajYFa4ufp8vzvasZo1W8ZsXBU3KcYlpl56mTPAHmyRWBhEHAE0 JoH1FaFyWU6axE1wiJs4WpPdIMKhk4kZEuaALXULo3H2pgAok+7exu1+7FFArgM3QxcQ MUx016AeqyrlZIm9Xr9QS37M4X0IjbRF2I8WpByGkgJvCMzlHBUdznfpoHXPgkFu+8pq RNc0sMoZwqvBkecW9C6ZBCUrtF80QkQZMRAoV/hfEUJvxDxYYJRiP66k1cojpZgva/rn QY2UbVWhfiaCX7/DZNQnXuoshWClbfFYRhhmLEKczgDTVp5Xg1lrnuUpiQ5/np1jHF6o fyjQ== 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 v190si1238504pgd.33.2019.01.31.19.25.58; Thu, 31 Jan 2019 19:26:13 -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 S1727580AbfBAB6v (ORCPT + 99 others); Thu, 31 Jan 2019 20:58:51 -0500 Received: from szxga05-in.huawei.com ([45.249.212.191]:3259 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727500AbfBAB6v (ORCPT ); Thu, 31 Jan 2019 20:58:51 -0500 Received: from DGGEMS405-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id 993BBDFEF2D6D6FB559B; Fri, 1 Feb 2019 09:58:49 +0800 (CST) Received: from [127.0.0.1] (10.177.96.203) by DGGEMS405-HUB.china.huawei.com (10.3.19.205) with Microsoft SMTP Server id 14.3.408.0; Fri, 1 Feb 2019 09:58:43 +0800 Subject: Re: [PATCH v2 4/7] scsi: libsas: split the replacement of sas disks in two steps To: John Garry , , References: <20190130082412.9357-1-yanaijie@huawei.com> <20190130082412.9357-5-yanaijie@huawei.com> <17908564-35f2-4c5d-e9e4-4fe109fae4cc@huawei.com> <5C5257AC.3040303@huawei.com> <7ad77303-9960-5b8c-f26e-fc825ac57621@huawei.com> <55b43797-4504-76dc-e5bf-c588623d0866@huawei.com> CC: , , , , , , , , , , , , Ewan Milne , Tomas Henzl From: Jason Yan Message-ID: <5C53A7D1.5090700@huawei.com> Date: Fri, 1 Feb 2019 09:58:41 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.1.0 MIME-Version: 1.0 In-Reply-To: <55b43797-4504-76dc-e5bf-c588623d0866@huawei.com> Content-Type: text/plain; charset="windows-1252"; format=flowed Content-Transfer-Encoding: 7bit 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/2/1 0:38, John Garry wrote: > On 31/01/2019 10:29, John Garry wrote: >> On 31/01/2019 02:04, Jason Yan wrote: >>> >>> >>> On 2019/1/31 1:22, John Garry wrote: >>>> On 30/01/2019 08:24, Jason Yan wrote: >>>>> Now if a new device replaced a old device, the sas address will >>>>> change. >>>> >>>> Hmmm... not if it's a SATA disk, which would have some same invented >>>> SAS >>>> address. >>>> >>> >>> Yes, it's only for a SAS disk. >>> >>>>> We unregister the old device and discover the new device in one >>>>> revalidation process. But after we deferred the sas_port_delete(), the >>>>> sas port is not deleted when we registering the new port and device. >>>>> The sas port cannot be added because the name of the new port is the >>>>> same as the old. >>>>> >>>>> Fix this by doing the replacement in two steps. The first revalidation >>>>> only delete the old device and trigger a new revalidation. The second >>>>> revalidation discover the new device. To keep the event processing >>>>> synchronised to the original event, > > This change seems ok, but please see below regarding generating the > bcast events. > >>>> >>>> Did I originally suggest this? It seems to needlessly make the code >>>> more >>>> complicated. >>>> >>> >>> Yes, my first version was raise a new bcast event, and you said it's not >>> synchronised to the original event. Shall I get back to that approach? >> >> Not sure. This patch seems to fix something closely related to that in >> "scsi: libsas: fix issue of swapping two sas disks", which I will check >> further. >> > > An idea: > > So, before the libsas changes to generate dynamic events, when libsas > was processing a particular event type - like a broadcast event - extra > events generated by the LLDD were discarded by libsas. > > The revalidation process attempted to do all revalidation for the domain > is a single pass, which was ok. This really did not change. > > However, in this revalidation pass, we also clear all expander and PHY > events. > Actually we only clean one expander and it's attached PHYs events now. > Maybe this is not the right thing to do. Maybe we should just clear a > single PHY event per pass, since we're processing each broadcast event > one-by-one. > Yes, we can do this. But I don't understand how this will fix the issue? We have this issue now because we have to probe the sas port and/or delete the sas port out side of the disco_mutex. So for a specific PHY, we cannot add and delete at the same time inside the disco_mutex. > Today you will notice that if we remove a disk for example, many > broadcast events are generated, but only the first broadcast event > actually does any revalidation. > > EOM >