linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Need help : Way to disable runtime PM with system suspend enabled
@ 2016-06-09  7:23 Sumit Singh
  2016-06-09 12:46 ` Rafael J. Wysocki
  0 siblings, 1 reply; 5+ messages in thread
From: Sumit Singh @ 2016-06-09  7:23 UTC (permalink / raw)
  To: rjw@rjwysocki.net
  Cc: linux-pm@vger.kernel.org, Prashant Gaikwad, Bharat Nihalani

Hi Rafael,

I have a requirement related to runtime PM and system suspend, and need your help for it. Below is the requirement, and the approach I followed:

I want to disable runtime-PM for all the devices, but want to keep system suspend enabled. More precisely, I don't want devices to runtime suspend or even clock-gated when device is idle.
I want them always to be in full power state. Currently, devices are using runtime PM to get powered at boot time.

I have a requirement where power supply is not a constraint, but system's responsiveness is of critical importance. With runtime-PM enabled, it will incur some delay for the device to come out of runtime suspend state whenever a request comes for it.
I want to avoid that delay. This is the reason I want to disable runtime PM. System suspend should be working fine.

As upstream has closely integrated runtime PM and system suspend, and also got rid of CONFIG_PM_RUNTIME, so now it is not possible to just disable CONFIG_PM_RUNTIME to disable runtime PM. I tried below two approaches to meet the requirement:

1.)    The devices that use PM Domains, I set governor as always-on governor, so that devices won't runtime suspend. But, it does not prevent devices from clock-gating. This approach is applicable only for the devices which use PM Domains.
2.)    The devices that don't use PM Domains, I tried making changes in individual drivers. For each device, in the probe function, once device is powered-on, I disable runtime PM using runtime PM APIs, so that device won't entertain any
runtime requests. This way device will be always on.

-  With first approach, devices did not runtime suspend, but were clock-gated. This approach is not applicable to the devices, which don't use PM Domain. System suspend is working fine.
-  With second approach, devices were not runtime suspended, and were always powered-on. But I had to make changes in each of the driver files. As each of the devices are using runtime PM in different ways, so it was not possible to create a common API which will suit all the devices.

Could you please help me with a cleaner way so that devices don't runtime-suspend (not even clock-gate), and system suspend should be working?

Thanks
Sumit Singh
-----------------------------------------------------------------------------------
This email message is for the sole use of the intended recipient(s) and may contain
confidential information.  Any unauthorized review, use, disclosure or distribution
is prohibited.  If you are not the intended recipient, please contact the sender by
reply email and destroy all copies of the original message.
-----------------------------------------------------------------------------------

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Need help : Way to disable runtime PM with system suspend enabled
  2016-06-09  7:23 Need help : Way to disable runtime PM with system suspend enabled Sumit Singh
@ 2016-06-09 12:46 ` Rafael J. Wysocki
  2016-06-10  9:54   ` Sumit Singh
  0 siblings, 1 reply; 5+ messages in thread
From: Rafael J. Wysocki @ 2016-06-09 12:46 UTC (permalink / raw)
  To: Sumit Singh
  Cc: rjw@rjwysocki.net, linux-pm@vger.kernel.org, Prashant Gaikwad,
	Bharat Nihalani

On Thu, Jun 9, 2016 at 9:23 AM, Sumit Singh <sumsingh@nvidia.com> wrote:
> Hi Rafael,

Hi,

> I have a requirement related to runtime PM and system suspend, and need your help for it. Below is the requirement, and the approach I followed:
>
> I want to disable runtime-PM for all the devices, but want to keep system suspend enabled. More precisely, I don't want devices to runtime suspend or even clock-gated when device is idle.
> I want them always to be in full power state. Currently, devices are using runtime PM to get powered at boot time.
>
> I have a requirement where power supply is not a constraint, but system's responsiveness is of critical importance. With runtime-PM enabled, it will incur some delay for the device to come out of runtime suspend state whenever a request comes for it.
> I want to avoid that delay. This is the reason I want to disable runtime PM. System suspend should be working fine.
>
> As upstream has closely integrated runtime PM and system suspend, and also got rid of CONFIG_PM_RUNTIME, so now it is not possible to just disable CONFIG_PM_RUNTIME to disable runtime PM. I tried below two approaches to meet the requirement:
>
> 1.)    The devices that use PM Domains, I set governor as always-on governor, so that devices won't runtime suspend. But, it does not prevent devices from clock-gating. This approach is applicable only for the devices which use PM Domains.
> 2.)    The devices that don't use PM Domains, I tried making changes in individual drivers. For each device, in the probe function, once device is powered-on, I disable runtime PM using runtime PM APIs, so that device won't entertain any
> runtime requests. This way device will be always on.
>
> -  With first approach, devices did not runtime suspend, but were clock-gated. This approach is not applicable to the devices, which don't use PM Domain. System suspend is working fine.
> -  With second approach, devices were not runtime suspended, and were always powered-on. But I had to make changes in each of the driver files. As each of the devices are using runtime PM in different ways, so it was not possible to create a common API which will suit all the devices.
>
> Could you please help me with a cleaner way so that devices don't runtime-suspend (not even clock-gate), and system suspend should be working?

Well, each device has the "control" attribute in sysfs that can be
used to make the device stay in the active metastate all the time.
Why don't you use it?

Thanks,
Rafael

^ permalink raw reply	[flat|nested] 5+ messages in thread

* RE: Need help : Way to disable runtime PM with system suspend enabled
  2016-06-09 12:46 ` Rafael J. Wysocki
@ 2016-06-10  9:54   ` Sumit Singh
  2016-06-10 14:58     ` Alan Stern
  0 siblings, 1 reply; 5+ messages in thread
From: Sumit Singh @ 2016-06-10  9:54 UTC (permalink / raw)
  To: Rafael J. Wysocki
  Cc: rjw@rjwysocki.net, linux-pm@vger.kernel.org, Prashant Gaikwad,
	Bharat Nihalani

Thanks Rafael for the suggestion. I will try with that.
Using pm_runtime_forbid() API, we can do that. Could you please suggest a proper location for using this API, so that it is applicable to all the devices?

Thanks
Sumit Singh

-----Original Message-----
From: rjwysocki@gmail.com [mailto:rjwysocki@gmail.com] On Behalf Of Rafael J. Wysocki
Sent: Thursday, June 09, 2016 6:17 PM
To: Sumit Singh
Cc: rjw@rjwysocki.net; linux-pm@vger.kernel.org; Prashant Gaikwad; Bharat Nihalani
Subject: Re: Need help : Way to disable runtime PM with system suspend enabled

On Thu, Jun 9, 2016 at 9:23 AM, Sumit Singh <sumsingh@nvidia.com> wrote:
> Hi Rafael,

Hi,

> I have a requirement related to runtime PM and system suspend, and need your help for it. Below is the requirement, and the approach I followed:
>
> I want to disable runtime-PM for all the devices, but want to keep system suspend enabled. More precisely, I don't want devices to runtime suspend or even clock-gated when device is idle.
> I want them always to be in full power state. Currently, devices are using runtime PM to get powered at boot time.
>
> I have a requirement where power supply is not a constraint, but system's responsiveness is of critical importance. With runtime-PM enabled, it will incur some delay for the device to come out of runtime suspend state whenever a request comes for it.
> I want to avoid that delay. This is the reason I want to disable runtime PM. System suspend should be working fine.
>
> As upstream has closely integrated runtime PM and system suspend, and also got rid of CONFIG_PM_RUNTIME, so now it is not possible to just disable CONFIG_PM_RUNTIME to disable runtime PM. I tried below two approaches to meet the requirement:
>
> 1.)    The devices that use PM Domains, I set governor as always-on governor, so that devices won't runtime suspend. But, it does not prevent devices from clock-gating. This approach is applicable only for the devices which use PM Domains.
> 2.)    The devices that don't use PM Domains, I tried making changes in individual drivers. For each device, in the probe function, once device is powered-on, I disable runtime PM using runtime PM APIs, so that device won't entertain any
> runtime requests. This way device will be always on.
>
> -  With first approach, devices did not runtime suspend, but were clock-gated. This approach is not applicable to the devices, which don't use PM Domain. System suspend is working fine.
> -  With second approach, devices were not runtime suspended, and were always powered-on. But I had to make changes in each of the driver files. As each of the devices are using runtime PM in different ways, so it was not possible to create a common API which will suit all the devices.
>
> Could you please help me with a cleaner way so that devices don't runtime-suspend (not even clock-gate), and system suspend should be working?

Well, each device has the "control" attribute in sysfs that can be used to make the device stay in the active metastate all the time.
Why don't you use it?

Thanks,
Rafael

-----------------------------------------------------------------------------------
This email message is for the sole use of the intended recipient(s) and may contain
confidential information.  Any unauthorized review, use, disclosure or distribution
is prohibited.  If you are not the intended recipient, please contact the sender by
reply email and destroy all copies of the original message.
-----------------------------------------------------------------------------------

^ permalink raw reply	[flat|nested] 5+ messages in thread

* RE: Need help : Way to disable runtime PM with system suspend enabled
  2016-06-10  9:54   ` Sumit Singh
@ 2016-06-10 14:58     ` Alan Stern
  2016-06-14  8:44       ` Sumit Singh
  0 siblings, 1 reply; 5+ messages in thread
From: Alan Stern @ 2016-06-10 14:58 UTC (permalink / raw)
  To: Sumit Singh
  Cc: Rafael J. Wysocki, rjw@rjwysocki.net, linux-pm@vger.kernel.org,
	Prashant Gaikwad, Bharat Nihalani

On Fri, 10 Jun 2016, Sumit Singh wrote:

> Thanks Rafael for the suggestion. I will try with that.
> Using pm_runtime_forbid() API, we can do that. Could you please suggest a proper location for using this API, so that it is applicable to all the devices?

If you want to change the kernel, you can change the definition of 
pm_runtime_allow() in drivers/base/power/runtime.c.  Just have the 
routine return immediately.  You should also change pm_runtime_init() 
by adding a call to pm_runtime_forbid(dev) at the end.

If you want to change userspace, you can add a udev rule that writes 
"on" to the power/control file for each new device.  But the user could 
override this later on, so it wouldn't be as safe as changing the 
kernel.

Alan Stern


^ permalink raw reply	[flat|nested] 5+ messages in thread

* RE: Need help : Way to disable runtime PM with system suspend enabled
  2016-06-10 14:58     ` Alan Stern
@ 2016-06-14  8:44       ` Sumit Singh
  0 siblings, 0 replies; 5+ messages in thread
From: Sumit Singh @ 2016-06-14  8:44 UTC (permalink / raw)
  To: Alan Stern
  Cc: Rafael J. Wysocki, rjw@rjwysocki.net, linux-pm@vger.kernel.org,
	Prashant Gaikwad, Bharat Nihalani

Thanks Alan. I am trying with the approach that you suggested.

Thanks
Sumit Singh

-----Original Message-----
From: Alan Stern [mailto:stern@rowland.harvard.edu] 
Sent: Friday, June 10, 2016 8:28 PM
To: Sumit Singh
Cc: Rafael J. Wysocki; rjw@rjwysocki.net; linux-pm@vger.kernel.org; Prashant Gaikwad; Bharat Nihalani
Subject: RE: Need help : Way to disable runtime PM with system suspend enabled

On Fri, 10 Jun 2016, Sumit Singh wrote:

> Thanks Rafael for the suggestion. I will try with that.
> Using pm_runtime_forbid() API, we can do that. Could you please suggest a proper location for using this API, so that it is applicable to all the devices?

If you want to change the kernel, you can change the definition of
pm_runtime_allow() in drivers/base/power/runtime.c.  Just have the routine return immediately.  You should also change pm_runtime_init() by adding a call to pm_runtime_forbid(dev) at the end.

If you want to change userspace, you can add a udev rule that writes "on" to the power/control file for each new device.  But the user could override this later on, so it wouldn't be as safe as changing the kernel.

Alan Stern

-----------------------------------------------------------------------------------
This email message is for the sole use of the intended recipient(s) and may contain
confidential information.  Any unauthorized review, use, disclosure or distribution
is prohibited.  If you are not the intended recipient, please contact the sender by
reply email and destroy all copies of the original message.
-----------------------------------------------------------------------------------

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2016-06-14  8:44 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-06-09  7:23 Need help : Way to disable runtime PM with system suspend enabled Sumit Singh
2016-06-09 12:46 ` Rafael J. Wysocki
2016-06-10  9:54   ` Sumit Singh
2016-06-10 14:58     ` Alan Stern
2016-06-14  8:44       ` Sumit Singh

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).