public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Vivek Goyal <vgoyal@in.ibm.com>
To: linux kernel mailing list <linux-kernel@vger.kernel.org>,
	Andi Kleen <ak@muc.de>,
	Fastboot mailing list <fastboot@lists.osdl.org>
Cc: "Eric W.Biederman" <ebiederm@xmission.com>
Subject: [PATCH] kdump: x86_64 add crashdump trigger points
Date: Mon, 10 Apr 2006 18:05:11 -0400	[thread overview]
Message-ID: <20060410220511.GB24711@in.ibm.com> (raw)



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
_

             reply	other threads:[~2006-04-10 22:02 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-04-10 22:05 Vivek Goyal [this message]
2006-04-11  2:44 ` [PATCH] kdump: x86_64 add crashdump trigger points Andi Kleen
2006-04-11 15:45   ` Vivek Goyal
  -- strict thread matches above, loose matches on Subject: below --
2006-04-17 19:49 Vivek Goyal
2006-04-18  4:40 ` Andi Kleen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20060410220511.GB24711@in.ibm.com \
    --to=vgoyal@in.ibm.com \
    --cc=ak@muc.de \
    --cc=ebiederm@xmission.com \
    --cc=fastboot@lists.osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox