linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Can Guo <cang@codeaurora.org>
To: Yang Yang <yang.yang@vivo.com>
Cc: Alim Akhtar <alim.akhtar@samsung.com>,
	Avri Altman <avri.altman@wdc.com>,
	"James E.J. Bottomley" <jejb@linux.ibm.com>,
	"Martin K. Petersen" <martin.petersen@oracle.com>,
	Stanley Chu <stanley.chu@mediatek.com>,
	Bean Huo <beanhuo@micron.com>,
	Bart Van Assche <bvanassche@acm.org>,
	Asutosh Das <asutoshd@codeaurora.org>,
	Sujit Reddy Thumma <sthumma@codeaurora.org>,
	Dolev Raviv <draviv@codeaurora.org>,
	Subhash Jadavani <subhashj@codeaurora.org>,
	linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org,
	onlyfever@icloud.com
Subject: Re: [PATCH] scsi: ufs: Fix a bug in ufshcd_system_resume()
Date: Fri, 13 Nov 2020 13:05:05 +0800	[thread overview]
Message-ID: <52a959ba7514f802488c93f907586a1d@codeaurora.org> (raw)
In-Reply-To: <20201110085537.2889-1-yang.yang@vivo.com>

On 2020-11-10 16:55, Yang Yang wrote:
> During system resume, ufshcd_system_resume() won't resume UFS host if
> runtime suspended. After that, scsi_bus_resume() try to set SCSI host's
> RPM status to RPM_ACTIVE, this will fail because UFS host's RPM status
> is still RPM_SUSPENDED. So fix it.
> 
>     scsi host0: scsi_runtime_suspend()
> 		ufshcd_runtime_suspend()
>     scsi host0: scsi_bus_suspend()
> 		ufshcd_system_suspend()
>     ----------------------------------
> 		ufshcd_pltfrm_resume()
>     scsi host0: scsi_bus_resume()
>     scsi host0: scsi_bus_resume_common()
>     scsi host0: pm_runtime_set_active(dev)
> 
>     scsi host0: runtime PM trying to activate child device host0 but 
> parent
>     (8800000.ufshc) is not active
> 
> Fixes: 57d104c153d3 ("ufs: add UFS power management support")
> Signed-off-by: Yang Yang <yang.yang@vivo.com>
> ---
>  drivers/scsi/ufs/ufshcd.c | 15 +++++++++------
>  1 file changed, 9 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
> index b8f573a02713..9e666e1ad58c 100644
> --- a/drivers/scsi/ufs/ufshcd.c
> +++ b/drivers/scsi/ufs/ufshcd.c
> @@ -8767,11 +8767,7 @@ int ufshcd_system_resume(struct ufs_hba *hba)
>  	if (!hba)
>  		return -EINVAL;
> 
> -	if (!hba->is_powered || pm_runtime_suspended(hba->dev))
> -		/*
> -		 * Let the runtime resume take care of resuming
> -		 * if runtime suspended.
> -		 */
> +	if (!hba->is_powered)
>  		goto out;
>  	else
>  		ret = ufshcd_resume(hba, UFS_SYSTEM_PM);
> @@ -8779,8 +8775,15 @@ int ufshcd_system_resume(struct ufs_hba *hba)
>  	trace_ufshcd_system_resume(dev_name(hba->dev), ret,
>  		ktime_to_us(ktime_sub(ktime_get(), start)),
>  		hba->curr_dev_pwr_mode, hba->uic_link_state);
> -	if (!ret)
> +	if (!ret) {
>  		hba->is_sys_suspended = false;
> +
> +		if (pm_runtime_suspended(hba->dev)) {
> +			pm_runtime_disable(hba->dev);
> +			pm_runtime_set_active(hba->dev);
> +			pm_runtime_enable(hba->dev);
> +		}
> +	}
>  	return ret;
>  }
>  EXPORT_SYMBOL(ufshcd_system_resume);

It is designed like this - if hba is runtime suspend, do not resume it
during system resume, which is the so called deferred resume feature.
This is to leave the runtime PM management to block layer PM, which
is more power efficiency.

> scsi host0: runtime PM trying to activate child device host0 but parent
> (8800000.ufshc) is not active
The log is not harmful or fatal, maybe just annoying. Do you see real
problem with it? If yes, please share it here.

Thanks,

Can Guo.

      reply	other threads:[~2020-11-13  5:05 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-10  8:55 [PATCH] scsi: ufs: Fix a bug in ufshcd_system_resume() Yang Yang
2020-11-13  5:05 ` Can Guo [this message]

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=52a959ba7514f802488c93f907586a1d@codeaurora.org \
    --to=cang@codeaurora.org \
    --cc=alim.akhtar@samsung.com \
    --cc=asutoshd@codeaurora.org \
    --cc=avri.altman@wdc.com \
    --cc=beanhuo@micron.com \
    --cc=bvanassche@acm.org \
    --cc=draviv@codeaurora.org \
    --cc=jejb@linux.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=onlyfever@icloud.com \
    --cc=stanley.chu@mediatek.com \
    --cc=sthumma@codeaurora.org \
    --cc=subhashj@codeaurora.org \
    --cc=yang.yang@vivo.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;
as well as URLs for NNTP newsgroup(s).