public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "K.Prasad" <prasad@linux.vnet.ibm.com>
To: linux-kernel@vger.kernel.org
Cc: Vivek Goyal <vgoyal@redhat.com>, Borislav Petkov <bp@alien8.de>,
	"Luck, Tony" <tony.luck@intel.com>,
	"Eric W. Biederman" <ebiederm@xmission.com>,
	anderson@redhat.com, tachibana@mxm.nes.nec.co.jp,
	oomichi@mxs.nes.nec.co.jp, Valdis.Kletnieks@vt.edu,
	Nick Bowler <nbowler@elliptictech.com>
Subject: [RFC Patch 1/2][slimdump] Append CRASH_REASON to VMCOREINFO elf-note
Date: Mon, 21 Nov 2011 15:41:57 +0530	[thread overview]
Message-ID: <20111121101157.GA10194@in.ibm.com> (raw)
In-Reply-To: <20111121095405.GA2289@in.ibm.com>

Allow various crash paths to append the reason of crash into the
VMCOREINFO elf-note through the field CRASH_REASON. We also make the
fatal machine check exceptions append "PANIC_MCE" as the crash reason.
This string will be recognised by upstream tools like makedumpfile and
crash to generate slimdump.

With increased usage of the CRASH_REASON field, the crash strings can be
encoded for better usage.

Signed-off-by: K.Prasad <prasad@linux.vnet.ibm.com>
---
 arch/x86/kernel/cpu/mcheck/mce.c |    8 ++++++++
 kernel/kexec.c                   |    6 ++++++
 2 files changed, 14 insertions(+), 0 deletions(-)

diff --git a/arch/x86/kernel/cpu/mcheck/mce.c b/arch/x86/kernel/cpu/mcheck/mce.c
index 362056a..5b2cb6a 100644
--- a/arch/x86/kernel/cpu/mcheck/mce.c
+++ b/arch/x86/kernel/cpu/mcheck/mce.c
@@ -38,6 +38,7 @@
 #include <linux/debugfs.h>
 #include <linux/irq_work.h>
 #include <linux/export.h>
+#include <linux/kexec.h>
 
 #include <asm/processor.h>
 #include <asm/mce.h>
@@ -240,6 +241,13 @@ static atomic_t mce_paniced;
 static int fake_panic;
 static atomic_t mce_fake_paniced;
 
+char *arch_add_crash_reason(void)
+{
+	static char crash_reason[] = "PANIC_MCE";
+
+	return crash_reason;
+}
+
 /* Panic in progress. Enable interrupts and wait for final IPI */
 static void wait_for_panic(void)
 {
diff --git a/kernel/kexec.c b/kernel/kexec.c
index dc7bc08..a731693 100644
--- a/kernel/kexec.c
+++ b/kernel/kexec.c
@@ -1080,6 +1080,11 @@ asmlinkage long compat_sys_kexec_load(unsigned long entry,
 }
 #endif
 
+__weak char *arch_add_crash_reason(void)
+{
+	return (char *)NULL;
+}
+
 void crash_kexec(struct pt_regs *regs)
 {
 	/* Take the kexec_mutex here to prevent sys_kexec_load
@@ -1411,6 +1416,7 @@ static void update_vmcoreinfo_note(void)
 void crash_save_vmcoreinfo(void)
 {
 	vmcoreinfo_append_str("CRASHTIME=%ld", get_seconds());
+	vmcoreinfo_append_str("\nCRASH_REASON=%s\n", arch_add_crash_reason());
 	update_vmcoreinfo_note();
 }
 


  reply	other threads:[~2011-11-21 10:12 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-21  9:54 [RFC Patch 0/2] Slimdump framework using CRASH_REASON - v2 K.Prasad
2011-11-21 10:11 ` K.Prasad [this message]
2011-11-21 15:11   ` [RFC Patch 1/2][slimdump] Append CRASH_REASON to VMCOREINFO elf-note Vivek Goyal
2011-11-23 16:14     ` K.Prasad
2011-11-21 15:19   ` Dave Anderson
2011-11-23 17:39     ` K.Prasad
2011-11-28 14:26       ` Vivek Goyal
2011-11-23 17:42     ` K.Prasad
2011-11-23 19:45       ` Dave Anderson
2011-11-29 14:37         ` K.Prasad
2011-11-21 10:14 ` [RFC Patch 2/2][slimdump][makedumpfile] Recognise PANIC_MCE crashes to generate slimdu K.Prasad
2011-11-21 15:17 ` [RFC Patch 0/2] Slimdump framework using CRASH_REASON - v2 Vivek Goyal
2011-11-23 17:33   ` K.Prasad
2011-11-28 14:24     ` Vivek Goyal
2011-11-30 17:15       ` K.Prasad

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=20111121101157.GA10194@in.ibm.com \
    --to=prasad@linux.vnet.ibm.com \
    --cc=Valdis.Kletnieks@vt.edu \
    --cc=anderson@redhat.com \
    --cc=bp@alien8.de \
    --cc=ebiederm@xmission.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nbowler@elliptictech.com \
    --cc=oomichi@mxs.nes.nec.co.jp \
    --cc=tachibana@mxm.nes.nec.co.jp \
    --cc=tony.luck@intel.com \
    --cc=vgoyal@redhat.com \
    /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