Received: by 2002:ac0:8c9a:0:0:0:0:0 with SMTP id r26csp199480ima; Fri, 1 Feb 2019 01:51:17 -0800 (PST) X-Google-Smtp-Source: ALg8bN7jhnrYMLBSjHQEs2c88O0ugPb2sOMotqHTuHcZ2oC+ajM1eRe/dZRNbF9HxsO/KbMWcke0 X-Received: by 2002:a62:5301:: with SMTP id h1mr38257176pfb.17.1549014677046; Fri, 01 Feb 2019 01:51:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549014677; cv=none; d=google.com; s=arc-20160816; b=EUbhhOwREZchJsyQktqY9vJtG2GV+AoIAiQrKbH578DPEyH006iV1SA8kN6VNIVLpI 9VOZXISLsNQP7Uelll9iuaxmFsjDcX6Y3R6Avs2sqA7/MbcC1IOf4cbSQgxMjZEz+zAR V79Ok9ulKFpX2nVE2HDesxWEyT1Twv20H1u4eZ9y2kile70LwfxxoTZLd/TAGhsKS2Zr 9jMHVmhM06Cw17CusbqktU+re700DI5bEHw3RvQSr9WG7yXdTRJZzkF+G5g6oHe4EPou CA7kpD5KOrkkRrVM2PUTogz5Cd/puPFG4BzfiSJFrBWV/1yKAX6If6CsMb17AtkKweyr +nRA== 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=MaaZNAvYZf08c+LI7bY+7My2fVJU2ij6vlrhgP5XD/o=; b=HRP2aqXNzLb2BtwTH4ENu3AOr69/Gdh6mmbdMOXL5VONOCVtsXBbDcyto9H4Lv97n1 ZK7PxAejhV3YnuRjYkJQv4cY7Z4L1eyqWNybcUPBDyrYJ27yhzyKnSzmvW5a2/jkamvK Mtz6kM52ZzUtdq8q7rHutG+gI9aDEh+TnagtAyFwV80LTe5TCPE51T8t0fyMV3RXZluP RSF8L0BMoiu1DyZJzPA5brVuHEhr7O5AOPtTSgYPnnMz4XXAhVs4MTC1w0E+YK1TSBFC KBmCELRQxw6d2UKDJu8/QbnnHyuyiEwTKokgdMVMH7NWPkiBcmqVVv3nwCmFzjo8jWnB mLPg== 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 p15si2500473plq.24.2019.02.01.01.51.01; Fri, 01 Feb 2019 01:51:17 -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 S1728405AbfBAJei (ORCPT + 99 others); Fri, 1 Feb 2019 04:34:38 -0500 Received: from szxga04-in.huawei.com ([45.249.212.190]:2719 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726598AbfBAJei (ORCPT ); Fri, 1 Feb 2019 04:34:38 -0500 Received: from DGGEMS406-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id 1B807A1FA07E73CC8DE0; Fri, 1 Feb 2019 17:34:36 +0800 (CST) Received: from [127.0.0.1] (10.202.226.43) by DGGEMS406-HUB.china.huawei.com (10.3.19.206) with Microsoft SMTP Server id 14.3.408.0; Fri, 1 Feb 2019 17:34:27 +0800 Subject: Re: [PATCH v2 4/7] scsi: libsas: split the replacement of sas disks in two steps To: Jason Yan , , 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> <5C53A7D1.5090700@huawei.com> CC: , , , , , , , , , , , , Ewan Milne , Tomas Henzl From: John Garry Message-ID: <8175f026-3b4e-27f9-2cfb-4efecbb5fe93@huawei.com> Date: Fri, 1 Feb 2019 09:34:19 +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: <5C53A7D1.5090700@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 01/02/2019 01:58, Jason Yan wrote: > > > 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. ok, fine, it's just for one expander; but we still do clear that one expanders events fully. However we would have to be careful here to ensure that we don't have a situation where we still have PHY events pending but no broadcast events to trigger the revalidation and subsequent processing. > >> 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? It would solve the problem of having to fixup the expanders events = -1, which I mentioned was not so nice. As for fixing the main problem, I was not against the idea of the other change in sas_rediscover_dev() to not call sas_discover_new() when the SAS address has changed. > 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 >> > > > > . >