linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Kdump(x86): add note type NT_KDUMPINFO to kernel core dumps
@ 2005-09-21  6:56 Vivek Goyal
  2005-09-21 14:28 ` [Fastboot] " Eric W. Biederman
  0 siblings, 1 reply; 21+ messages in thread
From: Vivek Goyal @ 2005-09-21  6:56 UTC (permalink / raw)
  To: Morton Andrew Morton
  Cc: linux kernel mailing list, Fastboot mailing list, Anderson Dave Anderson



o This patch adds a new note type NT_KDUMPINFO. This note is added with 
  kernel core dumps generated by kdump.

o This note mainly communicates the information required by kernel dump
  analysis tool "crash" to analyze the kernel core dump. As of now it contains 
  the pointer to task struct of panicing task and page size. Page size is 
  irrelevant for i386 but is required for architectures like ia64 and ppc64. 

o gdb is not affected by this change as gdb need not to parse this note.

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

 linux-2.6.14-rc1-mm1-vivek/arch/i386/kernel/crash.c |    9 +++++++++
 linux-2.6.14-rc1-mm1-vivek/include/linux/elf.h      |    2 +-
 linux-2.6.14-rc1-mm1-vivek/include/linux/elfcore.h  |   13 +++++++++++++
 3 files changed, 23 insertions(+), 1 deletion(-)

diff -puN arch/i386/kernel/crash.c~kdump-x86-add-note-type-nt-kdump arch/i386/kernel/crash.c
--- linux-2.6.14-rc1-mm1/arch/i386/kernel/crash.c~kdump-x86-add-note-type-nt-kdump	2005-09-21 12:22:14.113474136 +0530
+++ linux-2.6.14-rc1-mm1-vivek/arch/i386/kernel/crash.c	2005-09-21 12:22:14.128471856 +0530
@@ -62,6 +62,7 @@ static void final_note(u32 *buf)
 static void crash_save_this_cpu(struct pt_regs *regs, int cpu)
 {
 	struct elf_prstatus prstatus;
+	struct elf_kdumpinfo kdumpinfo;
 	u32 *buf;
 
 	if ((cpu < 0) || (cpu >= NR_CPUS))
@@ -80,6 +81,14 @@ static void crash_save_this_cpu(struct p
 	elf_core_copy_regs(&prstatus.pr_reg, regs);
 	buf = append_elf_note(buf, "CORE", NT_PRSTATUS, &prstatus,
 				sizeof(prstatus));
+
+	/* Also store NT_KDUMPINFO */
+	if (cpu == crashing_cpu) {
+		kdumpinfo.page_shift = PAGE_SHIFT;
+		kdumpinfo.panic_tsk = current;
+		buf = append_elf_note(buf, "CORE", NT_KDUMPINFO, &kdumpinfo,
+					sizeof(kdumpinfo));
+	}
 	final_note(buf);
 }
 
diff -puN include/linux/elfcore.h~kdump-x86-add-note-type-nt-kdump include/linux/elfcore.h
--- linux-2.6.14-rc1-mm1/include/linux/elfcore.h~kdump-x86-add-note-type-nt-kdump	2005-09-21 12:22:14.116473680 +0530
+++ linux-2.6.14-rc1-mm1-vivek/include/linux/elfcore.h	2005-09-21 12:22:14.129471704 +0530
@@ -79,9 +79,22 @@ struct elf_prpsinfo
 	char	pr_psargs[ELF_PRARGSZ];	/* initial part of arg list */
 };
 
+/*
+ * NT_KDUMPINFO can be used to communicate additional information required for
+ * kernel core dumps. Additional information includes kernel configuration
+ * variables like page size and any other relevant data required by
+ * debugger (crash in this case).
+*/
+struct elf_kdumpinfo
+{
+	char page_shift;		/* Page size */
+	struct task_struct *panic_tsk;	/* Pointer to panic task_struct */
+};
+
 #ifndef __KERNEL__
 typedef struct elf_prstatus prstatus_t;
 typedef struct elf_prpsinfo prpsinfo_t;
+typedef struct elf_kdumpinfo kdumpinfo_t;
 #define PRARGSZ ELF_PRARGSZ 
 #endif
 
diff -puN include/linux/elf.h~kdump-x86-add-note-type-nt-kdump include/linux/elf.h
--- linux-2.6.14-rc1-mm1/include/linux/elf.h~kdump-x86-add-note-type-nt-kdump	2005-09-21 12:22:14.120473072 +0530
+++ linux-2.6.14-rc1-mm1-vivek/include/linux/elf.h	2005-09-21 12:22:14.130471552 +0530
@@ -391,7 +391,7 @@ typedef struct elf64_shdr {
 #define NT_TASKSTRUCT	4
 #define NT_AUXV		6
 #define NT_PRXFPREG     0x46e62b7f      /* copied from gdb5.1/include/elf/common.h */
-
+#define NT_KDUMPINFO	7		/* Used for kernel core dumps */
 
 /* Note header in a PT_NOTE section */
 typedef struct elf32_note {
_

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

end of thread, other threads:[~2005-09-26  6:29 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-09-21  6:56 [PATCH] Kdump(x86): add note type NT_KDUMPINFO to kernel core dumps Vivek Goyal
2005-09-21 14:28 ` [Fastboot] " Eric W. Biederman
2005-09-21 15:17   ` [Fastboot] [PATCH] Kdump(x86): add note type NT_KDUMPINFO tokernel " Dave Anderson
2005-09-22  9:01     ` Eric W. Biederman
2005-09-22 14:08       ` Vivek Goyal
2005-09-22 15:06         ` Dave Anderson
2005-09-22 16:31           ` Eric W. Biederman
2005-09-22 20:33             ` Haren Myneni
2005-09-23  5:09             ` Vivek Goyal
2005-09-23  7:22               ` Eric W. Biederman
2005-09-23 15:17               ` Subject: [PATCH] Don't uselessly export task_struct to user space in " Eric W. Biederman
     [not found]             ` <OF0A1E6B6F.F00DC760-ON87257084.005F99D6-88257084.00634A38@us.ibm.com>
2005-09-23  5:19               ` [Fastboot] [PATCH] Kdump(x86): add note type NT_KDUMPINFO tokernel " Vivek Goyal
     [not found]               ` <4332FD56.2F5256F5@redhat.com>
2005-09-23  7:12                 ` [Fastboot] [PATCH] Kdump(x86): add note type NT_KDUMPINFO tokernelcore dumps Eric W. Biederman
2005-09-23 12:01                   ` Vivek Goyal
2005-09-26  6:29                   ` Vivek Goyal
2005-09-22 16:38         ` [Fastboot] [PATCH] Kdump(x86): add note type NT_KDUMPINFO tokernel core dumps Eric W. Biederman
2005-09-22 17:00           ` [Fastboot] [PATCH] Kdump(x86): add note type NT_KDUMPINFOtokernel " Dave Anderson
2005-09-22  7:39   ` [Fastboot] [PATCH] Kdump(x86): add note type NT_KDUMPINFO to kernel " Vivek Goyal
2005-09-22  7:46     ` Andrew Morton
2005-09-22  8:32       ` Vivek Goyal
2005-09-22  9:11     ` Eric W. Biederman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).