Skip to contentSkip to conversation

MIPS: kdump: Mark cpu back online before rebooting

PATCH In review Dengcheng Zhu 2 participants 2 messages Sep 26, 2018 – Sep 28, 2018 MIPS

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 MIPS: kdump: Mark cpu back online before rebooting

The crash utility initializes cpu state by reading the system kernel memory, which is copied into vmcore.

It is also natural to preserve the online state for CPUs at crash.

Failing to do so could make the analysis tool present info for only 1 CPU by default, and unable to find panic task.

---
 arch/mips/kernel/machine_kexec.c | 10 ++++++++++
 1 file changed, 10 insertions(+)
arch/mips/kernel/machine_kexec.c +10 -0
index 93b8353eece4..5c5b4351893e 100644
@@ -171,6 +171,16 @@ void kexec_reboot(void)
 {
 	void (*do_kexec)(void) __noreturn;
 
+	/*
+	 * We know we were online, and there will be no incoming IPIs at
+	 * this point. Mark online again before rebooting so that the crash
+	 * analysis tool will see us correctly.
+	 */
+	set_cpu_online(smp_processor_id(), true);
+
+	/* Ensure remote CPUs observe that we're online before rebooting. */
+	smp_mb__after_atomic();
+
 #ifdef CONFIG_SMP
 	if (smp_processor_id() > 0) {
 		/*
Signature · 1 line
2.17.1
#1 lore raw

Hi Dengcheng,

Quoted 5 lines · Dengcheng Zhu

The crash utility initializes cpu state by reading the system kernel memory, which is copied into vmcore.

It is also natural to preserve the online state for CPUs at crash.

Quoted 7 lines

Failing to do so could make the analysis tool present info for only 1 CPU by default, and unable to find panic task.

---
 arch/mips/kernel/machine_kexec.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

Thanks - applied to mips-next for 4.20.

Paul