Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932132AbVIUG4x (ORCPT ); Wed, 21 Sep 2005 02:56:53 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1751007AbVIUG4x (ORCPT ); Wed, 21 Sep 2005 02:56:53 -0400 Received: from e36.co.us.ibm.com ([32.97.110.154]:43228 "EHLO e36.co.us.ibm.com") by vger.kernel.org with ESMTP id S1750826AbVIUG4w (ORCPT ); Wed, 21 Sep 2005 02:56:52 -0400 Date: Wed, 21 Sep 2005 12:26:33 +0530 From: Vivek Goyal To: Morton Andrew Morton Cc: linux kernel mailing list , Fastboot mailing list , Anderson Dave Anderson Subject: [PATCH] Kdump(x86): add note type NT_KDUMPINFO to kernel core dumps Message-ID: <20050921065633.GC3780@in.ibm.com> Reply-To: vgoyal@in.ibm.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.4.2.1i Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3625 Lines: 90 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 --- 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 { _ - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/