From 1d4c4440708ef05544de31d7ab3419fbb81e4132 Mon Sep 17 00:00:00 2001 From: Bin Wang Date: Thu, 10 Feb 2022 19:55:31 +0800 Subject: [PATCH] x86/kdump: make crash kernel boot faster euleros inclusion category: bugfix bugzilla: https://gitee.com/openeuler/kernel/issues/I4SJBG?from=project-issue CVE: NA --------------------------- 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. Signed-off-by: Bin Wang Reviewed-by: luo chunsheng Reviewed-by: Yang Jihong Signed-off-by: Zheng Zengkai --- arch/x86/kernel/reboot.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/arch/x86/kernel/reboot.c b/arch/x86/kernel/reboot.c index 798a6f73f894..e50da62a67a2 100644 --- a/arch/x86/kernel/reboot.c +++ b/arch/x86/kernel/reboot.c @@ -871,6 +871,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--; } -- GitLab