Skip to content

Commit 5edd19a

Browse files
cpwickmanH. Peter Anvin
authored andcommitted
x86, UV: Make kdump avoid stack dumps
UV NMI callback's should not write stack dumps when a kdump is to be written. When invoking the crash kernel to write a dump, kdump_nmi_shootdown_cpus() uses NMI's to get all the cpu's to save their register context and halt. But the NMI interrupt handler runs a callback list. This patch sets a flag to prevent any of those callbacks from interfering with the halt of the cpu. For UV, which currently has the only callback to which this is relevant, the uv_handle_nmi() callback should not do dumping of stacks. The 'in_crash_kexec' flag is defined as an extern in kdebug.h firstly because x2apic_uv_x.c includes it. Secondly because some future callback might need the flag to know that it should not enter the debugger. (Such a scenario was in fact present in the 2.6.32 kernel, SuSE distribution, where a call to kdb needed to be avoided.) Signed-off-by: Cliff Wickman <cpw@sgi.com> LKML-Reference: <E1ObLvt-0005UZ-Va@eag09.americas.sgi.com> Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
1 parent 93a7ca0 commit 5edd19a

File tree

3 files changed

+8
-0
lines changed

3 files changed

+8
-0
lines changed

arch/x86/include/asm/kdebug.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,5 +33,6 @@ extern void __show_regs(struct pt_regs *regs, int all);
3333
extern void show_regs(struct pt_regs *regs);
3434
extern unsigned long oops_begin(void);
3535
extern void oops_end(unsigned long, struct pt_regs *, int signr);
36+
extern int in_crash_kexec;
3637

3738
#endif /* _ASM_X86_KDEBUG_H */

arch/x86/kernel/apic/x2apic_uv_x.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -604,6 +604,10 @@ int uv_handle_nmi(struct notifier_block *self, unsigned long reason, void *data)
604604
{
605605
if (reason != DIE_NMI_IPI)
606606
return NOTIFY_OK;
607+
608+
if (in_crash_kexec)
609+
/* do nothing if entering the crash kernel */
610+
return NOTIFY_OK;
607611
/*
608612
* Use a lock so only one cpu prints at a time
609613
* to prevent intermixed output.

arch/x86/kernel/crash.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@
2828
#include <asm/reboot.h>
2929
#include <asm/virtext.h>
3030

31+
int in_crash_kexec;
32+
3133
#if defined(CONFIG_SMP) && defined(CONFIG_X86_LOCAL_APIC)
3234

3335
static void kdump_nmi_callback(int cpu, struct die_args *args)
@@ -61,6 +63,7 @@ static void kdump_nmi_callback(int cpu, struct die_args *args)
6163

6264
static void kdump_nmi_shootdown_cpus(void)
6365
{
66+
in_crash_kexec = 1;
6467
nmi_shootdown_cpus(kdump_nmi_callback);
6568

6669
disable_local_APIC();

0 commit comments

Comments
 (0)