Re: [PATCH 01/13] PM: Add wake lock api.

Uli Luckas
2009-02-13T16:46:42Z

On Friday, 13. February 2009, Matthew Garrett wrote:
> 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.
That's racy. By the time the daemon notices that a process crashed, the kernel
might already have triggered suspend. userspace might then be frozen before
it can accuire the 'process restarting' lock.
I also wonder, if it is immanently racy to use userspcae communication
(client/daemon) for suspend locks. What if the daemon is already frozen when
a client sends a lock request request?

Uli

--

------- ROAD ...the handyPC Company - - - ) ) )

Uli Luckas
Head of Software Development

ROAD GmbH
Bennigsenstr. 14 | 12159 Berlin | Germany
fon: +49 (30) 230069 - 62 | fax: +49 (30) 230069 - 69
url: www.road.de

Amtsgericht Charlottenburg: HRB 96688 B
Managing director: Hans-Peter Constien