Skip to contentSkip to conversation

powerpc/crash: Fix non-smp kexec preparation

PATCH Superseded Eddie James 2 participants 3 messages Feb 10, 2025 – Feb 11, 2025 PowerPC

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 powerpc/crash: Fix non-smp kexec preparation

In non-smp configurations, crash_kexec_prepare is never called in the crash shutdown path. One result of this is that the crashing_cpu variable is never set, preventing crash_save_cpu from storing the NT_PRSTATUS elf note in the core dump.

Fixes c7255058b543 ("powerpc/crash: save cpu register data in crash_smp_send_stop()")
---
 arch/powerpc/kexec/crash.c | 4 ++++
 1 file changed, 4 insertions(+)
arch/powerpc/kexec/crash.c +4 -0
index 9ac3266e49652..8c11cfd19e734 100644
@@ -359,7 +359,11 @@ void default_machine_crash_shutdown(struct pt_regs *regs)
 	if (TRAP(regs) == INTERRUPT_SYSTEM_RESET)
 		is_via_system_reset = 1;
 
+#ifdef CONFIG_SMP
 	crash_smp_send_stop();
+#else
+	crash_kexec_prepare();
+#endif
 
 	crash_save_cpu(regs, crashing_cpu);
 
Signature · 1 line
2.43.5
#1 lore raw

Le 10/02/2025 à 20:52, Eddie James a écrit :

Quoted 18 lines

[Vous ne recevez pas souvent de courriers de [email protected]. Découvrez pourquoi ceci est important à https://aka.ms/LearnAboutSenderIdentification ]

In non-smp configurations, crash_kexec_prepare is never called in the crash shutdown path. One result of this is that the crashing_cpu variable is never set, preventing crash_save_cpu from storing the NT_PRSTATUS elf note in the core dump.

Fixes c7255058b543 ("powerpc/crash: save cpu register data in crash_smp_send_stop()")
---
  arch/powerpc/kexec/crash.c | 4 ++++
  1 file changed, 4 insertions(+)
arch/powerpc/kexec/crash.c +0 -0
index 9ac3266e49652..8c11cfd19e734 100644

arch/powerpc/kexec/crash.c void default_machine_crash_shutdown(struct pt_regs *regs) · line 362

Quoted 4 lines
arch/powerpc/kexec/crash.c +1 -0
@@ -359,7 +359,11 @@ void default_machine_crash_shutdown(struct pt_regs *regs)
         if (TRAP(regs) == INTERRUPT_SYSTEM_RESET)
                 is_via_system_reset = 1;
 
+#ifdef CONFIG_SMP

I see no obvious reason to use #ifdef instead of IS_ENABLED(CONFIG_SMP), is there any ?

Ref https://docs.kernel.org/process/coding-style.html#conditional-compilation

Quoted 10 lines
arch/powerpc/kexec/crash.c +3 -1
         crash_smp_send_stop();
+#else
+       crash_kexec_prepare();
+#endif
 
         crash_save_cpu(regs, crashing_cpu);
 
--

2.43.5

#2 lore raw
Quoted 25 lines · Christophe Leroy

Le 10/02/2025 à 20:52, Eddie James a écrit :

Quoted 22 lines

[Vous ne recevez pas souvent de courriers de [email protected]. Découvrez pourquoi ceci est important à https://aka.ms/LearnAboutSenderIdentification ]

In non-smp configurations, crash_kexec_prepare is never called in the crash shutdown path. One result of this is that the crashing_cpu variable is never set, preventing crash_save_cpu from storing the NT_PRSTATUS elf note in the core dump.

Fixes c7255058b543 ("powerpc/crash: save cpu register data in crash_smp_send_stop()")

---
  arch/powerpc/kexec/crash.c | 4 ++++

  1 file changed, 4 insertions(+)
arch/powerpc/kexec/crash.c +0 -0
index 9ac3266e49652..8c11cfd19e734 100644
@@ -359,7 +359,11 @@ void default_machine_crash_shutdown(struct 
 pt_regs *regs)
          if (TRAP(regs) == INTERRUPT_SYSTEM_RESET)
                  is_via_system_reset = 1;
 
Quoted 5 lines

arch/powerpc/kexec/crash.c void default_machine_crash_shutdown(struct pt_regs *regs) · line 362

Quoted 1 line
arch/powerpc/kexec/crash.c +1 -0
+#ifdef CONFIG_SMP

I see no obvious reason to use #ifdef instead of IS_ENABLED(CONFIG_SMP), is there any ?

Ref https://docs.kernel.org/process/coding-style.html#conditional-compilation

Oops, no, just my habit. I'll change it.

Thanks,

Eddie

Quoted 12 lines
Quoted 11 lines
arch/powerpc/kexec/crash.c +3 -0
          crash_smp_send_stop();
+#else
+       crash_kexec_prepare();
+#endif
 
          crash_save_cpu(regs, crashing_cpu);
Signature · 2 lines
-- 
2.43.5