public inbox for linux-pm@vger.kernel.org
 help / color / mirror / Atom feed
* PM interface to suspend/resume individual/specific device
@ 2009-07-05 11:33 HU TAO-TGHK48
  2009-07-05 21:30 ` Rafael J. Wysocki
  0 siblings, 1 reply; 4+ messages in thread
From: HU TAO-TGHK48 @ 2009-07-05 11:33 UTC (permalink / raw)
  To: linux-pm

Below command would suspend all of devices and system
# echo mem > /sys/power/state  

How to just suspend/resume one specific devices? E.g.
/sys/devices/platform/serial8250

It would be useful to test the stability of PM interface of individual
driver.
If drivers called earlier refuse to suspend then not able to reach the
suspend/resume function of the specific driver.

And it would be useful for automatic testing since a script can
suspend/resume the specific device for many times without manual
operation.

Is it possible to add "state" for each device?
E.g. 
# echo mem > /sys/devices/platform/serial8250/power/state






 

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

* Re: PM interface to suspend/resume individual/specific device
  2009-07-05 11:33 PM interface to suspend/resume individual/specific device HU TAO-TGHK48
@ 2009-07-05 21:30 ` Rafael J. Wysocki
  2009-07-06 11:01   ` HU TAO-TGHK48
  0 siblings, 1 reply; 4+ messages in thread
From: Rafael J. Wysocki @ 2009-07-05 21:30 UTC (permalink / raw)
  To: HU TAO-TGHK48; +Cc: linux-pm

On Sunday 05 July 2009, HU TAO-TGHK48 wrote:
> Below command would suspend all of devices and system
> # echo mem > /sys/power/state  
> 
> How to just suspend/resume one specific devices? E.g.
> /sys/devices/platform/serial8250
> 
> It would be useful to test the stability of PM interface of individual
> driver.
> If drivers called earlier refuse to suspend then not able to reach the
> suspend/resume function of the specific driver.
> 
> And it would be useful for automatic testing since a script can
> suspend/resume the specific device for many times without manual
> operation.
> 
> Is it possible to add "state" for each device?
> E.g. 
> # echo mem > /sys/devices/platform/serial8250/power/state

No, and you can't suspend individual devices in general.  There is such a
mechanism for USB devices.

The problem is that suspend while entering a system sleep state is generally
a different operation from a suspend done at run time and the latter wouldn't
be suitable for testing the former.

If you need to test the suspend-resume of a driver, please use the
/sys/power/pm_test interface (it works on the entire system, but it doesn't
complete the suspend, so it's suitable for testing).

Thanks,
Rafael

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

* Re: PM interface to suspend/resume individual/specific device
  2009-07-05 21:30 ` Rafael J. Wysocki
@ 2009-07-06 11:01   ` HU TAO-TGHK48
  2009-07-06 20:32     ` Rafael J. Wysocki
  0 siblings, 1 reply; 4+ messages in thread
From: HU TAO-TGHK48 @ 2009-07-06 11:01 UTC (permalink / raw)
  To: Rafael J. Wysocki; +Cc: linux-pm

 
Hi, Rafael

Thank for the answer.

2 more things
A) The suspend/resume API assumes that  all user space process/kthread
access to driver will be frozen first
    This avoids race condition that processes/threads  are accessing
driver while suspend()/resume() of the driver is called at the same
time.
    
    Is my understanding correct?

B) I noticed your "Run-time PM framework" patch was submitted recently
    Do you think it is fair to allow user space to trigger run-time
suspend/resume for specific device?
    Sine the run-time suspend/resume would be system independent per my
understanding.
    


-----Original Message-----
From: Rafael J. Wysocki [mailto:rjw@sisk.pl] 
Sent: Monday, July 06, 2009 5:31 AM
To: HU TAO-TGHK48
Cc: linux-pm@lists.linux-foundation.org
Subject: Re: [linux-pm] PM interface to suspend/resume
individual/specific device

On Sunday 05 July 2009, HU TAO-TGHK48 wrote:
> Below command would suspend all of devices and system # echo mem > 
> /sys/power/state
> 
> How to just suspend/resume one specific devices? E.g.
> /sys/devices/platform/serial8250
> 
> It would be useful to test the stability of PM interface of individual

> driver.
> If drivers called earlier refuse to suspend then not able to reach the

> suspend/resume function of the specific driver.
> 
> And it would be useful for automatic testing since a script can 
> suspend/resume the specific device for many times without manual 
> operation.
> 
> Is it possible to add "state" for each device?
> E.g. 
> # echo mem > /sys/devices/platform/serial8250/power/state

No, and you can't suspend individual devices in general.  There is such
a mechanism for USB devices.

The problem is that suspend while entering a system sleep state is
generally a different operation from a suspend done at run time and the
latter wouldn't be suitable for testing the former.

If you need to test the suspend-resume of a driver, please use the
/sys/power/pm_test interface (it works on the entire system, but it
doesn't complete the suspend, so it's suitable for testing).

Thanks,
Rafael

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

* Re: PM interface to suspend/resume individual/specific device
  2009-07-06 11:01   ` HU TAO-TGHK48
@ 2009-07-06 20:32     ` Rafael J. Wysocki
  0 siblings, 0 replies; 4+ messages in thread
From: Rafael J. Wysocki @ 2009-07-06 20:32 UTC (permalink / raw)
  To: HU TAO-TGHK48; +Cc: linux-pm

On Monday 06 July 2009, HU TAO-TGHK48 wrote:
> 
> Hi, Rafael
> 
> Thank for the answer.
> 
> 2 more things
> A) The suspend/resume API assumes that  all user space process/kthread
> access to driver will be frozen first
>     This avoids race condition that processes/threads  are accessing
> driver while suspend()/resume() of the driver is called at the same
> time.
>     
>     Is my understanding correct?

Generally, it is, but while all user space processes are frozen before every
attempt to put the system into a sleep state, only some of the kernel threads
are frozen.

> B) I noticed your "Run-time PM framework" patch was submitted recently
>     Do you think it is fair to allow user space to trigger run-time
> suspend/resume for specific device?
>
>     Sine the run-time suspend/resume would be system independent per my
> understanding.

There's a problem that the user space can potentially trigger a run-time
suspend of a device at a wrong time.  It's probably better to let the driver
decide.

Best,
Rafael

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

end of thread, other threads:[~2009-07-06 20:32 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-07-05 11:33 PM interface to suspend/resume individual/specific device HU TAO-TGHK48
2009-07-05 21:30 ` Rafael J. Wysocki
2009-07-06 11:01   ` HU TAO-TGHK48
2009-07-06 20:32     ` Rafael J. Wysocki

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox