From: Takenori Nagano <t-nagano@ah.jp.nec.com>
To: linux-kernel@vger.kernel.org, Andrew Morton <akpm@linux-foundation.org>
Cc: kdb@oss.sgi.com, vgoyal@redhat.com,
"Eric W. Biederman" <ebiederm@xmission.com>,
kexec@lists.infradead.org, Keith Owens <kaos@ocs.com.au>,
Nick Piggin <nickpiggin@yahoo.com.au>,
Randy Dunlap <rdunlap@xenotime.net>,
greg@kroah.com, bwalle@suse.de, k-miyoshi@cb.jp.nec.com
Subject: [PATCH 3/3] Move crash_kexec() into panic_notifier, take4
Date: Wed, 23 Apr 2008 20:12:07 +0900 [thread overview]
Message-ID: <480F1987.9010501@ah.jp.nec.com> (raw)
In-Reply-To: <480DD85C.7060200@ah.jp.nec.com>
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 <t-nagano@ah.jp.nec.com>
---
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)
next prev parent reply other threads:[~2008-04-23 11:13 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <480DD85C.7060200@ah.jp.nec.com>
2008-04-23 11:11 ` [PATCH 1/2] add tunable_notifier function ,take4 Takenori Nagano
2008-04-23 11:11 ` [PATCH 2/2] implement new notifier function to panic_notifier_list ,take4 Takenori Nagano
2008-04-23 11:13 ` Takenori Nagano
2008-04-23 11:12 ` Takenori Nagano [this message]
2008-04-23 12:11 ` [PATCH 3/3] Move crash_kexec() into panic_notifier, take4 Eric W. Biederman
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=480F1987.9010501@ah.jp.nec.com \
--to=t-nagano@ah.jp.nec.com \
--cc=akpm@linux-foundation.org \
--cc=bwalle@suse.de \
--cc=ebiederm@xmission.com \
--cc=greg@kroah.com \
--cc=k-miyoshi@cb.jp.nec.com \
--cc=kaos@ocs.com.au \
--cc=kdb@oss.sgi.com \
--cc=kexec@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=nickpiggin@yahoo.com.au \
--cc=rdunlap@xenotime.net \
--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