android_kernel_google_msm/kernel
Liu ShuoX 3da71738d2 PM / Sleep: avoid 'autosleep' in shutdown progress
commit e5248a111b upstream.

Prevent automatic system suspend from happening during system
shutdown by making try_to_suspend() check system_state and return
immediately if it is not SYSTEM_RUNNING.

This prevents the following breakage from happening (scenario from
Zhang Yanmin):

 Kernel starts shutdown and calls all device driver's shutdown
 callback.  When a driver's shutdown is called, the last wakelock is
 released and suspend-to-ram starts.  However, as some driver's shut
 down callbacks already shut down devices and disabled runtime pm,
 the suspend-to-ram calls driver's suspend callback without noticing
 that device is already off and causes crash.

Change-Id: I09261fe136713cb6bdd66e061a9e886d077324c5
[rjw: Changelog]
Signed-off-by: Liu ShuoX <shuox.liu@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit 426b7d5074424aab388af948ba75a5e1c8b9a702)
2017-10-15 17:05:14 +03:00
..
debug
events perf: don't leave group_entry on sibling list (use-after-free) 2017-06-07 13:08:01 -06:00
gcov
irq PM: wakeup_reasons: fix race condition 2017-10-15 17:05:09 +03:00
power PM / Sleep: avoid 'autosleep' in shutdown progress 2017-10-15 17:05:14 +03:00
sched kernel: Only expose su when daemon is running 2017-05-19 18:41:25 -06:00
time tick: Upstream fixes 2017-08-25 20:00:22 +03:00
trace ring-buffer: Prevent overflow of size in ring_buffer_resize() 2017-06-26 21:35:28 +03:00
.gitignore kernel/hz.bc: ignore. 2016-10-29 23:12:15 +08:00
acct.c
async.c
audit.c
audit.h
audit_tree.c VFS: Make clone_mnt()/copy_tree()/collect_mounts() return errors 2015-07-13 11:17:46 -07:00
audit_watch.c get rid of kern_path_parent() 2017-09-22 19:11:54 +03:00
auditfilter.c
auditsc.c BACKPORT: audit: fix a double fetch in audit_log_single_execve_arg() 2016-11-11 13:44:38 +11:00
backtracetest.c
bounds.c
capability.c
cgroup.c move d_rcu from overlapping d_child to overlapping d_alias 2017-09-22 19:11:55 +03:00
cgroup_freezer.c
compat.c
configs.c
cpu.c cpu: Handle smpboot_unpark_threads() uniformly 2016-10-29 23:12:40 +08:00
cpu_pm.c
cpuset.c
crash_dump.c
cred.c
delayacct.c
dma.c
elfcore.c
exec_domain.c
exit.c kernel: Only expose su when daemon is running 2017-05-19 18:41:25 -06:00
extable.c
fork.c kernel: Only expose su when daemon is running 2017-05-19 18:41:25 -06:00
freezer.c freezer: skip waking up tasks with PF_FREEZER_SKIP set 2013-07-12 14:22:56 -07:00
futex.c futex: Make lookup_pi_state more robust 2014-06-11 15:16:22 -07:00
futex_compat.c
groups.c
hrtimer.c hrtimer: Provide clock_was_set_delayed() 2017-08-25 20:00:23 +03:00
hung_task.c
irq_work.c
itimer.c
jump_label.c
kallsyms.c
Kconfig.freezer
Kconfig.hz
Kconfig.locks
Kconfig.preempt
kexec.c
kfifo.c
kmod.c
kprobes.c
ksysfs.c rcu: Add a module parameter to force use of expedited RCU primitives 2016-10-29 23:12:17 +08:00
kthread.c kthread: Fix the race condition when kthread is parked 2016-10-29 23:12:39 +08:00
latencytop.c
lglock.c brlocks/lglocks: turn into functions 2015-07-13 11:17:40 -07:00
lockdep.c lockdep: remove task argument from debug_check_no_locks_held 2013-07-12 14:22:56 -07:00
lockdep_internals.h
lockdep_proc.c
lockdep_states.h
Makefile hotplug: Fix UP bug in smpboot hotplug code 2016-10-29 23:12:39 +08:00
module.c
mutex-debug.c
mutex-debug.h
mutex.c
mutex.h
notifier.c
nsproxy.c userns: make each net (net_ns) belong to a user_ns 2017-09-01 13:38:07 +03:00
padata.c
panic.c panic: resume console if panic after console suspend. 2013-09-09 17:16:14 -07:00
params.c
pid.c proc: Usable inode numbers for the namespace file descriptors. 2015-07-13 11:18:01 -07:00
pid_namespace.c proc: Usable inode numbers for the namespace file descriptors. 2015-07-13 11:18:01 -07:00
posix-cpu-timers.c
posix-timers.c
printk.c flo: Put device-specific code behind #ifndef CONFIG_UML. 2015-05-20 15:22:06 +09:00
profile.c
ptrace.c __ptrace_may_access() should not deny sub-threads 2016-10-29 23:12:26 +08:00
range.c
rcu.h rcu: Add a module parameter to force use of expedited RCU primitives 2016-10-29 23:12:17 +08:00
rcupdate.c rcu: Make exit_rcu() more precise and consolidate 2016-10-29 23:12:17 +08:00
rcutiny.c
rcutiny_plugin.h rcu: Make exit_rcu() more precise and consolidate 2016-10-29 23:12:17 +08:00
rcutorture.c
rcutree.c rcu: Use smp_hotplug_thread facility for RCUs per-CPU kthread 2016-10-29 23:12:39 +08:00
rcutree.h rcu: Use smp_hotplug_thread facility for RCUs per-CPU kthread 2016-10-29 23:12:39 +08:00
rcutree_plugin.h rcu: Use smp_hotplug_thread facility for RCUs per-CPU kthread 2016-10-29 23:12:39 +08:00
rcutree_trace.c rcu: Use smp_hotplug_thread facility for RCUs per-CPU kthread 2016-10-29 23:12:39 +08:00
relay.c
res_counter.c
resource.c kernel: Restrict permissions of /proc/iomem. 2016-06-03 11:56:04 -07:00
rtmutex-debug.c
rtmutex-debug.h
rtmutex-tester.c
rtmutex.c
rtmutex.h
rtmutex_common.h
rwsem.c
seccomp.c seccomp: Use atomic operations that are present in kernel 3.4. 2014-10-31 19:46:31 -07:00
semaphore.c
signal.c signal, x86: add SIGSYS info and make it synchronous. 2014-10-31 19:46:15 -07:00
smp.c smp, idle: Allocate idle thread for each possible cpu during boot 2016-10-29 23:12:38 +08:00
smpboot.c smpboot: use kmemleak_not_leak for smpboot_thread_data 2016-10-29 23:12:40 +08:00
smpboot.h smpboot: Provide infrastructure for percpu hotplug threads 2016-10-29 23:12:39 +08:00
softirq.c softirq: Use hotplug thread infrastructure 2016-10-29 23:12:39 +08:00
spinlock.c
srcu.c
stacktrace.c
stop_machine.c stop_machine: Mark per cpu stopper enabled early 2016-10-29 23:12:39 +08:00
sys.c userns: Add kuid_t and kgid_t and associated infrastructure in uidgid.h 2017-09-01 13:38:06 +03:00
sys_ni.c seccomp: add "seccomp" syscall 2014-10-31 19:46:27 -07:00
sysctl.c FROMLIST: mm: mmap: Add new /proc tunable for mmap_base ASLR. 2016-10-29 23:12:40 +08:00
sysctl_binary.c
taskstats.c
test_kprobes.c
time.c jiffies: Fix timeval conversion to jiffies 2016-10-29 23:12:15 +08:00
timeconst.bc kernel: Replace timeconst.pl with a bc script 2016-10-29 23:12:15 +08:00
timer.c tick: Upstream fixes 2017-08-25 20:00:22 +03:00
tracepoint.c
tsacct.c
uid16.c
up.c
user-return-notifier.c
user.c proc: Usable inode numbers for the namespace file descriptors. 2015-07-13 11:18:01 -07:00
user_namespace.c proc: Usable inode numbers for the namespace file descriptors. 2015-07-13 11:18:01 -07:00
utsname.c proc: Usable inode numbers for the namespace file descriptors. 2015-07-13 11:18:01 -07:00
utsname_sysctl.c
wait.c
watchdog.c
workqueue.c time: Remove CONFIG_TIMER_STATS 2017-07-02 13:03:26 +03:00
workqueue_sched.h