Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp6542991imu; Wed, 30 Jan 2019 17:14:21 -0800 (PST) X-Google-Smtp-Source: ALg8bN7GlMb9FuzuoUyniJqI0A+LTy8zgOIfw7325yzFwwS2UzUSe/B48GKlqVCoBAuf/KLw6i18 X-Received: by 2002:a17:902:9897:: with SMTP id s23mr31387548plp.69.1548897261748; Wed, 30 Jan 2019 17:14:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548897261; cv=none; d=google.com; s=arc-20160816; b=UNuc8N4DlaEf1NBcw3lG0BK3zBaa9EpZdhyCmmlDIi5cBDjNiX/zq0BBO2mTyokKX1 7FGUCpHexZU8V0UpbK458we1KSwDqNCwatq+TXsAAEkdTyM8QEUOg0AsGLjgdCUHwH2q 0FVEZSLt6bfkqYz3QbPwfiZQhNpTVmMQw+z2yF6G1WuiRxAZlBM3n+LAqFEbFzq3Hwj/ dqTEr+DCJX3bU5IwDTQ1kvsueqbNvnAL22qa6+A1W0Dnc3dPoHcNozFakiJWkGUfZblb imznkpusjJ506mrcQ9UroixWXdvI2yQspY/rdtRe9nvVCDSul/jbNPl2Oz5vgGo3mTEo +9eg== 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=bT1B2yvIOYvDeX6Ow0Gi0Se2/9Wk1KuQQBUGeSXcZGw=; b=yNZXPcjcZtAfAolYlm/4oje0qVf7W/NWSG+4TcTrNP1heXZ/Fn3Pbt8X35V7GyAbjl 0PBEVlH3mkBDYXBuJaFoStgAs3IWDIdwvuiI4Ir0kKn5yEjavEFdRUYv1igv+3CprE5r Q7sUuA+w/ICx/wfkfAfFjs+JbT/U4go6CINBULJznT4Ol4NiwxToYZhycdyIS4vywSd7 gH3/nKFpewg6WaDrldRG7nTfSe2diWt4tvD+KYZIJslro4Yxtorfs4UcH40mNk9EUsTs N0ZLj8zUppKiJwHS+LplXtT8snqfdD6XI7GbiK21aMVn3dCQ8JSPAM66xS6bUq2OVxJ1 3OPw== 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 l7si3140319plg.390.2019.01.30.17.14.06; Wed, 30 Jan 2019 17:14:21 -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 S1729047AbfAaBNx (ORCPT + 99 others); Wed, 30 Jan 2019 20:13:53 -0500 Received: from szxga04-in.huawei.com ([45.249.212.190]:2709 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725535AbfAaBNx (ORCPT ); Wed, 30 Jan 2019 20:13:53 -0500 Received: from DGGEMS408-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id 3322DDEB6358ACBA740F; Thu, 31 Jan 2019 09:13:51 +0800 (CST) Received: from [127.0.0.1] (10.177.96.203) by DGGEMS408-HUB.china.huawei.com (10.3.19.208) with Microsoft SMTP Server id 14.3.408.0; Thu, 31 Jan 2019 09:13:43 +0800 Subject: Re: [PATCH v2 2/7] scsi: libsas: only clear phy->in_shutdown after shutdown event done To: John Garry , , References: <20190130082412.9357-1-yanaijie@huawei.com> <20190130082412.9357-3-yanaijie@huawei.com> <5643a038-a62f-e19c-1073-d845a8344b9f@huawei.com> CC: , , , , , , , , , , , , Ewan Milne , Tomas Henzl From: Jason Yan Message-ID: <5C524BC6.3010006@huawei.com> Date: Thu, 31 Jan 2019 09:13:42 +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: <5643a038-a62f-e19c-1073-d845a8344b9f@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/1/31 0:26, John Garry wrote: > On 30/01/2019 08:24, Jason Yan wrote: >> When the event queue is full of phy up and down events and reached the >> threshold, we will queue a shutdown-event, and set phy->in_shutdown so >> that we will not queue a shutdown-event again. But before the >> shutdown-event can be executed, every phy-down event will clear >> phy->in_shutdown and a new shutdown-event will be queued. The queue will >> be full of these shutdown-events. >> >> Fix this by only clear phy->in_shutdown in sas_phye_shutdown(), that is >> after the first shutdown-event has been executed. >> > > Seems ok as a fix: > Reviewed-by: John Garry > > After this fix, could we change to use a static per-PHY shutdown event > so that we cannot re-queue it? I know that this is going against idea of > dynamic events, but it's easier than messing with flags like this. > Thanks, I will consider this. >> Fixes: f12486e06ae8 ("scsi: libsas: shut down the PHY if events >> reached the threshold") >> Signed-off-by: Jason Yan >> CC: John Garry >> CC: Johannes Thumshirn >> CC: Ewan Milne >> CC: Christoph Hellwig >> CC: Tomas Henzl >> CC: Dan Williams >> CC: Hannes Reinecke >> --- >> drivers/scsi/libsas/sas_phy.c | 3 +-- >> 1 file changed, 1 insertion(+), 2 deletions(-) >> >> diff --git a/drivers/scsi/libsas/sas_phy.c >> b/drivers/scsi/libsas/sas_phy.c >> index 0374243c85d0..762bb13cca74 100644 >> --- a/drivers/scsi/libsas/sas_phy.c >> +++ b/drivers/scsi/libsas/sas_phy.c >> @@ -35,7 +35,6 @@ static void sas_phye_loss_of_signal(struct >> work_struct *work) >> struct asd_sas_event *ev = to_asd_sas_event(work); >> struct asd_sas_phy *phy = ev->phy; >> >> - phy->in_shutdown = 0; >> phy->error = 0; >> sas_deform_port(phy, 1); >> } >> @@ -45,7 +44,6 @@ static void sas_phye_oob_done(struct work_struct *work) >> struct asd_sas_event *ev = to_asd_sas_event(work); >> struct asd_sas_phy *phy = ev->phy; >> >> - phy->in_shutdown = 0; >> phy->error = 0; >> } >> >> @@ -127,6 +125,7 @@ static void sas_phye_shutdown(struct work_struct >> *work) >> } else >> pr_notice("phy%02d is not enabled, cannot shutdown\n", >> phy->id); >> + phy->in_shutdown = 0; >> } >> >> /* ---------- Phy class registration ---------- */ >> > > > > . >