From: mark gross <markgross@thegnar.org>
To: mark gross <markgross@thegnar.org>
Cc: NeilBrown <neilb@suse.de>,
linux-kernel@vger.kernel.org,
John Stultz <john.stultz@linaro.org>,
"Rafael J. Wysocki" <rjw@sisk.pl>,
arve@android.com, Alan Stern <stern@rowland.harvard.edu>,
amit.kucheria@linaro.org, farrowg@sg.ibm.com,
"Dmitry Fink (Palm GBU)" <Dmitry.Fink@palm.com>,
linux-pm@lists.linux-foundation.org, khilman@ti.com,
Magnus Damm <damm@opensource.se>,
mjg@redhat.com, peterz@infradead.org
Subject: Re: [markgross@thengar.org: [RFC] wake up notifications and suspend blocking (aka more wakelock stuff)]
Date: Sat, 15 Oct 2011 07:05:37 -0700 [thread overview]
Message-ID: <20111015140537.GA19162@mgross-G62> (raw)
In-Reply-To: <20111014140116.GC27295@mgross-G62>
On Fri, Oct 14, 2011 at 07:01:16AM -0700, mark gross wrote:
> On Thu, Oct 13, 2011 at 04:35:26PM +1100, NeilBrown wrote:
> > On Wed, 12 Oct 2011 20:48:05 -0700 mark gross <markgross@thegnar.org> wrote:
> >
snip
> > Can you describe a race?
> > Here is the sequence as I see it.
> >
> > 0: some user-space process is blocking suspend by telling the suspend daemon
> > not to suspend. There are no pending kernel wakeup events.
> > All processes that handle wakeup events are registered with the daemon.
> > 1: last blocking user-space process releases its "don't suspend" lock.
> > 2: suspend-daemon decides to initiate suspend.
> > 3: suspend_daemon reads wakeup_count and remembers number.
> > 4: suspend daemon tells all registered clients that suspend is imminent.
> > 5: each client executes 'poll' or 'select' or whatever and discovers that
> > there are no events.
> > 6: each client tells daemon that it is OK to suspend
> > 7: when all votes are in, suspend daemon checks that no process is requesting
> > that suspend be blocked.
> > 8: if that succeeds, suspend daemon writes the number back to wakeup_count
> > 9: if that succeeds, suspend daemon daemon writes 'mem' to 'state'.
> > 10: goto 1
> >
> > If a wake_event happens after 3 and before 8, the write at 8 will fail.
> > If a wake_event happens after 8, and before 9, the suspend will abort.
> > If a wake_event happens after 9, the suspend will resume
> > If a wake_event happens before 3, one of the processes will get an event
> > notification from select or poll or whatever, and will ask the suspend
> > daemon not to suspend just now and this will be noticed at 7, so 8 and 9
> > will be skipped and we go straight to 10.
> >
> > No race.
>
> With the suspend daemon designed as above I see no race either. I was
> thinking of a more trivial suspend daemon design and trying to fix it up
> in the kernel.
>
After responding to this yesterday I still feel I'm missing something
with respect to wake event acknowledgment. After a wake source becomes
active how does it know its ok to become deactivate at the driver level?
The race I'm now worried about is say a button press going up through
the event layers. The event manager process, or X, (registered with the
suspend daemon) is in a race to get the event and the socket based
notification handshake described above.
i.e. how is the key event delivery vrs unblocking of the suspend-daemon
read of wakeup_count in step 3 race dealt with?
Sorry for getting confused and flip flopping on you. This is pretty
subtle stuff for me.
--mark
next prev parent reply other threads:[~2011-10-15 14:05 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-10-02 16:44 mark gross
2011-10-08 11:14 ` NeilBrown
2011-10-08 18:16 ` mark gross
2011-10-08 18:57 ` Rafael J. Wysocki
2011-10-08 20:07 ` Alan Stern
2011-10-13 3:07 ` mark gross
2011-10-13 15:06 ` Alan Stern
2011-10-14 13:23 ` mark gross
2011-10-13 2:59 ` mark gross
2011-10-08 22:31 ` NeilBrown
2011-10-13 3:48 ` mark gross
2011-10-13 5:35 ` NeilBrown
2011-10-13 15:16 ` Alan Stern
2011-10-14 21:47 ` NeilBrown
2011-10-15 18:45 ` Alan Stern
2011-10-15 22:25 ` NeilBrown
2011-10-16 1:49 ` Alan Stern
2011-10-16 21:37 ` NeilBrown
2011-10-24 1:18 ` mark gross
2011-10-24 1:50 ` NeilBrown
2011-10-25 4:50 ` mark gross
2011-10-25 15:14 ` Alan Stern
2011-10-25 7:05 ` Brian Swetland
2011-10-14 14:01 ` mark gross
2011-10-15 14:05 ` mark gross [this message]
2011-10-15 22:12 ` NeilBrown
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20111015140537.GA19162@mgross-G62 \
--to=markgross@thegnar.org \
--cc=Dmitry.Fink@palm.com \
--cc=amit.kucheria@linaro.org \
--cc=arve@android.com \
--cc=damm@opensource.se \
--cc=farrowg@sg.ibm.com \
--cc=john.stultz@linaro.org \
--cc=khilman@ti.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@lists.linux-foundation.org \
--cc=mjg@redhat.com \
--cc=neilb@suse.de \
--cc=peterz@infradead.org \
--cc=rjw@sisk.pl \
--cc=stern@rowland.harvard.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®