Skip to contentSkip to conversation

wake up notifications and suspend blocking (aka more wakelock stuff)]

RFC New mark gross 1 participant 1 message Oct 2, 2011

Subsystems (4)
lore
Share & tools
lore

mark gross

author
#0 lore raw

RFC 1/1 wake up notifications and suspend blocking (aka more wakelock stuff)]

Forwarding to bigger group.

----- Forwarded message from mark gross <[email protected]> -----

Subject: Re: [RFC] wake up notifications and suspend blocking (aka more wakelock stuff)
Date: Tue, 20 Sep 2011 13:35:50 -0700
From: mark gross <[email protected]>
To: mark gross <[email protected]>
Reply-To: [email protected]
Cc: [email protected], [email protected], Alan Stern <[email protected]>, [email protected], [email protected], "Rafael J. Wysocki" <[email protected]>

Quoted 1 line

From 640f7d4a5f062d693a05804c0013b303866771da Mon Sep 17 00:00:00 2001

From: mark gross <[email protected]>
Date: Wed, 14 Sep 2011 17:02:36 -0700
Subject: [PATCH 1/2] Wake (from suspend) notification framework. Add user mode hand shake
for non-racy acknowledgment of wake up event by user mode processes that care per wake up source.

This attempts to address the issue of blocking subsequent suspends from happening before every user mode process that cares has a chance to process the last wakeup event. i.e. the wake lock problem.

This version uses select / read / write methods for event delivery and acknowledgment. Also enables the delivery of multiple wake events.

---
 Documentation/power/wakeup_events.txt |   39 ++++++++
 drivers/base/power/wakeup.c           |  171 ++++++++++++++++++++++++++++++++-
 include/linux/pm_wakeup.h             |   41 +++++++--
 3 files changed, 242 insertions(+), 9 deletions(-)
 create mode 100644 Documentation/power/wakeup_events.txt
Documentation/power/wakeup_events.txt new file +39 -0
new file mode 100644
index 0000000..2d79f04
@@ -0,0 +1,39 @@
+Wakeup Event Interface.
+
+This interface provides a notification of wakeup events to user mode processes
+in such a manner that blocks re-entry into suspend until the user mode
+processes that care have explicitly acknowledged the event.
+
+The kernel code to look at for this interface is implemented in:
+drivers/base/power/main.c
+drivers/base/power/wakeup.c
+include/linux/pm_wakeup.h
+
+There are a few assumptions that are made on the behavior of the user mode
+stack WRT requesting entry into the suspend state as well as the behavior of
+the process that request notification of wake up events.  Both are documented
+in this document.
+
+First it is assumed that the user mode power management daemon follow the
+protocol outlined in drivers/base/power/main.c.  See wakeup_count_show.  Which
+blocks while in progress wake events are non zero.
+
+Wake events will stay in progress as long as there are any registered processes
+that have not acknowledged the event or the wakeup source has unbalanced
+pm_stay_awake/pm_relax calls.  When all the processes that care about a given
+wakeup event finish acknowledging the event the read to /sys/power/wakeup_count
+will un block and a subsequent suspend can be attempted.
+
+This interface uses a similar implementation to pm_qos, where misc a device
+node is set up for each registered wakeup_source.  User mode processes register
+for notification by holding an open handle to the misc device associated with
+the wakeup_source.  When the process closes the misc device any pending
+notifications are automatically cleaned up.
+
+The interested process executes a blocking select until there are a non-zero
+number of pending wakeup events, upon unblocking the process can read from the
+file to see how many events are need acknowledgement and they are be
+acknowledged by doing dummy writes of that many bytes to the file.  (the user
+mode data isn't actually copied in the write function just the count is used)
+
+
drivers/base/power/wakeup.c +169 -2

226 lines not on this page · raw message

include/linux/pm_wakeup.h +34 -7

65 lines not on this page · raw message

Signature · 4 lines
1.7.4.1


----- End forwarded message -----