Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp1289812pxx; Tue, 27 Oct 2020 12:53:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwuic1h6smDqwt5kMq6V9mST5VJDHJZ1lthnH6VeUM6w9Ejxjmy9DD1hqNTrOWOuQDHcKLb X-Received: by 2002:a05:6402:1bcc:: with SMTP id ch12mr4035922edb.339.1603828414128; Tue, 27 Oct 2020 12:53:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603828414; cv=none; d=google.com; s=arc-20160816; b=0TmmocunuTxv5ujbztDEB+WUW9LTCozad6RLLWDe4YK1B7Af6TW58cYRa1tsTO2c/a EPf4mFN10gGcfBPY4km58x9FZhjXemmqVmVh53OY3khkxb06kkpu3Lx3QQJC0tmp0DKV yLtONh17wznlmugoHCdbwdgr3sYjmZ0oGuAk1VmyB9R0ni18P8+pZuSd4/P6metqxaqS ps32UUE0ukpOow8dvjkX++XwASwYY2TL/GNdBunULwpsVY6NH6Nc67Ll0TgBeYIfJPW+ f9yU0gEnrKWTMu5sdWxKcrpI0/hB7n6O6g7xDomGrLuthgrdhvjwWG64MR+iavYDzdM2 wpwg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:message-id:references:in-reply-to :subject:cc:to:from:date:content-transfer-encoding:mime-version :sender:dkim-signature; bh=AGhgURyohfn/3Ju6PDZpb7S7TBRxmdJD5RBwWfLer5k=; b=CLVy3awX2xrzkC7TkMq6QL/jiE1YlbidSa/fHZmbHCboayRhH4NabsvBUc0raNTpZi n+qEVJBWwJ6PgrKi6w6R4frMPtzPJaNdBOXhnbkIBJMJfIOT4kuVIphup/+RvQEOWeFB 78E20J/71hWjcHzNogCZVCDopCp/FZo4Z9IcNT3y6OqSme8Qw/dPwlMaAYLvxse0qPb5 9lFeb2/cCVRi7wz9tt81Q8iDWYOpptD1d4U9cXNFQ0l1O/Jy71vK25Lkk2FKz+aqQ6rO 1oM10rDR4IjKaBI6Y2Z5Ex38hax8khYt2LmHICnr4o+I9e6bJvCCzSLWpiDncrLHv5n0 q75g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mg.codeaurora.org header.s=smtp header.b=MIC3Jvbv; 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 p9si1623574edy.462.2020.10.27.12.53.11; Tue, 27 Oct 2020 12:53:34 -0700 (PDT) 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=MIC3Jvbv; 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 S2440538AbgJ0CWI (ORCPT + 99 others); Mon, 26 Oct 2020 22:22:08 -0400 Received: from z5.mailgun.us ([104.130.96.5]:56065 "EHLO z5.mailgun.us" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2410334AbgJ0CWI (ORCPT ); Mon, 26 Oct 2020 22:22:08 -0400 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1603765328; h=Message-ID: References: In-Reply-To: Subject: Cc: To: From: Date: Content-Transfer-Encoding: Content-Type: MIME-Version: Sender; bh=AGhgURyohfn/3Ju6PDZpb7S7TBRxmdJD5RBwWfLer5k=; b=MIC3JvbvSj0aPmIR8/lK7tKsdi1ZAZKtKmY2XiEDoJxuAo5OzfVYdKUdQBtbY8EoUTTH7cCu TYNezXkn/O+RWE0laD5RHX/YR6x8ukhc62H4/KNPpXxfLiWRhUa0Jk0gvdwBdzPZ5HPcvPRr 35djOCHz7vTWkEDzXK1TYGh7GEc= 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-n06.prod.us-east-1.postgun.com with SMTP id 5f978403d6826c2dbd07e4ae (version=TLS1.2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256); Tue, 27 Oct 2020 02:20:51 GMT Sender: cang=codeaurora.org@mg.codeaurora.org Received: by smtp.codeaurora.org (Postfix, from userid 1001) id DA7B4C433FF; Tue, 27 Oct 2020 02:20:50 +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, URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.codeaurora.org (localhost.localdomain [127.0.0.1]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) (Authenticated sender: cang) by smtp.codeaurora.org (Postfix) with ESMTPSA id 38B42C433CB; Tue, 27 Oct 2020 02:20:50 +0000 (UTC) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Tue, 27 Oct 2020 10:20:50 +0800 From: Can Guo To: Jaegeuk Kim Cc: linux-kernel@vger.kernel.org, linux-scsi@vger.kernel.org, kernel-team@android.com, alim.akhtar@samsung.com, avri.altman@wdc.com, bvanassche@acm.org, Asutosh Das Subject: Re: [PATCH v4 5/5] scsi: ufs: fix clkgating on/off correctly In-Reply-To: <20201026195124.363096-6-jaegeuk@kernel.org> References: <20201026195124.363096-1-jaegeuk@kernel.org> <20201026195124.363096-6-jaegeuk@kernel.org> Message-ID: X-Sender: cang@codeaurora.org User-Agent: Roundcube Webmail/1.3.9 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2020-10-27 03:51, Jaegeuk Kim wrote: > The below call stack prevents clk_gating at every IO completion. > We can remove the condition, ufshcd_any_tag_in_use(), since > clkgating_work > will check it again. > > ufshcd_complete_requests(struct ufs_hba *hba) > ufshcd_transfer_req_compl() > __ufshcd_transfer_req_compl() > __ufshcd_release(hba) > if (ufshcd_any_tag_in_use() == 1) > return; > ufshcd_tmc_handler(hba); > blk_mq_tagset_busy_iter(); > > Note that, this still requires a work to deal with a potential racy > condition > when user sets clkgating.delay_ms to very small value. That can cause > preventing > clkgating by the check of ufshcd_any_tag_in_use() in gate_work. > > Fixes: 7252a3603015 ("scsi: ufs: Avoid busy-waiting by eliminating tag > conflicts") > Signed-off-by: Jaegeuk Kim > Reviewed-by: Asutosh Das Reviewed-by: Can Guo > --- > drivers/scsi/ufs/ufshcd.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c > index b8a54d09e750..86c8dee01ca9 100644 > --- a/drivers/scsi/ufs/ufshcd.c > +++ b/drivers/scsi/ufs/ufshcd.c > @@ -1746,7 +1746,7 @@ static void __ufshcd_release(struct ufs_hba *hba) > > if (hba->clk_gating.active_reqs || hba->clk_gating.is_suspended || > hba->ufshcd_state != UFSHCD_STATE_OPERATIONAL || > - ufshcd_any_tag_in_use(hba) || hba->outstanding_tasks || > + hba->outstanding_tasks || > hba->active_uic_cmd || hba->uic_async_done || > hba->clk_gating.state == CLKS_OFF) > return;