Skip to content

Commit

Permalink
powerpc: handle kdump appropriately with crash_kexec_post_notifiers o…
Browse files Browse the repository at this point in the history
…ption

Kdump can be triggered after panic_notifers since commit f06e515
("kernel/panic.c: add "crash_kexec_post_notifiers" option for kdump
after panic_notifers") introduced crash_kexec_post_notifiers option.
But using this option would mean smp_send_stop(), that marks all other
CPUs as offline, gets called before kdump is triggered. As a result,
kdump routines fail to save other CPUs' registers. To fix this, kdump
friendly crash_smp_send_stop() function was introduced with kernel
commit 0ee5941 ("x86/panic: replace smp_send_stop() with kdump
friendly version in panic path"). Override this kdump friendly weak
function to handle crash_kexec_post_notifiers option appropriately
on powerpc.

Signed-off-by: Hari Bathini <hbathini@linux.ibm.com>
  • Loading branch information
hbathini authored and intel-lab-lkp committed Nov 25, 2021
1 parent 3d030e3 commit 112b5fc
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions arch/powerpc/kernel/smp.c
Expand Up @@ -620,6 +620,32 @@ void crash_send_ipi(void (*crash_ipi_callback)(struct pt_regs *))
}
#endif

static void crash_stop_this_cpu(struct pt_regs *regs)
{
/*
* Just busy wait here and avoid marking CPU as offline to ensure
* register data of all these CPUs is captured appropriately.
*/
while (1)
cpu_relax();
}

void crash_smp_send_stop(void)
{
static bool stopped = false;

if (stopped)
return;

stopped = true;

#ifdef CONFIG_NMI_IPI
smp_send_nmi_ipi(NMI_IPI_ALL_OTHERS, crash_stop_this_cpu, 1000000);
#else
smp_call_function(crash_stop_this_cpu, NULL, 0);
#endif /* CONFIG_NMI_IPI */
}

#ifdef CONFIG_NMI_IPI
static void nmi_stop_this_cpu(struct pt_regs *regs)
{
Expand Down

0 comments on commit 112b5fc

Please sign in to comment.