From patchwork Tue Oct 20 19:52:58 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jaegeuk Kim X-Patchwork-Id: 287105 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 167F1C388F2 for ; Tue, 20 Oct 2020 19:53:19 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B6AFA22283 for ; Tue, 20 Oct 2020 19:53:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603223598; bh=AHoy8KFgublxtbfCrMKzqGKKzUoHEFBYkSraSnVIqHM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=jZsR3IttoxyijVAtFBfcKc2Bu+M1rQCvszdIXvEaQJBOhfEazD/APPhe0x6E/l/XQ pry50PVqImw8meQgacuI4hoion1W5y31JYgFRgZMHW4Oc+LOa5O8N7SNn073HNQ3ih pVbjXsQ5EEFPQfSSaf8NfRsE17H9z+pwaFIYm+ZQ= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2438453AbgJTTxR (ORCPT ); Tue, 20 Oct 2020 15:53:17 -0400 Received: from mail.kernel.org ([198.145.29.99]:48310 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2438427AbgJTTxJ (ORCPT ); Tue, 20 Oct 2020 15:53:09 -0400 Received: from localhost (unknown [104.132.1.66]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id C54CA223C6; Tue, 20 Oct 2020 19:53:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603223588; bh=AHoy8KFgublxtbfCrMKzqGKKzUoHEFBYkSraSnVIqHM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=F5R/G05opR4eHjGJBhmaxL/dgp2gKoKY0LLIw6+O5iv/b7y3cMxyA6GMZ0+WJYV4v JzfxiC2lNgaqx0Gj0/xoxUspW/g9jCOsg8kpLLjqoRemxXErhMYuTvNaINxl9yufSW RS7nyCeuDcno3s9Zcr1NvZPeTCGXWzlIEdHnEyyk= From: Jaegeuk Kim To: linux-kernel@vger.kernel.org, linux-scsi@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, kernel-team@android.com Cc: Jaegeuk Kim , Alim Akhtar , Avri Altman , Can Guo Subject: [PATCH v2 5/5] scsi: ufs: fix clkgating on/off correctly Date: Tue, 20 Oct 2020 12:52:58 -0700 Message-Id: <20201020195258.2005605-6-jaegeuk@kernel.org> X-Mailer: git-send-email 2.29.0.rc1.297.gfa9743e501-goog In-Reply-To: <20201020195258.2005605-1-jaegeuk@kernel.org> References: <20201020195258.2005605-1-jaegeuk@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org 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(); Cc: Alim Akhtar Cc: Avri Altman Cc: Can Guo Signed-off-by: Jaegeuk Kim --- 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 b5ca0effe636..cecbd4ace8b4 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) return;