Received: with ECARTIS (v1.0.0; list kdb); Wed, 23 Apr 2008 04:12:15 -0700 (PDT) Received: from cuda.sgi.com (cuda1.sgi.com [192.48.168.28]) by oss.sgi.com (8.12.11.20060308/8.12.11/SuSE Linux 0.7) with ESMTP id m3NBC2qJ016189 for ; Wed, 23 Apr 2008 04:12:03 -0700 X-ASG-Debug-ID: 1208949163-1968030d0000-sLlkUa X-Barracuda-URL: http://cuda.sgi.com:80/cgi-bin/mark.cgi Received: from tyo201.gate.nec.co.jp (localhost [127.0.0.1]) by cuda.sgi.com (Spam Firewall) with ESMTP id B8C5210A8B7C for ; Wed, 23 Apr 2008 04:12:44 -0700 (PDT) Received: from tyo201.gate.nec.co.jp (TYO201.gate.nec.co.jp [202.32.8.193]) by cuda.sgi.com with ESMTP id feIoP8kx2XsTwQVL for ; Wed, 23 Apr 2008 04:12:44 -0700 (PDT) Received: from mailgate3.nec.co.jp (mailgate53F.nec.co.jp [10.7.69.162]) by tyo201.gate.nec.co.jp (8.13.8/8.13.4) with ESMTP id m3NBC9np017928; Wed, 23 Apr 2008 20:12:09 +0900 (JST) Received: (from root@localhost) by mailgate3.nec.co.jp (8.11.7/3.7W-MAILGATE-NEC) id m3NBC9719556; Wed, 23 Apr 2008 20:12:09 +0900 (JST) Received: from mailsv.linux.bs1.fc.nec.co.jp (mailsv.linux.bs1.fc.nec.co.jp [10.34.125.2]) by mailsv4.nec.co.jp (8.13.8/8.13.4) with ESMTP id m3NBC8Lk011802; Wed, 23 Apr 2008 20:12:08 +0900 (JST) Received: from [10.34.125.197] (T-NAGANO-AH1.linux.bs1.fc.nec.co.jp [10.34.125.197]) by mailsv.linux.bs1.fc.nec.co.jp (Postfix) with ESMTP id 1C432E48245; Wed, 23 Apr 2008 20:12:08 +0900 (JST) Message-ID: <480F1987.9010501@ah.jp.nec.com> Date: Wed, 23 Apr 2008 20:12:07 +0900 From: Takenori Nagano User-Agent: Thunderbird 2.0.0.12 (Windows/20080213) MIME-Version: 1.0 To: linux-kernel@vger.kernel.org, Andrew Morton CC: kdb@oss.sgi.com, vgoyal@redhat.com, "Eric W. Biederman" , kexec@lists.infradead.org, Keith Owens , Nick Piggin , Randy Dunlap , greg@kroah.com, bwalle@suse.de, k-miyoshi@cb.jp.nec.com X-ASG-Orig-Subj: [PATCH 3/3] Move crash_kexec() into panic_notifier, take4 Subject: [PATCH 3/3] Move crash_kexec() into panic_notifier, take4 References: <480DD85C.7060200@ah.jp.nec.com> In-Reply-To: <480DD85C.7060200@ah.jp.nec.com> Content-type: text/plain; charset=ISO-2022-JP Content-Transfer-Encoding: 8bit X-Barracuda-Connect: TYO201.gate.nec.co.jp[202.32.8.193] X-Barracuda-Start-Time: 1208949164 X-Barracuda-Bayes: INNOCENT GLOBAL 0.0000 1.0000 -2.0210 X-Barracuda-Virus-Scanned: by cuda.sgi.com at sgi.com X-Barracuda-Spam-Score: -2.02 X-Barracuda-Spam-Status: No, SCORE=-2.02 using per-user scores of TAG_LEVEL=2.0 QUARANTINE_LEVEL=1000.0 KILL_LEVEL=2.1 tests= X-Barracuda-Spam-Report: Code version 3.1, rules version 3.1.48597 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- X-archive-position: 1345 X-ecartis-version: Ecartis v1.0.0 Sender: kdb-bounce@oss.sgi.com Errors-to: kdb-bounce@oss.sgi.com X-original-sender: t-nagano@ah.jp.nec.com Precedence: bulk X-list: kdb This patch moves crash_kexec() into panic_notifier. If you want to use it, you have to set config option DUMP_ON_PANIC_NOTIFIER to Y. Its default value is N. If you set DUMP_ON_PANIC_NOTIFIER to N, kdump has no difference before. Thanks, --- Signed-off-by: Takenori Nagano --- diff -uprN linux-2.6.25.orig/arch/ia64/Kconfig linux-2.6.25/arch/ia64/Kconfig --- linux-2.6.25.orig/arch/ia64/Kconfig 2008-04-22 20:34:42.567581801 +0900 +++ linux-2.6.25/arch/ia64/Kconfig 2008-04-22 18:54:05.168734196 +0900 @@ -541,6 +541,14 @@ config CRASH_DUMP help Generate crash dump after being started by kexec. +config DUMP_ON_PANIC_NOTIFIER + bool "Call crash dump function from panic notifier" + depends on CRASH_DUMP + default n + help + Say Y here to be able to call crash dump function from panic_notifier. + It makes a chance to do something before taking crash dump. + source "drivers/firmware/Kconfig" source "fs/Kconfig.binfmt" diff -uprN linux-2.6.25.orig/arch/powerpc/Kconfig linux-2.6.25/arch/powerpc/Kconfig --- linux-2.6.25.orig/arch/powerpc/Kconfig 2008-04-22 20:34:43.115578199 +0900 +++ linux-2.6.25/arch/powerpc/Kconfig 2008-04-22 18:51:03.085855052 +0900 @@ -304,6 +304,14 @@ config CRASH_DUMP Don't change this unless you know what you are doing. +config DUMP_ON_PANIC_NOTIFIER + bool "Call crash dump function from panic notifier (EXPERIMENTAL)" + depends on CRASH_DUMP + default n + help + Say Y here to be able to call crash dump function from panic_notifier. + It makes a chance to do something before taking crash dump. + config PHYP_DUMP bool "Hypervisor-assisted dump (EXPERIMENTAL)" depends on PPC_PSERIES && EXPERIMENTAL diff -uprN linux-2.6.25.orig/arch/sh/Kconfig linux-2.6.25/arch/sh/Kconfig --- linux-2.6.25.orig/arch/sh/Kconfig 2008-04-22 20:34:44.167571856 +0900 +++ linux-2.6.25/arch/sh/Kconfig 2008-04-22 18:53:51.152813154 +0900 @@ -695,6 +695,14 @@ config CRASH_DUMP For more details see Documentation/kdump/kdump.txt +config DUMP_ON_PANIC_NOTIFIER + bool "Call crash dump function from panic notifier" + depends on CRASH_DUMP + default n + help + Say Y here to be able to call crash dump function from panic_notifier. + It makes a chance to do something before taking crash dump. + config SMP bool "Symmetric multi-processing support" depends on SYS_SUPPORTS_SMP diff -uprN linux-2.6.25.orig/arch/x86/Kconfig linux-2.6.25/arch/x86/Kconfig --- linux-2.6.25.orig/arch/x86/Kconfig 2008-04-22 20:34:44.367570179 +0900 +++ linux-2.6.25/arch/x86/Kconfig 2008-04-22 18:55:42.372136199 +0900 @@ -1159,6 +1159,14 @@ config CRASH_DUMP (CONFIG_RELOCATABLE=y). For more details see Documentation/kdump/kdump.txt +config DUMP_ON_PANIC_NOTIFIER + bool "Call crash dump function from panic notifier" + depends on CRASH_DUMP + default n + help + Say Y here to be able to call crash dump function from panic_notifier. + It makes a chance to do something before taking crash dump. + config PHYSICAL_START hex "Physical address where the kernel is loaded" if (EMBEDDED || CRASH_DUMP) default "0x1000000" if X86_NUMAQ diff -uprN linux-2.6.25.orig/kernel/kexec.c linux-2.6.25/kernel/kexec.c --- linux-2.6.25.orig/kernel/kexec.c 2008-04-22 20:35:03.099455119 +0900 +++ linux-2.6.25/kernel/kexec.c 2008-04-22 20:54:37.324228945 +0900 @@ -1133,6 +1133,25 @@ void crash_save_cpu(struct pt_regs *regs final_note(buf); } +#ifdef CONFIG_DUMP_ON_PANIC_NOTIFIER +static int panic_kexec(struct notifier_block *nb, unsigned long e, void *ptr) +{ + crash_kexec(NULL); + + return NOTIFY_DONE; +} + +static struct notifier_block panic_block_base = { + .notifier_call = panic_kexec, + .next = NULL, + .priority = INT_MAX +}; + +static struct tunable_atomic_notifier_block panic_block = { + .nb = &panic_block_base, +}; +#endif + static int __init crash_notes_memory_init(void) { /* Allocate memory for saving cpu registers. */ @@ -1142,6 +1161,11 @@ static int __init crash_notes_memory_ini " states failed\n"); return -ENOMEM; } +#ifdef CONFIG_DUMP_ON_PANIC_NOTIFIER + tunable_atomic_notifier_chain_register(&panic_notifier_list, + &panic_block, + "kdump", "Generate crash dump after being started by kexec."); +#endif return 0; } module_init(crash_notes_memory_init) --------------------------- Use http://oss.sgi.com/ecartis to modify your settings or to unsubscribe.