lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Mon, 24 Oct 2011 12:50:34 +1100
From:	NeilBrown <neilb@...e.de>
To:	markgross@...gnar.org
Cc:	Alan Stern <stern@...land.harvard.edu>,
	linux-kernel@...r.kernel.org, John Stultz <john.stultz@...aro.org>,
	"Rafael J. Wysocki" <rjw@...k.pl>, arve@...roid.com,
	amit.kucheria@...aro.org, farrowg@...ibm.com,
	"Dmitry Fink (Palm GBU)" <Dmitry.Fink@...m.com>,
	linux-pm@...ts.linux-foundation.org, khilman@...com,
	Magnus Damm <damm@...nsource.se>, mjg@...hat.com,
	peterz@...radead.org
Subject: Re: [markgross@...ngar.org: [RFC] wake up notifications and suspend
 blocking (aka more wakelock stuff)]

On Sun, 23 Oct 2011 18:18:04 -0700 mark gross <markgross@...gnar.org> wrote:

> Sorry for going AWOL on this thread.  I had some biz travel and fires to
> fight.

:-)  Life happens.  Welcome back.


> > So it is a good example and highlights the difficulty of defining exactly
> > what a wake-up event it, and of what it means to be "visible".
> > 
> > I think it still fits in your rephrasing of my question which - if I rephrase
> > it as a requirement - is roughly,
> > 
> >   A wakeup-event that needs to be handled by user-space must be visible to
> >   user-space before the driver deactivates the wakeup_source.
> > 
> > A requirement which, in this case, means the driver needs to hold  the
> > wakeup_source for an extended time using a timeout, just as you say.
> 
> 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.

- OS cannot detect state of user's brain, so uses a time-out to blank the
  screen after a period of inactivity.
- 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.
- A wake-on-Lan packet may wake a suspend up, but not be further visible to
  the OS.  And even if it was, the 'SYN' packet or maybe 'ARP' packet that
  might be expected to follow it is invisible until it actually arrives, and
  it may not ever come.  So we need a timeout to give up waiting after a
  while.

When-ever we are dealing with external events we need timeouts - and
wake-from-suspend is primarily about external events.

So *somewhere* in the handling of wakeup events there must be timeouts.
Whether that should be explicit in the wakeup-source is possibly a separate
question.  Maybe you could argue that the low level device driver must have
timeouts anyway, so it should use them to explicitly deactivate the source
rather than the source having it's own timeout.
I'm not sure that argument would work though it might.
But saying "Timeouts are never right" cannot work - unless you mean it in a
much more restricted sense than I think you mean it.

(I can agree that it is *best* if timeouts never fire - if direct action
causes the wakeup-source to deactivate long before the timeout.  I agree that
is the best case and probably should be the common case, but I cannot see how
it can be the only case).

Thanks,
NeilBrown

Download attachment "signature.asc" of type "application/pgp-signature" (829 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ