2019-01-22 13:43:10 +00:00
|
|
|
From cb52eb3639182ef80cef00cea2af2573190875a3 Mon Sep 17 00:00:00 2001
|
|
|
|
From: Jake Day <jake@ninebysix.com>
|
|
|
|
Date: Tue, 22 Jan 2019 08:37:00 -0500
|
|
|
|
Subject: [PATCH 02/11] resume-delay
|
2018-10-28 12:52:45 +00:00
|
|
|
|
|
|
|
---
|
|
|
|
kernel/power/suspend.c | 11 +++++++++++
|
|
|
|
kernel/sysctl.c | 9 +++++++++
|
|
|
|
2 files changed, 20 insertions(+)
|
|
|
|
|
|
|
|
diff --git a/kernel/power/suspend.c b/kernel/power/suspend.c
|
|
|
|
index 87331565e505..d55f949ee25a 100644
|
|
|
|
--- a/kernel/power/suspend.c
|
|
|
|
+++ b/kernel/power/suspend.c
|
|
|
|
@@ -520,6 +520,8 @@ int suspend_devices_and_enter(suspend_state_t state)
|
|
|
|
goto Resume_devices;
|
|
|
|
}
|
|
|
|
|
|
|
|
+unsigned int resume_delay = 3000;
|
|
|
|
+
|
|
|
|
/**
|
|
|
|
* suspend_finish - Clean up before finishing the suspend sequence.
|
|
|
|
*
|
|
|
|
@@ -528,6 +530,15 @@ int suspend_devices_and_enter(suspend_state_t state)
|
|
|
|
*/
|
|
|
|
static void suspend_finish(void)
|
|
|
|
{
|
|
|
|
+ if (resume_delay) {
|
|
|
|
+ /* Give kernel threads a head start, such that usb-storage
|
|
|
|
+ * can detect devices before syslog attempts to write log
|
|
|
|
+ * messages from the suspend code.
|
|
|
|
+ */
|
|
|
|
+ thaw_kernel_threads();
|
|
|
|
+ pr_debug("PM: Sleeping for %d milliseconds.\n", resume_delay);
|
|
|
|
+ msleep(resume_delay);
|
|
|
|
+ }
|
|
|
|
suspend_thaw_processes();
|
|
|
|
pm_notifier_call_chain(PM_POST_SUSPEND);
|
|
|
|
pm_restore_console();
|
|
|
|
diff --git a/kernel/sysctl.c b/kernel/sysctl.c
|
|
|
|
index 2d9837c0aff4..ac704bf71f45 100644
|
|
|
|
--- a/kernel/sysctl.c
|
|
|
|
+++ b/kernel/sysctl.c
|
|
|
|
@@ -308,7 +308,16 @@ static int min_extfrag_threshold;
|
|
|
|
static int max_extfrag_threshold = 1000;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
+extern unsigned int resume_delay;
|
|
|
|
+
|
|
|
|
static struct ctl_table kern_table[] = {
|
|
|
|
+ {
|
|
|
|
+ .procname = "resume_delay",
|
|
|
|
+ .data = &resume_delay,
|
|
|
|
+ .maxlen = sizeof(unsigned int),
|
|
|
|
+ .mode = 0644,
|
|
|
|
+ .proc_handler = proc_dointvec,
|
|
|
|
+ },
|
|
|
|
{
|
|
|
|
.procname = "sched_child_runs_first",
|
|
|
|
.data = &sysctl_sched_child_runs_first,
|
|
|
|
--
|
2019-01-22 13:43:10 +00:00
|
|
|
2.17.1
|
2018-10-28 12:52:45 +00:00
|
|
|
|