Re: [RFC][PATCH 0/2] PM / Sleep: Extended control of suspend/hibernateinterfaces

From: Alan Stern
Date: Wed Oct 19 2011 - 12:19:23 EST


On Wed, 19 Oct 2011, NeilBrown wrote:

> > There's another way to implement "inhibit suspend" -- via the notify
> > mechanism. If the client doesn't respond to a callback, the server
> > won't suspend. Hence if people use the fd-timer approach,
> > be-awake-after isn't needed.
>
> I don't like that approach though. It leaves the daemon thinking "we are on
> the way towards suspend" and that is what it tells other clients. But really
> we are in state "someone doesn't want us to suspend now".
> So some clients are assuming suspend is imminent and are waiting expectantly
> for it to be over, but in reality the system is staying awake and only one
> client knows about it.

Clients should not make assumptions of that sort. They have no need to
know exactly what the daemon is doing, and there's no reason for the
daemon to tell them.

All a client needs to know is whether or not _it_ is busy, so that it
can provide correct information to the daemon. (Some clients may also
need to be notified each time the system resumes -- that's a separate
matter.) As for the rest, a client may as well assume that the system
is perpetually on the verge of suspending, except when it has
personally told the daemon to stay awake.

On the daemon's side, I don't think there is a significant difference
between "we are on the way toward suspend and waiting for this client's
response" and "this client doesn't want us to suspend now". Either
way, the daemon can't make any forward progress until it hears from
the client -- and the client might send an update at any time.

Alan Stern

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/