public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
From: Adrien Thierry <athierry@redhat.com>
To: Bart Van Assche <bvanassche@acm.org>
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>,
	linux-scsi@vger.kernel.org
Subject: Re: [PATCH v2] scsi: ufs: initialize devfreq synchronously
Date: Fri, 17 Feb 2023 14:46:04 -0500	[thread overview]
Message-ID: <Y+/ZfKjcUr+J5d+D@fedora> (raw)
In-Reply-To: <8e6c545c-9ad6-1d97-9e6a-721d8770b40a@acm.org>

Hi Bart,

Thanks for reviewing, I posted a v3.

Best,

Adrien

On Fri, Feb 17, 2023 at 09:13:59AM -0800, Bart Van Assche wrote:
> On 2/16/23 13:00, Adrien Thierry wrote:
> > During ufs initialization, devfreq initialization is asynchronous:
> > ufshcd_async_scan() calls ufshcd_add_lus(), which in turn initializes
> > devfreq for ufs. The simple ondemand governor is then loaded. If it is
> > build as a module, request_module() is called and throws a warning:
> 
> build -> built?
> 
> > @@ -9896,12 +9893,30 @@ int ufshcd_init(struct ufs_hba *hba, void __iomem *mmio_base, unsigned int irq)
> >   	 */
> >   	ufshcd_set_ufs_dev_active(hba);
> > +	/* Initialize devfreq */
> > +	if (ufshcd_is_clkscaling_supported(hba)) {
> > +		memcpy(&hba->clk_scaling.saved_pwr_info.info,
> > +			&hba->pwr_info,
> > +			sizeof(struct ufs_pa_layer_attr));
> > +		hba->clk_scaling.saved_pwr_info.is_valid = true;
> > +		hba->clk_scaling.is_allowed = true;
> > +
> > +		err = ufshcd_devfreq_init(hba);
> > +		if (err)
> > +			goto out_power_off;
> > +
> > +		hba->clk_scaling.is_enabled = true;
> > +		ufshcd_init_clk_scaling_sysfs(hba);
> > +	}
> > +
> >   	async_schedule(ufshcd_async_scan, hba);
> >   	ufs_sysfs_add_nodes(hba->dev);
> >   	device_enable_async_suspend(dev);
> >   	return 0;
> > +out_power_off:
> > +	pm_runtime_put_sync(dev);
> >   free_tmf_queue:
> >   	blk_mq_destroy_queue(hba->tmf_queue);
> >   	blk_put_queue(hba->tmf_queue);
> 
> Something I should have noticed while reviewing v1 of this patch: the label
> name "out_power_off" is misleading. pm_runtime_put_sync() does not power off
> a device but instead gives the power management core permission to apply the
> power management policy configured via sysfs. Runtime power management can
> be disabled via sysfs. How about renaming this label into "rpm_put_sync"
> (RPM = Runtime Power Management)?
> 
> Thanks,
> 
> Bart.
> 


      reply	other threads:[~2023-02-17 19:47 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-16 21:00 [PATCH v2] scsi: ufs: initialize devfreq synchronously Adrien Thierry
2023-02-17 17:13 ` Bart Van Assche
2023-02-17 19:46   ` Adrien Thierry [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=Y+/ZfKjcUr+J5d+D@fedora \
    --to=athierry@redhat.com \
    --cc=alim.akhtar@samsung.com \
    --cc=avri.altman@wdc.com \
    --cc=bvanassche@acm.org \
    --cc=jejb@linux.ibm.com \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.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