aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/power
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/power')
-rw-r--r--kernel/power/Kconfig9
-rw-r--r--kernel/power/hibernate.c17
-rw-r--r--kernel/power/main.c14
-rw-r--r--kernel/power/snapshot.c5
-rw-r--r--kernel/power/suspend.c17
-rw-r--r--kernel/power/user.c5
6 files changed, 41 insertions, 26 deletions
diff --git a/kernel/power/Kconfig b/kernel/power/Kconfig
index f8fe57d1022e..9bbaaab14b36 100644
--- a/kernel/power/Kconfig
+++ b/kernel/power/Kconfig
@@ -114,6 +114,15 @@ config PM_SLEEP_SMP
114 depends on PM_SLEEP 114 depends on PM_SLEEP
115 select HOTPLUG_CPU 115 select HOTPLUG_CPU
116 116
117config PM_SLEEP_SMP_NONZERO_CPU
118 def_bool y
119 depends on PM_SLEEP_SMP
120 depends on ARCH_SUSPEND_NONZERO_CPU
121 ---help---
122 If an arch can suspend (for suspend, hibernate, kexec, etc) on a
123 non-zero numbered CPU, it may define ARCH_SUSPEND_NONZERO_CPU. This
124 will allow nohz_full mask to include CPU0.
125
117config PM_AUTOSLEEP 126config PM_AUTOSLEEP
118 bool "Opportunistic sleep" 127 bool "Opportunistic sleep"
119 depends on PM_SLEEP 128 depends on PM_SLEEP
diff --git a/kernel/power/hibernate.c b/kernel/power/hibernate.c
index abef759de7c8..c8c272df7154 100644
--- a/kernel/power/hibernate.c
+++ b/kernel/power/hibernate.c
@@ -14,7 +14,6 @@
14 14
15#include <linux/export.h> 15#include <linux/export.h>
16#include <linux/suspend.h> 16#include <linux/suspend.h>
17#include <linux/syscalls.h>
18#include <linux/reboot.h> 17#include <linux/reboot.h>
19#include <linux/string.h> 18#include <linux/string.h>
20#include <linux/device.h> 19#include <linux/device.h>
@@ -281,7 +280,7 @@ static int create_image(int platform_mode)
281 if (error || hibernation_test(TEST_PLATFORM)) 280 if (error || hibernation_test(TEST_PLATFORM))
282 goto Platform_finish; 281 goto Platform_finish;
283 282
284 error = disable_nonboot_cpus(); 283 error = suspend_disable_secondary_cpus();
285 if (error || hibernation_test(TEST_CPUS)) 284 if (error || hibernation_test(TEST_CPUS))
286 goto Enable_cpus; 285 goto Enable_cpus;
287 286
@@ -323,7 +322,7 @@ static int create_image(int platform_mode)
323 local_irq_enable(); 322 local_irq_enable();
324 323
325 Enable_cpus: 324 Enable_cpus:
326 enable_nonboot_cpus(); 325 suspend_enable_secondary_cpus();
327 326
328 Platform_finish: 327 Platform_finish:
329 platform_finish(platform_mode); 328 platform_finish(platform_mode);
@@ -417,7 +416,7 @@ int hibernation_snapshot(int platform_mode)
417 416
418int __weak hibernate_resume_nonboot_cpu_disable(void) 417int __weak hibernate_resume_nonboot_cpu_disable(void)
419{ 418{
420 return disable_nonboot_cpus(); 419 return suspend_disable_secondary_cpus();
421} 420}
422 421
423/** 422/**
@@ -486,7 +485,7 @@ static int resume_target_kernel(bool platform_mode)
486 local_irq_enable(); 485 local_irq_enable();
487 486
488 Enable_cpus: 487 Enable_cpus:
489 enable_nonboot_cpus(); 488 suspend_enable_secondary_cpus();
490 489
491 Cleanup: 490 Cleanup:
492 platform_restore_cleanup(platform_mode); 491 platform_restore_cleanup(platform_mode);
@@ -564,7 +563,7 @@ int hibernation_platform_enter(void)
564 if (error) 563 if (error)
565 goto Platform_finish; 564 goto Platform_finish;
566 565
567 error = disable_nonboot_cpus(); 566 error = suspend_disable_secondary_cpus();
568 if (error) 567 if (error)
569 goto Enable_cpus; 568 goto Enable_cpus;
570 569
@@ -586,7 +585,7 @@ int hibernation_platform_enter(void)
586 local_irq_enable(); 585 local_irq_enable();
587 586
588 Enable_cpus: 587 Enable_cpus:
589 enable_nonboot_cpus(); 588 suspend_enable_secondary_cpus();
590 589
591 Platform_finish: 590 Platform_finish:
592 hibernation_ops->finish(); 591 hibernation_ops->finish();
@@ -709,9 +708,7 @@ int hibernate(void)
709 goto Exit; 708 goto Exit;
710 } 709 }
711 710
712 pr_info("Syncing filesystems ... \n"); 711 ksys_sync_helper();
713 ksys_sync();
714 pr_info("done.\n");
715 712
716 error = freeze_processes(); 713 error = freeze_processes();
717 if (error) 714 if (error)
diff --git a/kernel/power/main.c b/kernel/power/main.c
index 98e76cad128b..4f43e724f6eb 100644
--- a/kernel/power/main.c
+++ b/kernel/power/main.c
@@ -16,6 +16,7 @@
16#include <linux/debugfs.h> 16#include <linux/debugfs.h>
17#include <linux/seq_file.h> 17#include <linux/seq_file.h>
18#include <linux/suspend.h> 18#include <linux/suspend.h>
19#include <linux/syscalls.h>
19 20
20#include "power.h" 21#include "power.h"
21 22
@@ -51,6 +52,19 @@ void unlock_system_sleep(void)
51} 52}
52EXPORT_SYMBOL_GPL(unlock_system_sleep); 53EXPORT_SYMBOL_GPL(unlock_system_sleep);
53 54
55void ksys_sync_helper(void)
56{
57 ktime_t start;
58 long elapsed_msecs;
59
60 start = ktime_get();
61 ksys_sync();
62 elapsed_msecs = ktime_to_ms(ktime_sub(ktime_get(), start));
63 pr_info("Filesystems sync: %ld.%03ld seconds\n",
64 elapsed_msecs / MSEC_PER_SEC, elapsed_msecs % MSEC_PER_SEC);
65}
66EXPORT_SYMBOL_GPL(ksys_sync_helper);
67
54/* Routines for PM-transition notifications */ 68/* Routines for PM-transition notifications */
55 69
56static BLOCKING_NOTIFIER_HEAD(pm_chain_head); 70static BLOCKING_NOTIFIER_HEAD(pm_chain_head);
diff --git a/kernel/power/snapshot.c b/kernel/power/snapshot.c
index f08a1e4ee1d4..bc9558ab1e5b 100644
--- a/kernel/power/snapshot.c
+++ b/kernel/power/snapshot.c
@@ -1342,8 +1342,9 @@ static inline void do_copy_page(long *dst, long *src)
1342 * safe_copy_page - Copy a page in a safe way. 1342 * safe_copy_page - Copy a page in a safe way.
1343 * 1343 *
1344 * Check if the page we are going to copy is marked as present in the kernel 1344 * Check if the page we are going to copy is marked as present in the kernel
1345 * page tables (this always is the case if CONFIG_DEBUG_PAGEALLOC is not set 1345 * page tables. This always is the case if CONFIG_DEBUG_PAGEALLOC or
1346 * and in that case kernel_page_present() always returns 'true'). 1346 * CONFIG_ARCH_HAS_SET_DIRECT_MAP is not set. In that case kernel_page_present()
1347 * always returns 'true'.
1347 */ 1348 */
1348static void safe_copy_page(void *dst, struct page *s_page) 1349static void safe_copy_page(void *dst, struct page *s_page)
1349{ 1350{
diff --git a/kernel/power/suspend.c b/kernel/power/suspend.c
index 0bd595a0b610..ef908c134b34 100644
--- a/kernel/power/suspend.c
+++ b/kernel/power/suspend.c
@@ -17,7 +17,6 @@
17#include <linux/console.h> 17#include <linux/console.h>
18#include <linux/cpu.h> 18#include <linux/cpu.h>
19#include <linux/cpuidle.h> 19#include <linux/cpuidle.h>
20#include <linux/syscalls.h>
21#include <linux/gfp.h> 20#include <linux/gfp.h>
22#include <linux/io.h> 21#include <linux/io.h>
23#include <linux/kernel.h> 22#include <linux/kernel.h>
@@ -428,7 +427,7 @@ static int suspend_enter(suspend_state_t state, bool *wakeup)
428 if (suspend_test(TEST_PLATFORM)) 427 if (suspend_test(TEST_PLATFORM))
429 goto Platform_wake; 428 goto Platform_wake;
430 429
431 error = disable_nonboot_cpus(); 430 error = suspend_disable_secondary_cpus();
432 if (error || suspend_test(TEST_CPUS)) 431 if (error || suspend_test(TEST_CPUS))
433 goto Enable_cpus; 432 goto Enable_cpus;
434 433
@@ -458,7 +457,7 @@ static int suspend_enter(suspend_state_t state, bool *wakeup)
458 BUG_ON(irqs_disabled()); 457 BUG_ON(irqs_disabled());
459 458
460 Enable_cpus: 459 Enable_cpus:
461 enable_nonboot_cpus(); 460 suspend_enable_secondary_cpus();
462 461
463 Platform_wake: 462 Platform_wake:
464 platform_resume_noirq(state); 463 platform_resume_noirq(state);
@@ -568,13 +567,11 @@ static int enter_state(suspend_state_t state)
568 if (state == PM_SUSPEND_TO_IDLE) 567 if (state == PM_SUSPEND_TO_IDLE)
569 s2idle_begin(); 568 s2idle_begin();
570 569
571#ifndef CONFIG_SUSPEND_SKIP_SYNC 570 if (!IS_ENABLED(CONFIG_SUSPEND_SKIP_SYNC)) {
572 trace_suspend_resume(TPS("sync_filesystems"), 0, true); 571 trace_suspend_resume(TPS("sync_filesystems"), 0, true);
573 pr_info("Syncing filesystems ... "); 572 ksys_sync_helper();
574 ksys_sync(); 573 trace_suspend_resume(TPS("sync_filesystems"), 0, false);
575 pr_cont("done.\n"); 574 }
576 trace_suspend_resume(TPS("sync_filesystems"), 0, false);
577#endif
578 575
579 pm_pr_dbg("Preparing system for sleep (%s)\n", mem_sleep_labels[state]); 576 pm_pr_dbg("Preparing system for sleep (%s)\n", mem_sleep_labels[state]);
580 pm_suspend_clear_flags(); 577 pm_suspend_clear_flags();
diff --git a/kernel/power/user.c b/kernel/power/user.c
index 2d8b60a3c86b..cb24e840a3e6 100644
--- a/kernel/power/user.c
+++ b/kernel/power/user.c
@@ -10,7 +10,6 @@
10 */ 10 */
11 11
12#include <linux/suspend.h> 12#include <linux/suspend.h>
13#include <linux/syscalls.h>
14#include <linux/reboot.h> 13#include <linux/reboot.h>
15#include <linux/string.h> 14#include <linux/string.h>
16#include <linux/device.h> 15#include <linux/device.h>
@@ -228,9 +227,7 @@ static long snapshot_ioctl(struct file *filp, unsigned int cmd,
228 if (data->frozen) 227 if (data->frozen)
229 break; 228 break;
230 229
231 printk("Syncing filesystems ... "); 230 ksys_sync_helper();
232 ksys_sync();
233 printk("done.\n");
234 231
235 error = freeze_processes(); 232 error = freeze_processes();
236 if (error) 233 if (error)