Hi,
kdb has some problem to use with kdump.
This patch fixes some of them.
1) We can't use kdb when machine panicked.
crash_kexec() is called before notifier_call_chain(&panic_notifier_chain).
This patch makes KDB_ENTER() is called before crash_kexec().
2) We can't take a kdump when KDB_FLAG is set CATASTROPHIC.
kdb_do_dump() does not support kdump.
This patch makes machine_kexec() is called from kdb_do_dump().
diff -uprN linux-2.6.22-rc3.orig/kdb/kdbmain.c linux-2.6.22-rc3/kdb/kdbmain.c
--- linux-2.6.22-rc3.orig/kdb/kdbmain.c 2007-05-31 15:08:40.296000000 +0900
+++ linux-2.6.22-rc3/kdb/kdbmain.c 2007-05-31 15:18:52.172000000 +0900
@@ -36,6 +36,9 @@
#include <linux/nmi.h>
#include <linux/ptrace.h>
#include <linux/sysctl.h>
+#ifdef CONFIG_KEXEC
+#include <linux/kexec.h>
+#endif
#if defined(CONFIG_LKCD_DUMP) || defined(CONFIG_LKCD_DUMP_MODULE)
#include <linux/dump.h>
#endif
@@ -1089,6 +1092,21 @@ handle_ctrl_cmd(char *cmd)
static void
kdb_do_dump(void)
{
+#ifdef CONFIG_KEXEC
+#ifdef CONFIG_IA64
+ if (ia64_kimage) {
+ kexec_disable_iosapic();
+ machine_kexec(ia64_kimage);
+ }
+#else
+ if (kexec_crash_image) {
+#ifdef CONFIG_X86_IO_APIC
+ disable_IO_APIC();
+#endif /* CONFIG_X86_IO_APIC */
+ machine_kexec(kexec_crash_image);
+ }
+#endif /* CONFIG_IA64 */
+#endif /* CONFIG_KEXEC */
#if defined(CONFIG_LKCD_DUMP) || defined(CONFIG_LKCD_DUMP_MODULE)
kdb_printf("Forcing dump (if configured)\n");
console_loglevel = 8; /* to see the dump messages */
@@ -3868,35 +3886,6 @@ kdb_cmd_init(void)
}
}
-/*
- * kdb_panic
- *
- * Invoked via the panic_notifier_list.
- *
- * Inputs:
- * None.
- * Outputs:
- * None.
- * Returns:
- * Zero.
- * Locking:
- * None.
- * Remarks:
- * When this function is called from panic(), the other cpus have already
- * been stopped.
- *
- */
-
-static int
-kdb_panic(struct notifier_block *self, unsigned long command, void *ptr)
-{
- KDB_FLAG_SET(CATASTROPHIC); /* kernel state is dubious now */
- KDB_ENTER();
- return 0;
-}
-
-static struct notifier_block kdb_block = { kdb_panic, NULL, 0 };
-
#ifdef CONFIG_SYSCTL
static int proc_do_kdb(ctl_table *table, int write, struct file *filp,
void __user *buffer, size_t *lenp, loff_t *ppos)
@@ -3989,7 +3978,6 @@ kdb_init(void)
kdb_initial_cpu = -1; /* Avoid recursion problems */
kdb(KDB_REASON_CPU_UP, 0, NULL); /* do kdb setup on boot cpu */
kdb_initial_cpu = smp_processor_id();
- atomic_notifier_chain_register(&panic_notifier_list, &kdb_block);
register_cpu_notifier(&kdb_cpu_nfb);
#ifdef kdba_setjmp
diff -uprN linux-2.6.22-rc3.orig/kernel/panic.c linux-2.6.22-rc3/kernel/panic.c
--- linux-2.6.22-rc3.orig/kernel/panic.c 2007-05-26 11:55:14.000000000
+0900
+++ linux-2.6.22-rc3/kernel/panic.c 2007-05-31 15:20:41.712000000 +0900
@@ -19,6 +19,10 @@
#include <linux/nmi.h>
#include <linux/kexec.h>
#include <linux/debug_locks.h>
+#ifdef CONFIG_KDB
+#include <linux/kdb.h>
+#include <linux/kdbprivate.h>
+#endif
int panic_on_oops;
int tainted;
@@ -80,6 +84,11 @@ NORET_TYPE void panic(const char * fmt,
printk(KERN_EMERG "Kernel panic - not syncing: %s\n",buf);
bust_spinlocks(0);
+#ifdef CONFIG_KDB
+ KDB_FLAG_SET(CATASTROPHIC);
+ KDB_ENTER()
+#endif
+
/*
* If we have crashed and we have a crash kernel loaded let it handle
* everything else.
---------------------------
Use http://oss.sgi.com/ecartis to modify your settings or to unsubscribe.