diff --git a/arch/x86/kernel/reboot.c b/arch/x86/kernel/reboot.c index 830425e6d38e2f75fb9ea41f7dc042e175d98846..16a23c1400a341ca8e233794dbfadb29c516eb54 100644 --- a/arch/x86/kernel/reboot.c +++ b/arch/x86/kernel/reboot.c @@ -925,6 +925,14 @@ void nmi_shootdown_cpus(nmi_shootdown_cb callback) msecs = 1000; /* Wait at most a second for the other cpus to stop */ while ((atomic_read(&waiting_for_crash_ipi) > 0) && msecs) { + /* + * If other cpus offline before handle the crash NMI, the + * waiting_for_crash_ipi can not be decreased to 0, and + * current cpu will wait 1 second. So break if all other + * cpus offline. + */ + if (num_online_cpus() == 1) + break; mdelay(1); msecs--; }