mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v2] x86, UV: make kdump avoid stack dumps
@ 2010-08-09 21:11 Cliff Wickman
  2010-08-12 20:06 ` [tip:x86/uv] x86, UV: Make kdump avoid stack dumps - fix !CONFIG_KEXEC breakage tip-bot for Cliff Wickman
  0 siblings, 1 reply; 2+ messages in thread
From: Cliff Wickman @ 2010-08-09 21:11 UTC (permalink / raw)
  To: linux-kernel; +Cc: mingo, hpa


This replaces Version 1 of this patch, which broke the build when
CONFIG_KEXEC and CONFIG_CRASH_DUMP were configured off.  In that case
the storage for the 'in_crash_kexec' flag was never built.

This v2 was submitted on 7/22, but apparently never seen (probably too close
in date and name to v1, sent on 7/20).

This version defines that flag as 0 if CONFIG_KEXEC is not set.
The patch is tested with all combinations of those two options.


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.)

Diffed against 2.6.35

Signed-off-by: Cliff Wickman <cpw@sgi.com>
---
 arch/x86/include/asm/kdebug.h      |    6 ++++++
 arch/x86/kernel/apic/x2apic_uv_x.c |    4 ++++
 arch/x86/kernel/crash.c            |    3 +++
 3 files changed, 13 insertions(+)

Index: 100722.linux-tip/arch/x86/kernel/apic/x2apic_uv_x.c
===================================================================
--- 100722.linux-tip.orig/arch/x86/kernel/apic/x2apic_uv_x.c
+++ 100722.linux-tip/arch/x86/kernel/apic/x2apic_uv_x.c
@@ -604,6 +604,10 @@ int uv_handle_nmi(struct notifier_block
 {
 	if (reason != DIE_NMI_IPI)
 		return NOTIFY_OK;
+
+	if (in_crash_kexec)
+		/* do nothing if entering the crash kernel */
+		return NOTIFY_OK;
 	/*
 	 * Use a lock so only one cpu prints at a time
 	 * to prevent intermixed output.
Index: 100722.linux-tip/arch/x86/kernel/crash.c
===================================================================
--- 100722.linux-tip.orig/arch/x86/kernel/crash.c
+++ 100722.linux-tip/arch/x86/kernel/crash.c
@@ -28,6 +28,8 @@
 #include <asm/reboot.h>
 #include <asm/virtext.h>
 
+int in_crash_kexec;
+
 #if defined(CONFIG_SMP) && defined(CONFIG_X86_LOCAL_APIC)
 
 static void kdump_nmi_callback(int cpu, struct die_args *args)
@@ -61,6 +63,7 @@ static void kdump_nmi_callback(int cpu,
 
 static void kdump_nmi_shootdown_cpus(void)
 {
+	in_crash_kexec = 1;
 	nmi_shootdown_cpus(kdump_nmi_callback);
 
 	disable_local_APIC();
Index: 100722.linux-tip/arch/x86/include/asm/kdebug.h
===================================================================
--- 100722.linux-tip.orig/arch/x86/include/asm/kdebug.h
+++ 100722.linux-tip/arch/x86/include/asm/kdebug.h
@@ -33,5 +33,11 @@ extern void __show_regs(struct pt_regs *
 extern void show_regs(struct pt_regs *regs);
 extern unsigned long oops_begin(void);
 extern void oops_end(unsigned long, struct pt_regs *, int signr);
+#ifdef CONFIG_KEXEC
+extern int in_crash_kexec;
+#else
+/* no crash dump is ever in progress if no crash kernel can be kexec'd */
+#define in_crash_kexec 0
+#endif
 
 #endif /* _ASM_X86_KDEBUG_H */

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [tip:x86/uv] x86, UV: Make kdump avoid stack dumps - fix !CONFIG_KEXEC breakage
  2010-08-09 21:11 [PATCH v2] x86, UV: make kdump avoid stack dumps Cliff Wickman
@ 2010-08-12 20:06 ` tip-bot for Cliff Wickman
  0 siblings, 0 replies; 2+ messages in thread
From: tip-bot for Cliff Wickman @ 2010-08-12 20:06 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, akpm, cpw, tglx, hpa

Commit-ID:  1d6225e8cc5598f2bc5c992f9c88b1137763e8e1
Gitweb:     http://git.kernel.org/tip/1d6225e8cc5598f2bc5c992f9c88b1137763e8e1
Author:     Cliff Wickman <cpw@sgi.com>
AuthorDate: Mon, 9 Aug 2010 16:11:22 -0500
Committer:  H. Peter Anvin <hpa@linux.intel.com>
CommitDate: Thu, 12 Aug 2010 12:23:55 -0700

x86, UV: Make kdump avoid stack dumps - fix !CONFIG_KEXEC breakage

This replaces Version 1 of this patch, which broke the build when
CONFIG_KEXEC and CONFIG_CRASH_DUMP were configured off.  In that case
the storage for the 'in_crash_kexec' flag was never built.

This version defines that flag as 0 if CONFIG_KEXEC is not set.
The patch is tested with all combinations of those two options.

Signed-off-by: Cliff Wickman <cpw@sgi.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
LKML-Reference: <E1OiZcw-0001Hb-2g@eag09.americas.sgi.com>
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
---
 arch/x86/include/asm/kdebug.h |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/arch/x86/include/asm/kdebug.h b/arch/x86/include/asm/kdebug.h
index 7a2910b..5bdfca8 100644
--- a/arch/x86/include/asm/kdebug.h
+++ b/arch/x86/include/asm/kdebug.h
@@ -33,6 +33,11 @@ extern void __show_regs(struct pt_regs *regs, int all);
 extern void show_regs(struct pt_regs *regs);
 extern unsigned long oops_begin(void);
 extern void oops_end(unsigned long, struct pt_regs *, int signr);
+#ifdef CONFIG_KEXEC
 extern int in_crash_kexec;
+#else
+/* no crash dump is ever in progress if no crash kernel can be kexec'd */
+#define in_crash_kexec 0
+#endif
 
 #endif /* _ASM_X86_KDEBUG_H */

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-08-12 20:07 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-08-09 21:11 [PATCH v2] x86, UV: make kdump avoid stack dumps Cliff Wickman
2010-08-12 20:06 ` [tip:x86/uv] x86, UV: Make kdump avoid stack dumps - fix !CONFIG_KEXEC breakage tip-bot for Cliff Wickman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome