Re: [email@example.com: [RFC] wake up notifications and suspendblocking (aka more wakelock stuff)]
From: Alan Stern
Date: Tue Oct 25 2011 - 11:14:55 EST
On Mon, 24 Oct 2011, mark gross wrote:
> > > Timeout? why can't we define a proper notification handshake for such
> > > things? Timeouts are never right IMO.
> > >
> > I thought that before, but I have come around to the opposite way of thinking
> > thanks to some instructive examples from Alan and Rafael.
> > Some things are simply not visible to the OS. We can expect them to be
> > happening but we cannot be sure and there is no clear signal that they aren't
> > actually happening. So we need a timeout.
> > - USB cannot (I think) know which USB device triggered a wake-from-suspend,
> > and in any case cannot directly ask the device why it woke from suspend.
> > It has to wait for the device to tell it (in response to a regular
> > 'interrupt' poll I assume - but it isn't guaranteed to be reported on the
> > first poll) - or timeout and give up waiting.
> maybe if you are unwilling to change the user mode stack that is reading
> these events. But if you where they you shouldn't need time outs.
Remember, here we are talking about timeouts in the kernel stack, not
in the user-mode stack.
So consider this theoretical situation (which is not very different
from reality): The system gets a wakeup signal. Sometime in the next
30 ms or less, there may or may not be an input event -- the kernel has
no way to tell other than wait and see.
The kernel could simply go right back to sleep without waiting, but if
it does and there is a pending input event, then very quickly it will
get another wakeup signal, and it'll be right back where it started --
trying to decide whether to stay awake for the next 30 ms.
Can you suggest a way to handle this other than using a timeout?
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/