Merge branch 'pm-sleep'
* pm-sleep: PM / Sleep: User space wakeup sources garbage collector Kconfig option PM / Sleep: Make the limit of user space wakeup sources configurable PM / Documentation: suspend-and-cpuhotplug.txt: Fix typo PM / Sleep: Fix a mistake in a conditional in autosleep_store() epoll: Add a flag, EPOLLWAKEUP, to prevent suspend while epoll events are ready PM / Sleep: Add user space interface for manipulating wakeup sources, v3 PM / Sleep: Add "prevent autosleep time" statistics to wakeup sources PM / Sleep: Implement opportunistic sleep, v2 PM / Sleep: Add wakeup_source_activate and wakeup_source_deactivate tracepoints PM / Sleep: Change wakeup source statistics to follow Android PM / Sleep: Use wait queue to signal "no wakeup events in progress" PM / Sleep: Look for wakeup events in later stages of device suspend PM / Hibernate: Hibernate/thaw fixes/improvements
This commit is contained in:
@@ -360,8 +360,11 @@ struct cpu_vfs_cap_data {
|
||||
|
||||
#define CAP_WAKE_ALARM 35
|
||||
|
||||
/* Allow preventing system suspends while epoll events are pending */
|
||||
|
||||
#define CAP_LAST_CAP CAP_WAKE_ALARM
|
||||
#define CAP_EPOLLWAKEUP 36
|
||||
|
||||
#define CAP_LAST_CAP CAP_EPOLLWAKEUP
|
||||
|
||||
#define cap_valid(x) ((x) >= 0 && (x) <= CAP_LAST_CAP)
|
||||
|
||||
|
@@ -26,6 +26,18 @@
|
||||
#define EPOLL_CTL_DEL 2
|
||||
#define EPOLL_CTL_MOD 3
|
||||
|
||||
/*
|
||||
* Request the handling of system wakeup events so as to prevent system suspends
|
||||
* from happening while those events are being processed.
|
||||
*
|
||||
* Assuming neither EPOLLET nor EPOLLONESHOT is set, system suspends will not be
|
||||
* re-allowed until epoll_wait is called again after consuming the wakeup
|
||||
* event(s).
|
||||
*
|
||||
* Requires CAP_EPOLLWAKEUP
|
||||
*/
|
||||
#define EPOLLWAKEUP (1 << 29)
|
||||
|
||||
/* Set the One Shot behaviour for the target file descriptor */
|
||||
#define EPOLLONESHOT (1 << 30)
|
||||
|
||||
|
@@ -33,12 +33,15 @@
|
||||
*
|
||||
* @total_time: Total time this wakeup source has been active.
|
||||
* @max_time: Maximum time this wakeup source has been continuously active.
|
||||
* @last_time: Monotonic clock when the wakeup source's was activated last time.
|
||||
* @last_time: Monotonic clock when the wakeup source's was touched last time.
|
||||
* @prevent_sleep_time: Total time this source has been preventing autosleep.
|
||||
* @event_count: Number of signaled wakeup events.
|
||||
* @active_count: Number of times the wakeup sorce was activated.
|
||||
* @relax_count: Number of times the wakeup sorce was deactivated.
|
||||
* @hit_count: Number of times the wakeup sorce might abort system suspend.
|
||||
* @expire_count: Number of times the wakeup source's timeout has expired.
|
||||
* @wakeup_count: Number of times the wakeup source might abort suspend.
|
||||
* @active: Status of the wakeup source.
|
||||
* @has_timeout: The wakeup source has been activated with a timeout.
|
||||
*/
|
||||
struct wakeup_source {
|
||||
const char *name;
|
||||
@@ -49,11 +52,15 @@ struct wakeup_source {
|
||||
ktime_t total_time;
|
||||
ktime_t max_time;
|
||||
ktime_t last_time;
|
||||
ktime_t start_prevent_time;
|
||||
ktime_t prevent_sleep_time;
|
||||
unsigned long event_count;
|
||||
unsigned long active_count;
|
||||
unsigned long relax_count;
|
||||
unsigned long hit_count;
|
||||
unsigned int active:1;
|
||||
unsigned long expire_count;
|
||||
unsigned long wakeup_count;
|
||||
bool active:1;
|
||||
bool autosleep_enabled:1;
|
||||
};
|
||||
|
||||
#ifdef CONFIG_PM_SLEEP
|
||||
|
@@ -356,8 +356,9 @@ extern int unregister_pm_notifier(struct notifier_block *nb);
|
||||
extern bool events_check_enabled;
|
||||
|
||||
extern bool pm_wakeup_pending(void);
|
||||
extern bool pm_get_wakeup_count(unsigned int *count);
|
||||
extern bool pm_get_wakeup_count(unsigned int *count, bool block);
|
||||
extern bool pm_save_wakeup_count(unsigned int count);
|
||||
extern void pm_wakep_autosleep_enabled(bool set);
|
||||
|
||||
static inline void lock_system_sleep(void)
|
||||
{
|
||||
@@ -407,6 +408,17 @@ static inline void unlock_system_sleep(void) {}
|
||||
|
||||
#endif /* !CONFIG_PM_SLEEP */
|
||||
|
||||
#ifdef CONFIG_PM_AUTOSLEEP
|
||||
|
||||
/* kernel/power/autosleep.c */
|
||||
void queue_up_suspend_work(void);
|
||||
|
||||
#else /* !CONFIG_PM_AUTOSLEEP */
|
||||
|
||||
static inline void queue_up_suspend_work(void) {}
|
||||
|
||||
#endif /* !CONFIG_PM_AUTOSLEEP */
|
||||
|
||||
#ifdef CONFIG_ARCH_SAVE_PAGE_KEYS
|
||||
/*
|
||||
* The ARCH_SAVE_PAGE_KEYS functions can be used by an architecture
|
||||
|
Reference in New Issue
Block a user