public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
From: Can Guo <cang@codeaurora.org>
To: Bart Van Assche <bvanassche@acm.org>
Cc: "Martin K . Petersen" <martin.petersen@oracle.com>,
	"James E . J . Bottomley" <jejb@linux.vnet.ibm.com>,
	Jaegeuk Kim <jaegeuk@kernel.org>, Bean Huo <beanhuo@micron.com>,
	Avri Altman <avri.altman@wdc.com>,
	Asutosh Das <asutoshd@codeaurora.org>,
	Vignesh Raghavendra <vigneshr@ti.com>,
	linux-scsi@vger.kernel.org, Alim Akhtar <alim.akhtar@samsung.com>,
	Stanley Chu <stanley.chu@mediatek.com>,
	Adrian Hunter <adrian.hunter@intel.com>
Subject: Re: [PATCH] ufs: Fix handling of active power mode in ufshcd_suspend()
Date: Thu, 13 May 2021 09:35:46 +0800	[thread overview]
Message-ID: <7e4e33158be2e5bfc8260c47202b45d9@codeaurora.org> (raw)
In-Reply-To: <20210512195721.8157-1-bvanassche@acm.org>

On 2021-05-13 03:57, Bart Van Assche wrote:
> If the rpm_lvl and spm_lvl sysfs attributes indicate that 
> ufshcd_suspend()
> should keep the link active, re-enable clock gating instead of 
> disabling
> clocks.
> 
> Suggested-by: Jaegeuk Kim <jaegeuk@kernel.org>
> Cc: Can Guo <cang@codeaurora.org>
> Cc: Alim Akhtar <alim.akhtar@samsung.com>
> Cc: Avri Altman <avri.altman@wdc.com>
> Cc: Stanley Chu <stanley.chu@mediatek.com>
> Cc: Bean Huo <beanhuo@micron.com>
> Cc: Adrian Hunter <adrian.hunter@intel.com>
> Signed-off-by: Bart Van Assche <bvanassche@acm.org>
> ---
>  drivers/scsi/ufs/ufshcd.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
> index f540b0cc253f..c96e36aab989 100644
> --- a/drivers/scsi/ufs/ufshcd.c
> +++ b/drivers/scsi/ufs/ufshcd.c
> @@ -8690,9 +8690,8 @@ static int ufshcd_suspend(struct ufs_hba *hba,
> enum ufs_pm_op pm_op)
>  	ufshcd_clk_scaling_suspend(hba, true);
> 
>  	if (req_dev_pwr_mode == UFS_ACTIVE_PWR_MODE &&
> -			req_link_state == UIC_LINK_ACTIVE_STATE) {
> -		goto disable_clks;
> -	}
> +			req_link_state == UIC_LINK_ACTIVE_STATE)
> +		goto enable_gating;
> 
>  	if ((req_dev_pwr_mode == hba->curr_dev_pwr_mode) &&
>  	    (req_link_state == hba->uic_link_state))
> @@ -8754,7 +8753,6 @@ static int ufshcd_suspend(struct ufs_hba *hba,
> enum ufs_pm_op pm_op)
>  	if (ret)
>  		goto set_dev_active;
> 
> -disable_clks:
>  	/*
>  	 * Call vendor specific suspend callback. As these callbacks may 
> access
>  	 * vendor specific host controller register space call them before 
> the

Hi Bart,

The change is unnecessary, ufshcd_suspend() is indeed keeping link alive 
even if
we are disabling clocks. In __ufshcd_setup_clocks(), we have checks on 
clock sources
so that we leave certain clock sources ON if the link is alive. And we 
have many
of our customers tested the case rpm/spm_lvl == 0, it is working well. 
Please check
below changes:

https://lore.kernel.org/patchwork/patch/1345336/
https://lore.kernel.org/patchwork/patch/1345337/

With this change, after suspend (rpm/spm_lvl == 0), leaving clock gating 
running is risky:
1. clock gating may run into concurrency with resume.
2. In ufshcd_resume(), we also have a ufshcd_release(), it will cause 
unbalanced usage of clock gating.

And it seems quite opposite from what you want - you want to keep link
alive but you are leaving clock gating enabled, then when clock gating
kicks start, it will put the link into hibern8, but not keep link alive.

Thanks,
Can Guo.

  reply	other threads:[~2021-05-13  1:36 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-12 19:57 [PATCH] ufs: Fix handling of active power mode in ufshcd_suspend() Bart Van Assche
2021-05-13  1:35 ` Can Guo [this message]
2021-05-14 16:15   ` Bart Van Assche

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7e4e33158be2e5bfc8260c47202b45d9@codeaurora.org \
    --to=cang@codeaurora.org \
    --cc=adrian.hunter@intel.com \
    --cc=alim.akhtar@samsung.com \
    --cc=asutoshd@codeaurora.org \
    --cc=avri.altman@wdc.com \
    --cc=beanhuo@micron.com \
    --cc=bvanassche@acm.org \
    --cc=jaegeuk@kernel.org \
    --cc=jejb@linux.vnet.ibm.com \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=stanley.chu@mediatek.com \
    --cc=vigneshr@ti.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox