Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1248088

[PATCH] powerpc: on crash, kexec'ed kernel needs all CPUs are online

From Laurent Vivier <lvivier@redhat.com>
Newsgroups linux.kernel
Subject [PATCH] powerpc: on crash, kexec'ed kernel needs all CPUs are online
Date 2015-10-15 21:10 +0200
Message-ID <qjW4x-7c7-3@gated-at.bofh.it> (permalink)
Organization linux.* mail to news gateway

Show all headers | View raw


On kexec, all secondary offline CPUs are onlined before
starting the new kernel, this is not done in the case of kdump.

If kdump is configured and a kernel crash occurs whereas
some secondaries CPUs are offline (SMT=off),
the new kernel is not able to start them and displays some
"Processor X is stuck.".

Starting with POWER8, subcore logic relies on all threads of
core being booted. So, on startup kernel tries to start all
threads, and asks OPAL (or RTAS) to start all CPUs (including
threads). If a CPU has been offlined by the previous kernel,
it has not been returned to OPAL, and thus OPAL cannot restart
it: this CPU has been lost...

Signed-off-by: Laurent Vivier <lvivier@redhat.com>
---
 arch/powerpc/kernel/crash.c | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/arch/powerpc/kernel/crash.c b/arch/powerpc/kernel/crash.c
index 51dbace..3ca9452 100644
--- a/arch/powerpc/kernel/crash.c
+++ b/arch/powerpc/kernel/crash.c
@@ -19,6 +19,7 @@
 #include <linux/delay.h>
 #include <linux/irq.h>
 #include <linux/types.h>
+#include <linux/cpu.h>
 
 #include <asm/processor.h>
 #include <asm/machdep.h>
@@ -299,11 +300,30 @@ int crash_shutdown_unregister(crash_shutdown_t handler)
 }
 EXPORT_SYMBOL(crash_shutdown_unregister);
 
+/*
+ * The next kernel will try to start all secondary CPUs and if
+ * there are not online it will fail to start them.
+ *
+ */
+static void wake_offline_cpus(void)
+{
+	int cpu = 0;
+
+	for_each_present_cpu(cpu) {
+		if (!cpu_online(cpu)) {
+			pr_info("kexec: Waking offline cpu %d.\n", cpu);
+			cpu_up(cpu);
+		}
+	}
+}
+
 void default_machine_crash_shutdown(struct pt_regs *regs)
 {
 	unsigned int i;
 	int (*old_handler)(struct pt_regs *regs);
 
+	wake_offline_cpus();
+
 	/*
 	 * This function is only called after the system
 	 * has panicked or is otherwise in a critical state.
-- 
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextNext in thread | Find similar | Unroll thread


Thread

[PATCH] powerpc: on crash, kexec'ed kernel needs all CPUs are online Laurent Vivier <lvivier@redhat.com> - 2015-10-15 21:10 +0200
  Re: [PATCH] powerpc: on crash, kexec'ed kernel needs all CPUs are  online kbuild test robot <lkp@intel.com> - 2015-10-16 02:40 +0200
  Re: [PATCH] powerpc: on crash, kexec'ed kernel needs all CPUs are  online Michael Ellerman <mpe@ellerman.id.au> - 2015-10-16 04:20 +0200
    Re: [PATCH] powerpc: on crash, kexec'ed kernel needs all CPUs are  online Laurent Vivier <lvivier@redhat.com> - 2015-10-16 09:50 +0200
      Re: [PATCH] powerpc: on crash, kexec'ed kernel needs all CPUs are  online Benjamin Herrenschmidt <benh@kernel.crashing.org> - 2015-10-17 04:10 +0200
  Re: [PATCH] powerpc: on crash, kexec'ed kernel needs all CPUs are  online David Gibson <dgibson@redhat.com> - 2015-10-16 04:30 +0200
    Re: [PATCH] powerpc: on crash, kexec'ed kernel needs all CPUs are  online Laurent Vivier <lvivier@redhat.com> - 2015-10-16 10:00 +0200
      Re: [PATCH] powerpc: on crash, kexec'ed kernel needs all CPUs are  online Benjamin Herrenschmidt <benh@kernel.crashing.org> - 2015-10-17 04:10 +0200

csiph-web