Skip to content

Commit 7e916cc

Browse files
KAGA-KOKOgregkh
authored andcommitted
cpu/hotplug: Ignore pm_wakeup_pending() for disable_nonboot_cpus()
commit e98eac6 upstream. A recent change to freeze_secondary_cpus() which added an early abort if a wakeup is pending missed the fact that the function is also invoked for shutdown, reboot and kexec via disable_nonboot_cpus(). In case of disable_nonboot_cpus() the wakeup event needs to be ignored as the purpose is to terminate the currently running kernel. Add a 'suspend' argument which is only set when the freeze is in context of a suspend operation. If not set then an eventually pending wakeup event is ignored. Fixes: a66d955 ("cpu/hotplug: Abort disabling secondary CPUs if wakeup is pending") Reported-by: Boqun Feng <boqun.feng@gmail.com> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Cc: Pavankumar Kondeti <pkondeti@codeaurora.org> Cc: stable@vger.kernel.org Link: https://lkml.kernel.org/r/874kuaxdiz.fsf@nanos.tec.linutronix.de Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 395d775 commit 7e916cc

2 files changed

Lines changed: 11 additions & 5 deletions

File tree

‎include/linux/cpu.h‎

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -138,12 +138,18 @@ static inline void get_online_cpus(void) { cpus_read_lock(); }
138138
static inline void put_online_cpus(void) { cpus_read_unlock(); }
139139

140140
#ifdef CONFIG_PM_SLEEP_SMP
141-
extern int freeze_secondary_cpus(int primary);
141+
int __freeze_secondary_cpus(int primary, bool suspend);
142+
static inline int freeze_secondary_cpus(int primary)
143+
{
144+
return __freeze_secondary_cpus(primary, true);
145+
}
146+
142147
static inline int disable_nonboot_cpus(void)
143148
{
144-
return freeze_secondary_cpus(0);
149+
return __freeze_secondary_cpus(0, false);
145150
}
146-
extern void enable_nonboot_cpus(void);
151+
152+
void enable_nonboot_cpus(void);
147153

148154
static inline int suspend_disable_secondary_cpus(void)
149155
{

‎kernel/cpu.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1212,7 +1212,7 @@ EXPORT_SYMBOL_GPL(cpu_up);
12121212
#ifdef CONFIG_PM_SLEEP_SMP
12131213
static cpumask_var_t frozen_cpus;
12141214

1215-
int freeze_secondary_cpus(int primary)
1215+
int __freeze_secondary_cpus(int primary, bool suspend)
12161216
{
12171217
int cpu, error = 0;
12181218

@@ -1237,7 +1237,7 @@ int freeze_secondary_cpus(int primary)
12371237
if (cpu == primary)
12381238
continue;
12391239

1240-
if (pm_wakeup_pending()) {
1240+
if (suspend && pm_wakeup_pending()) {
12411241
pr_info("Wakeup pending. Abort CPU freeze\n");
12421242
error = -EBUSY;
12431243
break;

0 commit comments

Comments
 (0)