Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp558206pxb; Wed, 11 Nov 2020 10:13:44 -0800 (PST) X-Google-Smtp-Source: ABdhPJxV8l37/b1R8A9YF+1vmCM9VtZaM7bm2kEmykbP6ufBpPi5E0jI1C+0NzP/CtarR07g11Ep X-Received: by 2002:a05:6402:559:: with SMTP id i25mr834605edx.128.1605118424279; Wed, 11 Nov 2020 10:13:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605118424; cv=none; d=google.com; s=arc-20160816; b=KJTgSko9rvE+Dh9MsZg9fBmYe9bTDwd1zjR+zS5e15o0P/F1xXjKf+3PfIkEqOSwMk X9zWmijaCeYq9BPi9JPi0hjCholRFdSLHNCoBqOu0Z1SPLTJ0zsI+vJsWvNCWMtx88UI NLebPOga6IwlhfKKkRFpvxnZsIn+93qkHjwTXdsXGI7OROFeLTKLuSjKknLq9e9Js0NF njx268k79t1FfEazepNQ2VsvnbH+6ZwlVr67muS3oKqlSO3EXmNOOXyA0qASluPjIV5n TLYBOZ5kFn4LJNpxg7UeIBCuWt0W7kFAS5EVLVARf2RGAN1OwVQtdEudUl4cV8rmn6p/ nO0g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dmarc-filter:sender:dkim-signature; bh=L/7UfRWhvf87d6KJzTiNV4kTZAtKUk11tsijaAnZsFg=; b=BzonHvQmuXl1Yz5adDn3/LcMcMxEmgyUcUN0K2diD3KsusnlZQD/duLaWDPtkW68t1 X1OPnsNoTDdd+deTt8YsGWNUrSqLRY7rI9lUKTklho3gPEwikWssZAN8OANuiPtfaBbg ZJFC+eKQUx/zUnnzugqAUieAg9zThKc+j+1Vt3G/9I46J/FxgUHEdKJW9JAbIm2fpjYv 0I9Dj7zzrfD7NkmmTnSdfa/LeSl/DmUx5tcTJ3+8JTPtw1xzgTp55ne8taFfSaec+3Ts 7+oH3hturxDtQ7yabCZfjcB+1zskogjmxMtQ534dwb91NI5IGKGQ5Sz2404s8NjtdwMw zjDA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mg.codeaurora.org header.s=smtp header.b=O9Hs7b9S; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id e26si2109787edr.162.2020.11.11.10.13.20; Wed, 11 Nov 2020 10:13:44 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@mg.codeaurora.org header.s=smtp header.b=O9Hs7b9S; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727284AbgKKSJC (ORCPT + 99 others); Wed, 11 Nov 2020 13:09:02 -0500 Received: from z5.mailgun.us ([104.130.96.5]:15225 "EHLO z5.mailgun.us" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725966AbgKKSJA (ORCPT ); Wed, 11 Nov 2020 13:09:00 -0500 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1605118140; h=Content-Transfer-Encoding: Content-Type: In-Reply-To: MIME-Version: Date: Message-ID: From: References: Cc: To: Subject: Sender; bh=L/7UfRWhvf87d6KJzTiNV4kTZAtKUk11tsijaAnZsFg=; b=O9Hs7b9SvZqcg/mP9dg52FzXTeA14d0aADQht+SUb8Xve3Wz8RGWW0N5NgBCOISe/bBUY3vl jbL3FpBdufYjCnikH41hGzONN1cgcp5juW33JOXJKzZDvMciXjz1lzJVAnquaQcOjn/UHMYN TyNVN7ekPFlFtHt0KaCIbuVG3SY= X-Mailgun-Sending-Ip: 104.130.96.5 X-Mailgun-Sid: WyI0MWYwYSIsICJsaW51eC1rZXJuZWxAdmdlci5rZXJuZWwub3JnIiwgImJlOWU0YSJd Received: from smtp.codeaurora.org (ec2-35-166-182-171.us-west-2.compute.amazonaws.com [35.166.182.171]) by smtp-out-n01.prod.us-east-1.postgun.com with SMTP id 5fac207c0d87d63775a26c7e (version=TLS1.2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256); Wed, 11 Nov 2020 17:33:48 GMT Sender: asutoshd=codeaurora.org@mg.codeaurora.org Received: by smtp.codeaurora.org (Postfix, from userid 1001) id 38205C43385; Wed, 11 Nov 2020 17:33:47 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-caf-mail-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=ALL_TRUSTED,BAYES_00, NICE_REPLY_A,SPF_FAIL autolearn=no autolearn_force=no version=3.4.0 Received: from [192.168.8.168] (cpe-70-95-149-85.san.res.rr.com [70.95.149.85]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: asutoshd) by smtp.codeaurora.org (Postfix) with ESMTPSA id 4491EC433C6; Wed, 11 Nov 2020 17:33:45 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 4491EC433C6 Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; spf=fail smtp.mailfrom=asutoshd@codeaurora.org Subject: Re: [PATCH v1 1/2] scsi: ufs: Fix unbalanced scsi_block_reqs_cnt caused by ufshcd_hold() To: Can Guo , nguyenb@codeaurora.org, hongwus@codeaurora.org, rnayak@codeaurora.org, linux-scsi@vger.kernel.org, kernel-team@android.com, saravanak@google.com, salyzyn@google.com Cc: Alim Akhtar , Avri Altman , "James E.J. Bottomley" , "Martin K. Petersen" , Stanley Chu , Bean Huo , Bart Van Assche , open list References: <1604384682-15837-1-git-send-email-cang@codeaurora.org> <1604384682-15837-2-git-send-email-cang@codeaurora.org> From: "Asutosh Das (asd)" Message-ID: Date: Wed, 11 Nov 2020 09:33:44 -0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.12.1 MIME-Version: 1.0 In-Reply-To: <1604384682-15837-2-git-send-email-cang@codeaurora.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 11/2/2020 10:24 PM, Can Guo wrote: > The scsi_block_reqs_cnt increased in ufshcd_hold() is supposed to be > decreased back in ufshcd_ungate_work() in a paired way. However, if > specific ufshcd_hold/release sequences are met, it is possible that > scsi_block_reqs_cnt is increased twice but only one ungate work is > queued. To make sure scsi_block_reqs_cnt is handled by ufshcd_hold() and > ufshcd_ungate_work() in a paired way, increase it only if queue_work() > returns true. > > Signed-off-by: Can Guo > Reviewed-by: Hongwu Su > --- Reviewed-by: Asutosh Das > drivers/scsi/ufs/ufshcd.c | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) > > diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c > index 847f355..efa7d86 100644 > --- a/drivers/scsi/ufs/ufshcd.c > +++ b/drivers/scsi/ufs/ufshcd.c > @@ -1634,12 +1634,12 @@ int ufshcd_hold(struct ufs_hba *hba, bool async) > */ > /* fallthrough */ > case CLKS_OFF: > - ufshcd_scsi_block_requests(hba); > hba->clk_gating.state = REQ_CLKS_ON; > trace_ufshcd_clk_gating(dev_name(hba->dev), > hba->clk_gating.state); > - queue_work(hba->clk_gating.clk_gating_workq, > - &hba->clk_gating.ungate_work); > + if (queue_work(hba->clk_gating.clk_gating_workq, > + &hba->clk_gating.ungate_work)) > + ufshcd_scsi_block_requests(hba); > /* > * fall through to check if we should wait for this > * work to be done or not. > -- The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, Linux Foundation Collaborative Project