[linux-pm] [PATCH 01/13] PM: Add wake lock api.

Brian Swetland swetland at google.com
Fri Feb 13 06:46:58 PST 2009


[Matthew Garrett <mjg59 at srcf.ucam.org>]
> On Fri, Feb 13, 2009 at 06:24:09AM -0800, Brian Swetland wrote:
> 
> > I think the "what happens when a process crashes and its suspend
> > inhibits are released" issue still needs some thought -- if say a
> > background/service process crashes while holding a lock we want to
> > have the process be able to be restarted by init or whatnot without
> > having to wait for some other activity.  This is a real example we
> > ran into in the past -- telephony process crashes and the device 
> > doesn't get back on the network until the user presses a key, an 
> > alarm fires, etc.
> 
> The easiest way to handle this would seem to be a multiplexing daemon 
> that implements whatever policy a specific use case has. In your case 
> this would do its own reference counting and then implement timeouts for 
> specific applications, perhaps with some kind of acl so arbitrary apps 
> can't take a lock and then fall down a well. If you've got a 
> sufficiently advanced init then you'd be able to flag an application as 
> being in restart state and then have the daemon hold the lock until the 
> application chooses to reacquire it or not, which seems more flexible 
> than any purely kernel-based implementation.

It'd be nice to not have to indirect all userspace suspend inhibits.
If we had the device interface to userspace actually have INHIBIT
and STOP_INHIBIT ops, we could notice if the fd is closed without
actually returning the state to STOP_INHIBIT cleanly.  Add a mechanism
for waiting until somebody exits unexpectedly that init or your monitor
process could use, you avoid the indirection and have a mechanism for
handing over to whatever is responsible for restarting something that's
in an unhappy state.  Too convoluted?

Brian


More information about the linux-pm mailing list