]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
power/suspend: Add function to disable secondaries for suspend
authorNicholas Piggin <npiggin@gmail.com>
Thu, 11 Apr 2019 03:34:45 +0000 (13:34 +1000)
committerIngo Molnar <mingo@kernel.org>
Fri, 3 May 2019 17:42:41 +0000 (19:42 +0200)
This adds a function to disable secondary CPUs for suspend that are
not necessarily non-zero / non-boot CPUs. Platforms will be able to
use this to suspend using non-zero CPUs.

Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Rafael J . Wysocki <rafael.j.wysocki@intel.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: linuxppc-dev@lists.ozlabs.org
Link: https://lkml.kernel.org/r/20190411033448.20842-3-npiggin@gmail.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
include/linux/cpu.h
kernel/kexec_core.c
kernel/power/hibernate.c
kernel/power/suspend.c

index 5041357d0297afdce8b5605970947b34f85e7205..7ab2f09c0a14670faf22aa95d16cad5154edcd10 100644 (file)
@@ -137,9 +137,21 @@ static inline int disable_nonboot_cpus(void)
        return freeze_secondary_cpus(0);
 }
 extern void enable_nonboot_cpus(void);
+
+static inline int suspend_disable_secondary_cpus(void)
+{
+       return freeze_secondary_cpus(0);
+}
+static inline void suspend_enable_secondary_cpus(void)
+{
+       return enable_nonboot_cpus();
+}
+
 #else /* !CONFIG_PM_SLEEP_SMP */
 static inline int disable_nonboot_cpus(void) { return 0; }
 static inline void enable_nonboot_cpus(void) {}
+static inline int suspend_disable_secondary_cpus(void) { return 0; }
+static inline void suspend_enable_secondary_cpus(void) { }
 #endif /* !CONFIG_PM_SLEEP_SMP */
 
 void cpu_startup_entry(enum cpuhp_state state);
index d7140447be75b809c5f5979d7be280c2f46de1c2..fd5c95ff9251fc2c785547b8ad968d18cfda8e73 100644 (file)
@@ -1150,7 +1150,7 @@ int kernel_kexec(void)
                error = dpm_suspend_end(PMSG_FREEZE);
                if (error)
                        goto Resume_devices;
-               error = disable_nonboot_cpus();
+               error = suspend_disable_secondary_cpus();
                if (error)
                        goto Enable_cpus;
                local_irq_disable();
@@ -1183,7 +1183,7 @@ int kernel_kexec(void)
  Enable_irqs:
                local_irq_enable();
  Enable_cpus:
-               enable_nonboot_cpus();
+               suspend_enable_secondary_cpus();
                dpm_resume_start(PMSG_RESTORE);
  Resume_devices:
                dpm_resume_end(PMSG_RESTORE);
index abef759de7c8fb4a8ece278fd7b7730d5b5e41ab..cfc7a57049e4c90367c9421913e8698055fa0e6c 100644 (file)
@@ -281,7 +281,7 @@ static int create_image(int platform_mode)
        if (error || hibernation_test(TEST_PLATFORM))
                goto Platform_finish;
 
-       error = disable_nonboot_cpus();
+       error = suspend_disable_secondary_cpus();
        if (error || hibernation_test(TEST_CPUS))
                goto Enable_cpus;
 
@@ -323,7 +323,7 @@ static int create_image(int platform_mode)
        local_irq_enable();
 
  Enable_cpus:
-       enable_nonboot_cpus();
+       suspend_enable_secondary_cpus();
 
  Platform_finish:
        platform_finish(platform_mode);
@@ -417,7 +417,7 @@ int hibernation_snapshot(int platform_mode)
 
 int __weak hibernate_resume_nonboot_cpu_disable(void)
 {
-       return disable_nonboot_cpus();
+       return suspend_disable_secondary_cpus();
 }
 
 /**
@@ -486,7 +486,7 @@ static int resume_target_kernel(bool platform_mode)
        local_irq_enable();
 
  Enable_cpus:
-       enable_nonboot_cpus();
+       suspend_enable_secondary_cpus();
 
  Cleanup:
        platform_restore_cleanup(platform_mode);
@@ -564,7 +564,7 @@ int hibernation_platform_enter(void)
        if (error)
                goto Platform_finish;
 
-       error = disable_nonboot_cpus();
+       error = suspend_disable_secondary_cpus();
        if (error)
                goto Enable_cpus;
 
@@ -586,7 +586,7 @@ int hibernation_platform_enter(void)
        local_irq_enable();
 
  Enable_cpus:
-       enable_nonboot_cpus();
+       suspend_enable_secondary_cpus();
 
  Platform_finish:
        hibernation_ops->finish();
index 0bd595a0b6103c56439871b765ef0d4fb5ac672b..59b6def230462cd987d22563e34420793acb90bf 100644 (file)
@@ -428,7 +428,7 @@ static int suspend_enter(suspend_state_t state, bool *wakeup)
        if (suspend_test(TEST_PLATFORM))
                goto Platform_wake;
 
-       error = disable_nonboot_cpus();
+       error = suspend_disable_secondary_cpus();
        if (error || suspend_test(TEST_CPUS))
                goto Enable_cpus;
 
@@ -458,7 +458,7 @@ static int suspend_enter(suspend_state_t state, bool *wakeup)
        BUG_ON(irqs_disabled());
 
  Enable_cpus:
-       enable_nonboot_cpus();
+       suspend_enable_secondary_cpus();
 
  Platform_wake:
        platform_resume_noirq(state);