public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] kdump: x86_64 add crashdump trigger points
@ 2006-04-10 22:05 Vivek Goyal
  2006-04-11  2:44 ` Andi Kleen
  0 siblings, 1 reply; 5+ messages in thread
From: Vivek Goyal @ 2006-04-10 22:05 UTC (permalink / raw)
  To: linux kernel mailing list, Andi Kleen, Fastboot mailing list
  Cc: Eric W.Biederman



o Start booting into the capture kernel after an Oops if system is in a
  unrecoverable state. System will boot into the capture kernel, if one is
  pre-loaded by the user, and capture the kernel core dump.

o One of the following conditions should be true to trigger the booting of
  capture kernel.
	- panic_on_oops is set.
	- pid of current thread is 0
	- pid of current thread is 1
	- Oops happened inside interrupt context.  

Signed-off-by: Vivek Goyal <vgoyal@in.ibm.com>
---

 arch/x86_64/kernel/traps.c  |    9 ++++++---
 arch/x86_64/mm/fault.c      |    4 ++--
 include/asm-x86_64/kdebug.h |    2 +-
 3 files changed, 9 insertions(+), 6 deletions(-)

diff -puN arch/x86_64/kernel/traps.c~kdump-x86_64-add-crash-kexec-calls arch/x86_64/kernel/traps.c
--- linux-2.6.17-rc1-1M/arch/x86_64/kernel/traps.c~kdump-x86_64-add-crash-kexec-calls	2006-04-10 15:59:25.000000000 -0400
+++ linux-2.6.17-rc1-1M-root/arch/x86_64/kernel/traps.c	2006-04-10 16:00:00.000000000 -0400
@@ -30,6 +30,7 @@
 #include <linux/moduleparam.h>
 #include <linux/nmi.h>
 #include <linux/kprobes.h>
+#include <linux/kexec.h>
 
 #include <asm/system.h>
 #include <asm/uaccess.h>
@@ -404,11 +405,13 @@ unsigned __kprobes long oops_begin(void)
 	return flags;
 }
 
-void __kprobes oops_end(unsigned long flags)
+void __kprobes oops_end(unsigned long flags, struct pt_regs *regs)
 { 
 	die_owner = -1;
 	bust_spinlocks(0);
 	spin_unlock_irqrestore(&die_lock, flags);
+	if (kexec_should_crash(current))
+		crash_kexec(regs);
 	if (panic_on_oops)
 		panic("Oops");
 }
@@ -441,7 +444,7 @@ void die(const char * str, struct pt_reg
 
 	handle_BUG(regs);
 	__die(str, regs, err);
-	oops_end(flags);
+	oops_end(flags, regs);
 	do_exit(SIGSEGV); 
 }
 
@@ -458,7 +461,7 @@ void __kprobes die_nmi(char *str, struct
 	if (panic_on_timeout || panic_on_oops)
 		panic("nmi watchdog");
 	printk("console shuts up ...\n");
-	oops_end(flags);
+	oops_end(flags, regs);
 	do_exit(SIGSEGV);
 }
 
diff -puN arch/x86_64/mm/fault.c~kdump-x86_64-add-crash-kexec-calls arch/x86_64/mm/fault.c
--- linux-2.6.17-rc1-1M/arch/x86_64/mm/fault.c~kdump-x86_64-add-crash-kexec-calls	2006-04-10 15:59:25.000000000 -0400
+++ linux-2.6.17-rc1-1M-root/arch/x86_64/mm/fault.c	2006-04-10 17:02:04.000000000 -0400
@@ -238,7 +238,7 @@ static noinline void pgtable_bad(unsigne
 	tsk->thread.trap_no = 14;
 	tsk->thread.error_code = error_code;
 	__die("Bad pagetable", regs, error_code);
-	oops_end(flags);
+	oops_end(flags, regs);
 	do_exit(SIGKILL);
 }
 
@@ -542,7 +542,7 @@ no_context:
 	__die("Oops", regs, error_code);
 	/* Executive summary in case the body of the oops scrolled away */
 	printk(KERN_EMERG "CR2: %016lx\n", address);
-	oops_end(flags);
+	oops_end(flags, regs);
 	do_exit(SIGKILL);
 
 /*
diff -puN include/asm-x86_64/kdebug.h~kdump-x86_64-add-crash-kexec-calls include/asm-x86_64/kdebug.h
--- linux-2.6.17-rc1-1M/include/asm-x86_64/kdebug.h~kdump-x86_64-add-crash-kexec-calls	2006-04-10 15:59:25.000000000 -0400
+++ linux-2.6.17-rc1-1M-root/include/asm-x86_64/kdebug.h	2006-04-10 15:59:25.000000000 -0400
@@ -53,6 +53,6 @@ extern void __die(const char *,struct pt
 extern void show_registers(struct pt_regs *regs);
 extern void dump_pagetable(unsigned long);
 extern unsigned long oops_begin(void);
-extern void oops_end(unsigned long);
+extern void oops_end(unsigned long,struct pt_regs *);
 
 #endif
_

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

* Re: [PATCH] kdump: x86_64 add crashdump trigger points
  2006-04-10 22:05 Vivek Goyal
@ 2006-04-11  2:44 ` Andi Kleen
  2006-04-11 15:45   ` Vivek Goyal
  0 siblings, 1 reply; 5+ messages in thread
From: Andi Kleen @ 2006-04-11  2:44 UTC (permalink / raw)
  To: Vivek Goyal
  Cc: linux kernel mailing list, Fastboot mailing list,
	Eric W.Biederman

On Mon, Apr 10, 2006 at 06:05:11PM -0400, Vivek Goyal wrote:
> 
> 
> o Start booting into the capture kernel after an Oops if system is in a
>   unrecoverable state. System will boot into the capture kernel, if one is
>   pre-loaded by the user, and capture the kernel core dump.
> 
> o One of the following conditions should be true to trigger the booting of
>   capture kernel.
> 	- panic_on_oops is set.
> 	- pid of current thread is 0
> 	- pid of current thread is 1
> 	- Oops happened inside interrupt context.  

I would rather put it into die(). Then the patch will be much smaller
too.

-Andi

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

* Re: [PATCH] kdump: x86_64 add crashdump trigger points
  2006-04-11  2:44 ` Andi Kleen
@ 2006-04-11 15:45   ` Vivek Goyal
  0 siblings, 0 replies; 5+ messages in thread
From: Vivek Goyal @ 2006-04-11 15:45 UTC (permalink / raw)
  To: Andi Kleen
  Cc: linux kernel mailing list, Fastboot mailing list,
	Eric W.Biederman

On Tue, Apr 11, 2006 at 04:44:39AM +0200, Andi Kleen wrote:
> On Mon, Apr 10, 2006 at 06:05:11PM -0400, Vivek Goyal wrote:
> > 
> > 
> > o Start booting into the capture kernel after an Oops if system is in a
> >   unrecoverable state. System will boot into the capture kernel, if one is
> >   pre-loaded by the user, and capture the kernel core dump.
> > 
> > o One of the following conditions should be true to trigger the booting of
> >   capture kernel.
> > 	- panic_on_oops is set.
> > 	- pid of current thread is 0
> > 	- pid of current thread is 1
> > 	- Oops happened inside interrupt context.  
> 
> I would rather put it into die(). Then the patch will be much smaller
> too.

Not everybody calls die(), instead they call __die() directly. For example
do_page_fault(), pgtable_bad(). Hence I am putting this call inside __die().

Anyway, if capture kernel is loaded, after displaying the registers and
backtrace, we probably don't want to do anything else and just boot into
capture kernel. Please find attached the modified patch.



o Start booting into the capture kernel after an Oops if system is in a
  unrecoverable state. System will boot into the capture kernel, if one is
  pre-loaded by the user, and capture the kernel core dump.

o One of the following conditions should be true to trigger the booting of
  capture kernel.
        - panic_on_oops is set.
        - pid of current thread is 0
        - pid of current thread is 1
        - Oops happened inside interrupt context.

Signed-off-by: Vivek Goyal <vgoyal@in.ibm.com>
---

 arch/x86_64/kernel/traps.c |    5 +++++
 1 file changed, 5 insertions(+)

diff -puN arch/x86_64/kernel/traps.c~kdump-x86_64-add-crashdump-trigger-points arch/x86_64/kernel/traps.c
--- linux-2.6.17-rc1-1M/arch/x86_64/kernel/traps.c~kdump-x86_64-add-crashdump-trigger-points	2006-04-11 08:37:08.000000000 -0400
+++ linux-2.6.17-rc1-1M-root/arch/x86_64/kernel/traps.c	2006-04-11 09:03:26.000000000 -0400
@@ -30,6 +30,7 @@
 #include <linux/moduleparam.h>
 #include <linux/nmi.h>
 #include <linux/kprobes.h>
+#include <linux/kexec.h>
 
 #include <asm/system.h>
 #include <asm/uaccess.h>
@@ -433,6 +434,8 @@ void __kprobes __die(const char * str, s
 	printk(KERN_ALERT "RIP ");
 	printk_address(regs->rip); 
 	printk(" RSP <%016lx>\n", regs->rsp); 
+	if (kexec_should_crash(current))
+		crash_kexec(regs);
 }
 
 void die(const char * str, struct pt_regs * regs, long err)
@@ -455,6 +458,8 @@ void __kprobes die_nmi(char *str, struct
 	 */
 	printk(str, safe_smp_processor_id());
 	show_registers(regs);
+	if (kexec_should_crash(current))
+		crash_kexec(regs);
 	if (panic_on_timeout || panic_on_oops)
 		panic("nmi watchdog");
 	printk("console shuts up ...\n");
_

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

* [PATCH] kdump: x86_64 add crashdump trigger points
@ 2006-04-17 19:49 Vivek Goyal
  2006-04-18  4:40 ` Andi Kleen
  0 siblings, 1 reply; 5+ messages in thread
From: Vivek Goyal @ 2006-04-17 19:49 UTC (permalink / raw)
  To: Andi Kleen
  Cc: Fastboot mailing list, linux kernel mailing list,
	Morton Andrew Morton

Hi,

I am reposting this patch as there was no response after I modified the
patch based on feedback. Is there a problem with the patch? If yes please
let me know, I shall rectify that.

We need this patch to trigger the booting of capture kernel if system is
hung and die_nmi() hits or some thread oopses and panic_on_oops is set.

System starts booting into capture kernel only if it is pre-loaded otherwise
normal operation continues and existing functionality is not impacted. 

o Start booting into the capture kernel after an Oops if system is in a
  unrecoverable state. System will boot into the capture kernel, if one is
  pre-loaded by the user, and capture the kernel core dump.

o One of the following conditions should be true to trigger the booting of
  capture kernel.
        - panic_on_oops is set.
        - pid of current thread is 0
        - pid of current thread is 1
        - Oops happened inside interrupt context.

Signed-off-by: Vivek Goyal <vgoyal@in.ibm.com>
---

 arch/x86_64/kernel/traps.c |    5 +++++
 1 file changed, 5 insertions(+)

diff -puN arch/x86_64/kernel/traps.c~kdump-x86_64-add-crashdump-trigger-points arch/x86_64/kernel/traps.c
--- linux-2.6.17-rc1-1M/arch/x86_64/kernel/traps.c~kdump-x86_64-add-crashdump-trigger-points	2006-04-11 08:37:08.000000000 -0400
+++ linux-2.6.17-rc1-1M-root/arch/x86_64/kernel/traps.c	2006-04-11 09:03:26.000000000 -0400
@@ -30,6 +30,7 @@
 #include <linux/moduleparam.h>
 #include <linux/nmi.h>
 #include <linux/kprobes.h>
+#include <linux/kexec.h>
 
 #include <asm/system.h>
 #include <asm/uaccess.h>
@@ -433,6 +434,8 @@ void __kprobes __die(const char * str, s
 	printk(KERN_ALERT "RIP ");
 	printk_address(regs->rip); 
 	printk(" RSP <%016lx>\n", regs->rsp); 
+	if (kexec_should_crash(current))
+		crash_kexec(regs);
 }
 
 void die(const char * str, struct pt_regs * regs, long err)
@@ -455,6 +458,8 @@ void __kprobes die_nmi(char *str, struct
 	 */
 	printk(str, safe_smp_processor_id());
 	show_registers(regs);
+	if (kexec_should_crash(current))
+		crash_kexec(regs);
 	if (panic_on_timeout || panic_on_oops)
 		panic("nmi watchdog");
 	printk("console shuts up ...\n");
_

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

* Re: [PATCH] kdump: x86_64 add crashdump trigger points
  2006-04-17 19:49 [PATCH] kdump: x86_64 add crashdump trigger points Vivek Goyal
@ 2006-04-18  4:40 ` Andi Kleen
  0 siblings, 0 replies; 5+ messages in thread
From: Andi Kleen @ 2006-04-18  4:40 UTC (permalink / raw)
  To: Vivek Goyal
  Cc: Fastboot mailing list, linux kernel mailing list,
	Morton Andrew Morton

On Mon, Apr 17, 2006 at 03:49:14PM -0400, Vivek Goyal wrote:
> Hi,
> 
> I am reposting this patch as there was no response after I modified the
> patch based on feedback. Is there a problem with the patch? If yes please
> let me know, I shall rectify that.

It's already queued for .18


See ftp://ftp.firstfloor.org/pub/ak/x86_64/quilt/patches/
for my current queue

-Andi

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

end of thread, other threads:[~2006-04-18  4:40 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-04-17 19:49 [PATCH] kdump: x86_64 add crashdump trigger points Vivek Goyal
2006-04-18  4:40 ` Andi Kleen
  -- strict thread matches above, loose matches on Subject: below --
2006-04-10 22:05 Vivek Goyal
2006-04-11  2:44 ` Andi Kleen
2006-04-11 15:45   ` Vivek Goyal

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