android_kernel_samsung_msm8976/kernel/power
Colin Cross 00ba716c82 freezer: set PF_SUSPEND_TASK flag on tasks that call freeze_processes
Calling freeze_processes sets a global flag that will cause any
process that calls try_to_freeze to enter the refrigerator.  It
skips sending a signal to the current task, but if the current
task ever hits try_to_freeze, all threads will be frozen and the
system will deadlock.

Set a new flag, PF_SUSPEND_TASK, on the task that calls
freeze_processes.  The flag notifies the freezer that the thread
is involved in suspend and should not be frozen.  Also add a
WARN_ON in thaw_processes if the caller does not have the
PF_SUSPEND_TASK flag set to catch if a different task calls
thaw_processes than the one that called freeze_processes, leaving
a task with PF_SUSPEND_TASK permanently set on it.

Threads that spawn off a task with PF_SUSPEND_TASK set (which
swsusp does) will also have PF_SUSPEND_TASK set, preventing them
from freezing while they are helping with suspend, but they need
to be dead by the time suspend is triggered, otherwise they may
run when userspace is expected to be frozen.  Add a WARN_ON in
thaw_processes if more than one thread has the PF_SUSPEND_TASK
flag set.

Change-Id: I621e70c26203a2470b3e60f3f3f5991a00762e09
Reported-and-tested-by: Michael Leun <lkml20130126@newton.leun.net>
Signed-off-by: Colin Cross <ccross@android.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2019-07-27 22:09:18 +02:00
..
Kconfig Import latest Samsung release 2017-04-18 03:43:52 +02:00
Makefile Import latest Samsung release 2017-04-18 03:43:52 +02:00
autosleep.c Import latest Samsung release 2017-04-18 03:43:52 +02:00
block_io.c
console.c
hibernate.c PM / Sleep: fix recovery during resuming from hibernation 2014-11-14 08:48:00 -08:00
main.c PM / Sleep: Print last wakeup source on failed wakeup_count write 2018-05-26 00:39:32 +02:00
power.h PM / sleep: Use valid_state() for platform-dependent sleep states only 2014-10-05 14:54:15 -07:00
poweroff.c
process.c freezer: set PF_SUSPEND_TASK flag on tasks that call freeze_processes 2019-07-27 22:09:18 +02:00
qos.c qos: wake up cores based on the qos updated cpu mask 2016-09-16 05:22:56 -07:00
register_list.h Import latest Samsung release 2017-04-18 03:43:52 +02:00
secpmic_dump.c Import latest Samsung release 2017-04-18 03:43:52 +02:00
snapshot.c
suspend.c Import T813XXS2BRC2 kernel source changes 2018-05-26 00:39:42 +02:00
suspend_test.c PM / sleep: fix device reference leak in test_suspend 2019-07-27 21:42:48 +02:00
suspend_time.c
swap.c
user.c
wakelock.c PM / wakeup: Only update last time for active wakeup sources 2019-07-27 21:52:47 +02:00
wakeup_reason.c Import latest Samsung release 2017-04-18 03:43:52 +02:00