aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2007-05-08 03:27:03 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-05-08 14:15:04 -0400
commit1eeb66a1bb973534dc3d064920a5ca683823372e (patch)
tree19c22d611e6adefb352dbc107b859e4d13ba38c1
parente3869792990f708c97be5877499cada70d469bd3 (diff)
move die notifier handling to common code
This patch moves the die notifier handling to common code. Previous various architectures had exactly the same code for it. Note that the new code is compiled unconditionally, this should be understood as an appel to the other architecture maintainer to implement support for it aswell (aka sprinkling a notify_die or two in the proper place) arm had a notifiy_die that did something totally different, I renamed it to arm_notify_die as part of the patch and made it static to the file it's declared and used at. avr32 used to pass slightly less information through this interface and I brought it into line with the other architectures. [akpm@linux-foundation.org: build fix] [akpm@linux-foundation.org: fix vmalloc_sync_all bustage] [bryan.wu@analog.com: fix vmalloc_sync_all in nommu] Signed-off-by: Christoph Hellwig <hch@lst.de> Cc: <linux-arch@vger.kernel.org> Cc: Russell King <rmk@arm.linux.org.uk> Signed-off-by: Bryan Wu <bryan.wu@analog.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r--arch/arm/kernel/traps.c14
-rw-r--r--arch/arm/mm/fault.c2
-rw-r--r--arch/avr32/kernel/kprobes.c2
-rw-r--r--arch/avr32/kernel/ptrace.c4
-rw-r--r--arch/avr32/kernel/traps.c14
-rw-r--r--arch/avr32/mm/fault.c2
-rw-r--r--arch/i386/kernel/crash.c2
-rw-r--r--arch/i386/kernel/kprobes.c2
-rw-r--r--arch/i386/kernel/nmi.c2
-rw-r--r--arch/i386/kernel/traps.c16
-rw-r--r--arch/i386/mm/fault.c3
-rw-r--r--arch/i386/oprofile/nmi_int.c2
-rw-r--r--arch/i386/oprofile/nmi_timer_int.c3
-rw-r--r--arch/ia64/kernel/crash.c2
-rw-r--r--arch/ia64/kernel/kprobes.c2
-rw-r--r--arch/ia64/kernel/mca.c2
-rw-r--r--arch/ia64/kernel/process.c2
-rw-r--r--arch/ia64/kernel/traps.c18
-rw-r--r--arch/ia64/mm/fault.c2
-rw-r--r--arch/ia64/sn/kernel/xpc_main.c4
-rw-r--r--arch/powerpc/kernel/kprobes.c2
-rw-r--r--arch/powerpc/kernel/traps.c16
-rw-r--r--arch/powerpc/mm/fault.c2
-rw-r--r--arch/s390/kernel/kprobes.c2
-rw-r--r--arch/s390/kernel/traps.c16
-rw-r--r--arch/s390/mm/fault.c2
-rw-r--r--arch/sparc/kernel/head.S2
-rw-r--r--arch/sparc/kernel/setup.c2
-rw-r--r--arch/sparc/kernel/traps.c2
-rw-r--r--arch/sparc/mm/fault.c2
-rw-r--r--arch/sparc/mm/srmmu.c2
-rw-r--r--arch/sparc64/kernel/kprobes.c2
-rw-r--r--arch/sparc64/kernel/traps.c15
-rw-r--r--arch/sparc64/mm/fault.c2
-rw-r--r--arch/x86_64/kernel/crash.c2
-rw-r--r--arch/x86_64/kernel/kprobes.c2
-rw-r--r--arch/x86_64/kernel/mce.c2
-rw-r--r--arch/x86_64/kernel/nmi.c2
-rw-r--r--arch/x86_64/kernel/pci-gart.c2
-rw-r--r--arch/x86_64/kernel/process.c2
-rw-r--r--arch/x86_64/kernel/reboot.c2
-rw-r--r--arch/x86_64/kernel/smpboot.c2
-rw-r--r--arch/x86_64/kernel/traps.c18
-rw-r--r--arch/x86_64/mm/fault.c3
-rw-r--r--drivers/char/ipmi/ipmi_watchdog.c1
-rw-r--r--include/asm-alpha/kdebug.h1
-rw-r--r--include/asm-arm/kdebug.h1
-rw-r--r--include/asm-arm/system.h2
-rw-r--r--include/asm-arm26/kdebug.h1
-rw-r--r--include/asm-avr32/kdebug.h25
-rw-r--r--include/asm-cris/kdebug.h1
-rw-r--r--include/asm-frv/kdebug.h1
-rw-r--r--include/asm-generic/kdebug.h8
-rw-r--r--include/asm-h8300/kdebug.h1
-rw-r--r--include/asm-i386/kdebug.h24
-rw-r--r--include/asm-i386/pgtable.h2
-rw-r--r--include/asm-ia64/kdebug.h27
-rw-r--r--include/asm-m32r/kdebug.h1
-rw-r--r--include/asm-m68k/kdebug.h1
-rw-r--r--include/asm-m68knommu/kdebug.h1
-rw-r--r--include/asm-mips/kdebug.h1
-rw-r--r--include/asm-parisc/kdebug.h1
-rw-r--r--include/asm-powerpc/kdebug.h18
-rw-r--r--include/asm-ppc/kdebug.h1
-rw-r--r--include/asm-s390/kdebug.h30
-rw-r--r--include/asm-sh/kdebug.h1
-rw-r--r--include/asm-sh64/kdebug.h1
-rw-r--r--include/asm-sparc/kdebug.h4
-rw-r--r--include/asm-sparc64/kdebug.h23
-rw-r--r--include/asm-um/kdebug.h1
-rw-r--r--include/asm-v850/kdebug.h1
-rw-r--r--include/asm-x86_64/kdebug.h24
-rw-r--r--include/asm-x86_64/pgtable.h1
-rw-r--r--include/asm-xtensa/kdebug.h1
-rw-r--r--include/linux/kdebug.h20
-rw-r--r--include/linux/vmalloc.h1
-rw-r--r--kernel/Makefile2
-rw-r--r--kernel/die_notifier.c38
-rw-r--r--kernel/kprobes.c2
-rw-r--r--mm/nommu.c8
-rw-r--r--mm/vmalloc.c7
81 files changed, 162 insertions, 328 deletions
diff --git a/arch/arm/kernel/traps.c b/arch/arm/kernel/traps.c
index f05e66b0f868..10ff36e4e414 100644
--- a/arch/arm/kernel/traps.c
+++ b/arch/arm/kernel/traps.c
@@ -245,8 +245,8 @@ NORET_TYPE void die(const char *str, struct pt_regs *regs, int err)
245 do_exit(SIGSEGV); 245 do_exit(SIGSEGV);
246} 246}
247 247
248void notify_die(const char *str, struct pt_regs *regs, struct siginfo *info, 248void arm_notify_die(const char *str, struct pt_regs *regs,
249 unsigned long err, unsigned long trap) 249 struct siginfo *info, unsigned long err, unsigned long trap)
250{ 250{
251 if (user_mode(regs)) { 251 if (user_mode(regs)) {
252 current->thread.error_code = err; 252 current->thread.error_code = err;
@@ -330,7 +330,7 @@ asmlinkage void __exception do_undefinstr(struct pt_regs *regs)
330 info.si_code = ILL_ILLOPC; 330 info.si_code = ILL_ILLOPC;
331 info.si_addr = pc; 331 info.si_addr = pc;
332 332
333 notify_die("Oops - undefined instruction", regs, &info, 0, 6); 333 arm_notify_die("Oops - undefined instruction", regs, &info, 0, 6);
334} 334}
335 335
336asmlinkage void do_unexp_fiq (struct pt_regs *regs) 336asmlinkage void do_unexp_fiq (struct pt_regs *regs)
@@ -384,7 +384,7 @@ static int bad_syscall(int n, struct pt_regs *regs)
384 info.si_addr = (void __user *)instruction_pointer(regs) - 384 info.si_addr = (void __user *)instruction_pointer(regs) -
385 (thumb_mode(regs) ? 2 : 4); 385 (thumb_mode(regs) ? 2 : 4);
386 386
387 notify_die("Oops - bad syscall", regs, &info, n, 0); 387 arm_notify_die("Oops - bad syscall", regs, &info, n, 0);
388 388
389 return regs->ARM_r0; 389 return regs->ARM_r0;
390} 390}
@@ -428,7 +428,7 @@ asmlinkage int arm_syscall(int no, struct pt_regs *regs)
428 info.si_code = SEGV_MAPERR; 428 info.si_code = SEGV_MAPERR;
429 info.si_addr = NULL; 429 info.si_addr = NULL;
430 430
431 notify_die("branch through zero", regs, &info, 0, 0); 431 arm_notify_die("branch through zero", regs, &info, 0, 0);
432 return 0; 432 return 0;
433 433
434 case NR(breakpoint): /* SWI BREAK_POINT */ 434 case NR(breakpoint): /* SWI BREAK_POINT */
@@ -564,7 +564,7 @@ asmlinkage int arm_syscall(int no, struct pt_regs *regs)
564 info.si_addr = (void __user *)instruction_pointer(regs) - 564 info.si_addr = (void __user *)instruction_pointer(regs) -
565 (thumb_mode(regs) ? 2 : 4); 565 (thumb_mode(regs) ? 2 : 4);
566 566
567 notify_die("Oops - bad syscall(2)", regs, &info, no, 0); 567 arm_notify_die("Oops - bad syscall(2)", regs, &info, no, 0);
568 return 0; 568 return 0;
569} 569}
570 570
@@ -638,7 +638,7 @@ baddataabort(int code, unsigned long instr, struct pt_regs *regs)
638 info.si_code = ILL_ILLOPC; 638 info.si_code = ILL_ILLOPC;
639 info.si_addr = (void __user *)addr; 639 info.si_addr = (void __user *)addr;
640 640
641 notify_die("unknown data abort code", regs, &info, instr, 0); 641 arm_notify_die("unknown data abort code", regs, &info, instr, 0);
642} 642}
643 643
644void __attribute__((noreturn)) __bug(const char *file, int line) 644void __attribute__((noreturn)) __bug(const char *file, int line)
diff --git a/arch/arm/mm/fault.c b/arch/arm/mm/fault.c
index 5d9ce7deb4a7..75d491448e45 100644
--- a/arch/arm/mm/fault.c
+++ b/arch/arm/mm/fault.c
@@ -453,7 +453,7 @@ do_DataAbort(unsigned long addr, unsigned int fsr, struct pt_regs *regs)
453 info.si_errno = 0; 453 info.si_errno = 0;
454 info.si_code = inf->code; 454 info.si_code = inf->code;
455 info.si_addr = (void __user *)addr; 455 info.si_addr = (void __user *)addr;
456 notify_die("", regs, &info, fsr, 0); 456 arm_notify_die("", regs, &info, fsr, 0);
457} 457}
458 458
459asmlinkage void __exception 459asmlinkage void __exception
diff --git a/arch/avr32/kernel/kprobes.c b/arch/avr32/kernel/kprobes.c
index d0abbcaf1c1e..004c94b6fc1d 100644
--- a/arch/avr32/kernel/kprobes.c
+++ b/arch/avr32/kernel/kprobes.c
@@ -15,7 +15,7 @@
15#include <linux/ptrace.h> 15#include <linux/ptrace.h>
16 16
17#include <asm/cacheflush.h> 17#include <asm/cacheflush.h>
18#include <asm/kdebug.h> 18#include <linux/kdebug.h>
19#include <asm/ocd.h> 19#include <asm/ocd.h>
20 20
21DEFINE_PER_CPU(struct kprobe *, current_kprobe); 21DEFINE_PER_CPU(struct kprobe *, current_kprobe);
diff --git a/arch/avr32/kernel/ptrace.c b/arch/avr32/kernel/ptrace.c
index 6f4388f7c20b..e8a3d7f01bae 100644
--- a/arch/avr32/kernel/ptrace.c
+++ b/arch/avr32/kernel/ptrace.c
@@ -21,7 +21,7 @@
21#include <asm/uaccess.h> 21#include <asm/uaccess.h>
22#include <asm/ocd.h> 22#include <asm/ocd.h>
23#include <asm/mmu_context.h> 23#include <asm/mmu_context.h>
24#include <asm/kdebug.h> 24#include <linux/kdebug.h>
25 25
26static struct pt_regs *get_user_regs(struct task_struct *tsk) 26static struct pt_regs *get_user_regs(struct task_struct *tsk)
27{ 27{
@@ -300,7 +300,7 @@ asmlinkage void do_debug_priv(struct pt_regs *regs)
300 else 300 else
301 die_val = DIE_BREAKPOINT; 301 die_val = DIE_BREAKPOINT;
302 302
303 if (notify_die(die_val, regs, 0, SIGTRAP) == NOTIFY_STOP) 303 if (notify_die(die_val, "ptrace", regs, 0, 0, SIGTRAP) == NOTIFY_STOP)
304 return; 304 return;
305 305
306 if (likely(ds & DS_SSS)) { 306 if (likely(ds & DS_SSS)) {
diff --git a/arch/avr32/kernel/traps.c b/arch/avr32/kernel/traps.c
index 4f0382d8483f..4de9edf96ed2 100644
--- a/arch/avr32/kernel/traps.c
+++ b/arch/avr32/kernel/traps.c
@@ -20,20 +20,6 @@
20#include <asm/sysreg.h> 20#include <asm/sysreg.h>
21#include <asm/traps.h> 21#include <asm/traps.h>
22 22
23ATOMIC_NOTIFIER_HEAD(avr32_die_chain);
24
25int register_die_notifier(struct notifier_block *nb)
26{
27 return atomic_notifier_chain_register(&avr32_die_chain, nb);
28}
29EXPORT_SYMBOL(register_die_notifier);
30
31int unregister_die_notifier(struct notifier_block *nb)
32{
33 return atomic_notifier_chain_unregister(&avr32_die_chain, nb);
34}
35EXPORT_SYMBOL(unregister_die_notifier);
36
37static DEFINE_SPINLOCK(die_lock); 23static DEFINE_SPINLOCK(die_lock);
38 24
39void NORET_TYPE die(const char *str, struct pt_regs *regs, long err) 25void NORET_TYPE die(const char *str, struct pt_regs *regs, long err)
diff --git a/arch/avr32/mm/fault.c b/arch/avr32/mm/fault.c
index 146ebdbdc302..88b00b15970f 100644
--- a/arch/avr32/mm/fault.c
+++ b/arch/avr32/mm/fault.c
@@ -13,7 +13,7 @@
13#include <linux/module.h> 13#include <linux/module.h>
14#include <linux/pagemap.h> 14#include <linux/pagemap.h>
15 15
16#include <asm/kdebug.h> 16#include <linux/kdebug.h>
17#include <asm/mmu_context.h> 17#include <asm/mmu_context.h>
18#include <asm/sysreg.h> 18#include <asm/sysreg.h>
19#include <asm/tlb.h> 19#include <asm/tlb.h>
diff --git a/arch/i386/kernel/crash.c b/arch/i386/kernel/crash.c
index a5e0e990ea95..53589d1b1a05 100644
--- a/arch/i386/kernel/crash.c
+++ b/arch/i386/kernel/crash.c
@@ -22,7 +22,7 @@
22#include <asm/nmi.h> 22#include <asm/nmi.h>
23#include <asm/hw_irq.h> 23#include <asm/hw_irq.h>
24#include <asm/apic.h> 24#include <asm/apic.h>
25#include <asm/kdebug.h> 25#include <linux/kdebug.h>
26#include <asm/smp.h> 26#include <asm/smp.h>
27 27
28#include <mach_ipi.h> 28#include <mach_ipi.h>
diff --git a/arch/i386/kernel/kprobes.c b/arch/i386/kernel/kprobes.c
index b545bc746fce..e00f75ecf1a8 100644
--- a/arch/i386/kernel/kprobes.c
+++ b/arch/i386/kernel/kprobes.c
@@ -31,8 +31,8 @@
31#include <linux/kprobes.h> 31#include <linux/kprobes.h>
32#include <linux/ptrace.h> 32#include <linux/ptrace.h>
33#include <linux/preempt.h> 33#include <linux/preempt.h>
34#include <linux/kdebug.h>
34#include <asm/cacheflush.h> 35#include <asm/cacheflush.h>
35#include <asm/kdebug.h>
36#include <asm/desc.h> 36#include <asm/desc.h>
37#include <asm/uaccess.h> 37#include <asm/uaccess.h>
38 38
diff --git a/arch/i386/kernel/nmi.c b/arch/i386/kernel/nmi.c
index 33cf2f3c444f..fba121f7973f 100644
--- a/arch/i386/kernel/nmi.c
+++ b/arch/i386/kernel/nmi.c
@@ -23,10 +23,10 @@
23#include <linux/kprobes.h> 23#include <linux/kprobes.h>
24#include <linux/cpumask.h> 24#include <linux/cpumask.h>
25#include <linux/kernel_stat.h> 25#include <linux/kernel_stat.h>
26#include <linux/kdebug.h>
26 27
27#include <asm/smp.h> 28#include <asm/smp.h>
28#include <asm/nmi.h> 29#include <asm/nmi.h>
29#include <asm/kdebug.h>
30 30
31#include "mach_traps.h" 31#include "mach_traps.h"
32 32
diff --git a/arch/i386/kernel/traps.c b/arch/i386/kernel/traps.c
index 58c8e015e77e..4bec0cbf407a 100644
--- a/arch/i386/kernel/traps.c
+++ b/arch/i386/kernel/traps.c
@@ -52,7 +52,7 @@
52#include <asm/unwind.h> 52#include <asm/unwind.h>
53#include <asm/smp.h> 53#include <asm/smp.h>
54#include <asm/arch_hooks.h> 54#include <asm/arch_hooks.h>
55#include <asm/kdebug.h> 55#include <linux/kdebug.h>
56#include <asm/stacktrace.h> 56#include <asm/stacktrace.h>
57 57
58#include <linux/module.h> 58#include <linux/module.h>
@@ -95,20 +95,6 @@ asmlinkage void machine_check(void);
95 95
96int kstack_depth_to_print = 24; 96int kstack_depth_to_print = 24;
97static unsigned int code_bytes = 64; 97static unsigned int code_bytes = 64;
98ATOMIC_NOTIFIER_HEAD(i386die_chain);
99
100int register_die_notifier(struct notifier_block *nb)
101{
102 vmalloc_sync_all();
103 return atomic_notifier_chain_register(&i386die_chain, nb);
104}
105EXPORT_SYMBOL(register_die_notifier); /* used modular by kdb */
106
107int unregister_die_notifier(struct notifier_block *nb)
108{
109 return atomic_notifier_chain_unregister(&i386die_chain, nb);
110}
111EXPORT_SYMBOL(unregister_die_notifier); /* used modular by kdb */
112 98
113static inline int valid_stack_ptr(struct thread_info *tinfo, void *p) 99static inline int valid_stack_ptr(struct thread_info *tinfo, void *p)
114{ 100{
diff --git a/arch/i386/mm/fault.c b/arch/i386/mm/fault.c
index f534c29e80b2..ca0aa0cedc35 100644
--- a/arch/i386/mm/fault.c
+++ b/arch/i386/mm/fault.c
@@ -21,13 +21,14 @@
21#include <linux/vt_kern.h> /* For unblank_screen() */ 21#include <linux/vt_kern.h> /* For unblank_screen() */
22#include <linux/highmem.h> 22#include <linux/highmem.h>
23#include <linux/bootmem.h> /* for max_low_pfn */ 23#include <linux/bootmem.h> /* for max_low_pfn */
24#include <linux/vmalloc.h>
24#include <linux/module.h> 25#include <linux/module.h>
25#include <linux/kprobes.h> 26#include <linux/kprobes.h>
26#include <linux/uaccess.h> 27#include <linux/uaccess.h>
28#include <linux/kdebug.h>
27 29
28#include <asm/system.h> 30#include <asm/system.h>
29#include <asm/desc.h> 31#include <asm/desc.h>
30#include <asm/kdebug.h>
31#include <asm/segment.h> 32#include <asm/segment.h>
32 33
33extern void die(const char *,struct pt_regs *,long); 34extern void die(const char *,struct pt_regs *,long);
diff --git a/arch/i386/oprofile/nmi_int.c b/arch/i386/oprofile/nmi_int.c
index 695f737516ae..8e185208dfd4 100644
--- a/arch/i386/oprofile/nmi_int.c
+++ b/arch/i386/oprofile/nmi_int.c
@@ -14,10 +14,10 @@
14#include <linux/sysdev.h> 14#include <linux/sysdev.h>
15#include <linux/slab.h> 15#include <linux/slab.h>
16#include <linux/moduleparam.h> 16#include <linux/moduleparam.h>
17#include <linux/kdebug.h>
17#include <asm/nmi.h> 18#include <asm/nmi.h>
18#include <asm/msr.h> 19#include <asm/msr.h>
19#include <asm/apic.h> 20#include <asm/apic.h>
20#include <asm/kdebug.h>
21 21
22#include "op_counter.h" 22#include "op_counter.h"
23#include "op_x86_model.h" 23#include "op_x86_model.h"
diff --git a/arch/i386/oprofile/nmi_timer_int.c b/arch/i386/oprofile/nmi_timer_int.c
index abf0ba52a635..1418e36ae7ab 100644
--- a/arch/i386/oprofile/nmi_timer_int.c
+++ b/arch/i386/oprofile/nmi_timer_int.c
@@ -12,12 +12,11 @@
12#include <linux/errno.h> 12#include <linux/errno.h>
13#include <linux/oprofile.h> 13#include <linux/oprofile.h>
14#include <linux/rcupdate.h> 14#include <linux/rcupdate.h>
15 15#include <linux/kdebug.h>
16 16
17#include <asm/nmi.h> 17#include <asm/nmi.h>
18#include <asm/apic.h> 18#include <asm/apic.h>
19#include <asm/ptrace.h> 19#include <asm/ptrace.h>
20#include <asm/kdebug.h>
21 20
22static int profile_timer_exceptions_notify(struct notifier_block *self, 21static int profile_timer_exceptions_notify(struct notifier_block *self,
23 unsigned long val, void *data) 22 unsigned long val, void *data)
diff --git a/arch/ia64/kernel/crash.c b/arch/ia64/kernel/crash.c
index 80a94e707827..3d51a3f77017 100644
--- a/arch/ia64/kernel/crash.c
+++ b/arch/ia64/kernel/crash.c
@@ -16,8 +16,8 @@
16#include <linux/elfcore.h> 16#include <linux/elfcore.h>
17#include <linux/sysctl.h> 17#include <linux/sysctl.h>
18#include <linux/init.h> 18#include <linux/init.h>
19#include <linux/kdebug.h>
19 20
20#include <asm/kdebug.h>
21#include <asm/mca.h> 21#include <asm/mca.h>
22 22
23int kdump_status[NR_CPUS]; 23int kdump_status[NR_CPUS];
diff --git a/arch/ia64/kernel/kprobes.c b/arch/ia64/kernel/kprobes.c
index 6cb56dd4056d..779fe00c9025 100644
--- a/arch/ia64/kernel/kprobes.c
+++ b/arch/ia64/kernel/kprobes.c
@@ -29,9 +29,9 @@
29#include <linux/slab.h> 29#include <linux/slab.h>
30#include <linux/preempt.h> 30#include <linux/preempt.h>
31#include <linux/moduleloader.h> 31#include <linux/moduleloader.h>
32#include <linux/kdebug.h>
32 33
33#include <asm/pgtable.h> 34#include <asm/pgtable.h>
34#include <asm/kdebug.h>
35#include <asm/sections.h> 35#include <asm/sections.h>
36#include <asm/uaccess.h> 36#include <asm/uaccess.h>
37 37
diff --git a/arch/ia64/kernel/mca.c b/arch/ia64/kernel/mca.c
index 491687f84fb5..65e3b81a442e 100644
--- a/arch/ia64/kernel/mca.c
+++ b/arch/ia64/kernel/mca.c
@@ -72,9 +72,9 @@
72#include <linux/smp.h> 72#include <linux/smp.h>
73#include <linux/workqueue.h> 73#include <linux/workqueue.h>
74#include <linux/cpumask.h> 74#include <linux/cpumask.h>
75#include <linux/kdebug.h>
75 76
76#include <asm/delay.h> 77#include <asm/delay.h>
77#include <asm/kdebug.h>
78#include <asm/machvec.h> 78#include <asm/machvec.h>
79#include <asm/meminit.h> 79#include <asm/meminit.h>
80#include <asm/page.h> 80#include <asm/page.h>
diff --git a/arch/ia64/kernel/process.c b/arch/ia64/kernel/process.c
index ae96d4176995..7ab36c772e21 100644
--- a/arch/ia64/kernel/process.c
+++ b/arch/ia64/kernel/process.c
@@ -27,13 +27,13 @@
27#include <linux/efi.h> 27#include <linux/efi.h>
28#include <linux/interrupt.h> 28#include <linux/interrupt.h>
29#include <linux/delay.h> 29#include <linux/delay.h>
30#include <linux/kdebug.h>
30 31
31#include <asm/cpu.h> 32#include <asm/cpu.h>
32#include <asm/delay.h> 33#include <asm/delay.h>
33#include <asm/elf.h> 34#include <asm/elf.h>
34#include <asm/ia32.h> 35#include <asm/ia32.h>
35#include <asm/irq.h> 36#include <asm/irq.h>
36#include <asm/kdebug.h>
37#include <asm/kexec.h> 37#include <asm/kexec.h>
38#include <asm/pgalloc.h> 38#include <asm/pgalloc.h>
39#include <asm/processor.h> 39#include <asm/processor.h>
diff --git a/arch/ia64/kernel/traps.c b/arch/ia64/kernel/traps.c
index 765cbe5ba6ae..5bfb8be02b70 100644
--- a/arch/ia64/kernel/traps.c
+++ b/arch/ia64/kernel/traps.c
@@ -16,33 +16,17 @@
16#include <linux/hardirq.h> 16#include <linux/hardirq.h>
17#include <linux/kprobes.h> 17#include <linux/kprobes.h>
18#include <linux/delay.h> /* for ssleep() */ 18#include <linux/delay.h> /* for ssleep() */
19#include <linux/kdebug.h>
19 20
20#include <asm/fpswa.h> 21#include <asm/fpswa.h>
21#include <asm/ia32.h> 22#include <asm/ia32.h>
22#include <asm/intrinsics.h> 23#include <asm/intrinsics.h>
23#include <asm/processor.h> 24#include <asm/processor.h>
24#include <asm/uaccess.h> 25#include <asm/uaccess.h>
25#include <asm/kdebug.h>
26 26
27fpswa_interface_t *fpswa_interface; 27fpswa_interface_t *fpswa_interface;
28EXPORT_SYMBOL(fpswa_interface); 28EXPORT_SYMBOL(fpswa_interface);
29 29
30ATOMIC_NOTIFIER_HEAD(ia64die_chain);
31
32int
33register_die_notifier(struct notifier_block *nb)
34{
35 return atomic_notifier_chain_register(&ia64die_chain, nb);
36}
37EXPORT_SYMBOL_GPL(register_die_notifier);
38
39int
40unregister_die_notifier(struct notifier_block *nb)
41{
42 return atomic_notifier_chain_unregister(&ia64die_chain, nb);
43}
44EXPORT_SYMBOL_GPL(unregister_die_notifier);
45
46void __init 30void __init
47trap_init (void) 31trap_init (void)
48{ 32{
diff --git a/arch/ia64/mm/fault.c b/arch/ia64/mm/fault.c
index 59f3ab937615..cb4791d17cce 100644
--- a/arch/ia64/mm/fault.c
+++ b/arch/ia64/mm/fault.c
@@ -10,12 +10,12 @@
10#include <linux/smp_lock.h> 10#include <linux/smp_lock.h>
11#include <linux/interrupt.h> 11#include <linux/interrupt.h>
12#include <linux/kprobes.h> 12#include <linux/kprobes.h>
13#include <linux/kdebug.h>
13 14
14#include <asm/pgtable.h> 15#include <asm/pgtable.h>
15#include <asm/processor.h> 16#include <asm/processor.h>
16#include <asm/system.h> 17#include <asm/system.h>
17#include <asm/uaccess.h> 18#include <asm/uaccess.h>
18#include <asm/kdebug.h>
19 19
20extern void die (char *, struct pt_regs *, long); 20extern void die (char *, struct pt_regs *, long);
21 21
diff --git a/arch/ia64/sn/kernel/xpc_main.c b/arch/ia64/sn/kernel/xpc_main.c
index 68355ef6f841..e336e1692a73 100644
--- a/arch/ia64/sn/kernel/xpc_main.c
+++ b/arch/ia64/sn/kernel/xpc_main.c
@@ -55,9 +55,9 @@
55#include <linux/delay.h> 55#include <linux/delay.h>
56#include <linux/reboot.h> 56#include <linux/reboot.h>
57#include <linux/completion.h> 57#include <linux/completion.h>
58#include <linux/kdebug.h>
58#include <asm/sn/intr.h> 59#include <asm/sn/intr.h>
59#include <asm/sn/sn_sal.h> 60#include <asm/sn/sn_sal.h>
60#include <asm/kdebug.h>
61#include <asm/uaccess.h> 61#include <asm/uaccess.h>
62#include <asm/sn/xpc.h> 62#include <asm/sn/xpc.h>
63 63
@@ -1332,7 +1332,7 @@ xpc_init(void)
1332 dev_warn(xpc_part, "can't register reboot notifier\n"); 1332 dev_warn(xpc_part, "can't register reboot notifier\n");
1333 } 1333 }
1334 1334
1335 /* add ourselves to the die_notifier list (i.e., ia64die_chain) */ 1335 /* add ourselves to the die_notifier list */
1336 ret = register_die_notifier(&xpc_die_notifier); 1336 ret = register_die_notifier(&xpc_die_notifier);
1337 if (ret != 0) { 1337 if (ret != 0) {
1338 dev_warn(xpc_part, "can't register die notifier\n"); 1338 dev_warn(xpc_part, "can't register die notifier\n");
diff --git a/arch/powerpc/kernel/kprobes.c b/arch/powerpc/kernel/kprobes.c
index ef647e7a9dc3..2a2c696dcc7a 100644
--- a/arch/powerpc/kernel/kprobes.c
+++ b/arch/powerpc/kernel/kprobes.c
@@ -30,8 +30,8 @@
30#include <linux/ptrace.h> 30#include <linux/ptrace.h>
31#include <linux/preempt.h> 31#include <linux/preempt.h>
32#include <linux/module.h> 32#include <linux/module.h>
33#include <linux/kdebug.h>
33#include <asm/cacheflush.h> 34#include <asm/cacheflush.h>
34#include <asm/kdebug.h>
35#include <asm/sstep.h> 35#include <asm/sstep.h>
36#include <asm/uaccess.h> 36#include <asm/uaccess.h>
37 37
diff --git a/arch/powerpc/kernel/traps.c b/arch/powerpc/kernel/traps.c
index f7862224fe85..bf6445ac9f1c 100644
--- a/arch/powerpc/kernel/traps.c
+++ b/arch/powerpc/kernel/traps.c
@@ -33,8 +33,8 @@
33#include <linux/kexec.h> 33#include <linux/kexec.h>
34#include <linux/backlight.h> 34#include <linux/backlight.h>
35#include <linux/bug.h> 35#include <linux/bug.h>
36#include <linux/kdebug.h>
36 37
37#include <asm/kdebug.h>
38#include <asm/pgtable.h> 38#include <asm/pgtable.h>
39#include <asm/uaccess.h> 39#include <asm/uaccess.h>
40#include <asm/system.h> 40#include <asm/system.h>
@@ -72,20 +72,6 @@ EXPORT_SYMBOL(__debugger_dabr_match);
72EXPORT_SYMBOL(__debugger_fault_handler); 72EXPORT_SYMBOL(__debugger_fault_handler);
73#endif 73#endif
74 74
75ATOMIC_NOTIFIER_HEAD(powerpc_die_chain);
76
77int register_die_notifier(struct notifier_block *nb)
78{
79 return atomic_notifier_chain_register(&powerpc_die_chain, nb);
80}
81EXPORT_SYMBOL(register_die_notifier);
82
83int unregister_die_notifier(struct notifier_block *nb)
84{
85 return atomic_notifier_chain_unregister(&powerpc_die_chain, nb);
86}
87EXPORT_SYMBOL(unregister_die_notifier);
88
89/* 75/*
90 * Trap & Exception support 76 * Trap & Exception support
91 */ 77 */
diff --git a/arch/powerpc/mm/fault.c b/arch/powerpc/mm/fault.c
index 03aeb3a46077..bec0cce79a78 100644
--- a/arch/powerpc/mm/fault.c
+++ b/arch/powerpc/mm/fault.c
@@ -28,6 +28,7 @@
28#include <linux/highmem.h> 28#include <linux/highmem.h>
29#include <linux/module.h> 29#include <linux/module.h>
30#include <linux/kprobes.h> 30#include <linux/kprobes.h>
31#include <linux/kdebug.h>
31 32
32#include <asm/page.h> 33#include <asm/page.h>
33#include <asm/pgtable.h> 34#include <asm/pgtable.h>
@@ -36,7 +37,6 @@
36#include <asm/system.h> 37#include <asm/system.h>
37#include <asm/uaccess.h> 38#include <asm/uaccess.h>
38#include <asm/tlbflush.h> 39#include <asm/tlbflush.h>
39#include <asm/kdebug.h>
40#include <asm/siginfo.h> 40#include <asm/siginfo.h>
41 41
42#ifdef CONFIG_KPROBES 42#ifdef CONFIG_KPROBES
diff --git a/arch/s390/kernel/kprobes.c b/arch/s390/kernel/kprobes.c
index 23c61f6d965b..8516a94d8163 100644
--- a/arch/s390/kernel/kprobes.c
+++ b/arch/s390/kernel/kprobes.c
@@ -24,8 +24,8 @@
24#include <linux/ptrace.h> 24#include <linux/ptrace.h>
25#include <linux/preempt.h> 25#include <linux/preempt.h>
26#include <linux/stop_machine.h> 26#include <linux/stop_machine.h>
27#include <linux/kdebug.h>
27#include <asm/cacheflush.h> 28#include <asm/cacheflush.h>
28#include <asm/kdebug.h>
29#include <asm/sections.h> 29#include <asm/sections.h>
30#include <asm/uaccess.h> 30#include <asm/uaccess.h>
31#include <linux/module.h> 31#include <linux/module.h>
diff --git a/arch/s390/kernel/traps.c b/arch/s390/kernel/traps.c
index 49dec830373a..a750bcc69aaa 100644
--- a/arch/s390/kernel/traps.c
+++ b/arch/s390/kernel/traps.c
@@ -27,6 +27,7 @@
27#include <linux/interrupt.h> 27#include <linux/interrupt.h>
28#include <linux/delay.h> 28#include <linux/delay.h>
29#include <linux/module.h> 29#include <linux/module.h>
30#include <linux/kdebug.h>
30#include <linux/kallsyms.h> 31#include <linux/kallsyms.h>
31#include <linux/reboot.h> 32#include <linux/reboot.h>
32#include <linux/kprobes.h> 33#include <linux/kprobes.h>
@@ -40,7 +41,6 @@
40#include <asm/s390_ext.h> 41#include <asm/s390_ext.h>
41#include <asm/lowcore.h> 42#include <asm/lowcore.h>
42#include <asm/debug.h> 43#include <asm/debug.h>
43#include <asm/kdebug.h>
44 44
45/* Called from entry.S only */ 45/* Called from entry.S only */
46extern void handle_per_exception(struct pt_regs *regs); 46extern void handle_per_exception(struct pt_regs *regs);
@@ -70,20 +70,6 @@ static int kstack_depth_to_print = 12;
70static int kstack_depth_to_print = 20; 70static int kstack_depth_to_print = 20;
71#endif /* CONFIG_64BIT */ 71#endif /* CONFIG_64BIT */
72 72
73ATOMIC_NOTIFIER_HEAD(s390die_chain);
74
75int register_die_notifier(struct notifier_block *nb)
76{
77 return atomic_notifier_chain_register(&s390die_chain, nb);
78}
79EXPORT_SYMBOL(register_die_notifier);
80
81int unregister_die_notifier(struct notifier_block *nb)
82{
83 return atomic_notifier_chain_unregister(&s390die_chain, nb);
84}
85EXPORT_SYMBOL(unregister_die_notifier);
86
87/* 73/*
88 * For show_trace we have tree different stack to consider: 74 * For show_trace we have tree different stack to consider:
89 * - the panic stack which is used if the kernel stack has overflown 75 * - the panic stack which is used if the kernel stack has overflown
diff --git a/arch/s390/mm/fault.c b/arch/s390/mm/fault.c
index 91f705adc3f9..8b924b359774 100644
--- a/arch/s390/mm/fault.c
+++ b/arch/s390/mm/fault.c
@@ -20,6 +20,7 @@
20#include <linux/mman.h> 20#include <linux/mman.h>
21#include <linux/mm.h> 21#include <linux/mm.h>
22#include <linux/smp.h> 22#include <linux/smp.h>
23#include <linux/kdebug.h>
23#include <linux/smp_lock.h> 24#include <linux/smp_lock.h>
24#include <linux/init.h> 25#include <linux/init.h>
25#include <linux/console.h> 26#include <linux/console.h>
@@ -30,7 +31,6 @@
30 31
31#include <asm/system.h> 32#include <asm/system.h>
32#include <asm/pgtable.h> 33#include <asm/pgtable.h>
33#include <asm/kdebug.h>
34#include <asm/s390_ext.h> 34#include <asm/s390_ext.h>
35 35
36#ifndef CONFIG_64BIT 36#ifndef CONFIG_64BIT
diff --git a/arch/sparc/kernel/head.S b/arch/sparc/kernel/head.S
index 9a219e8b5ddb..97da13c52563 100644
--- a/arch/sparc/kernel/head.S
+++ b/arch/sparc/kernel/head.S
@@ -19,7 +19,7 @@
19#include <asm/ptrace.h> 19#include <asm/ptrace.h>
20#include <asm/psr.h> 20#include <asm/psr.h>
21#include <asm/page.h> 21#include <asm/page.h>
22#include <asm/kdebug.h> 22#include <linux/kdebug.h>
23#include <asm/winmacro.h> 23#include <asm/winmacro.h>
24#include <asm/thread_info.h> /* TI_UWINMASK */ 24#include <asm/thread_info.h> /* TI_UWINMASK */
25#include <asm/errno.h> 25#include <asm/errno.h>
diff --git a/arch/sparc/kernel/setup.c b/arch/sparc/kernel/setup.c
index eccd8e87f529..64c0ed98820a 100644
--- a/arch/sparc/kernel/setup.c
+++ b/arch/sparc/kernel/setup.c
@@ -31,6 +31,7 @@
31#include <linux/spinlock.h> 31#include <linux/spinlock.h>
32#include <linux/root_dev.h> 32#include <linux/root_dev.h>
33#include <linux/cpu.h> 33#include <linux/cpu.h>
34#include <linux/kdebug.h>
34 35
35#include <asm/system.h> 36#include <asm/system.h>
36#include <asm/io.h> 37#include <asm/io.h>
@@ -40,7 +41,6 @@
40#include <asm/pgtable.h> 41#include <asm/pgtable.h>
41#include <asm/traps.h> 42#include <asm/traps.h>
42#include <asm/vaddrs.h> 43#include <asm/vaddrs.h>
43#include <asm/kdebug.h>
44#include <asm/mbus.h> 44#include <asm/mbus.h>
45#include <asm/idprom.h> 45#include <asm/idprom.h>
46#include <asm/machines.h> 46#include <asm/machines.h>
diff --git a/arch/sparc/kernel/traps.c b/arch/sparc/kernel/traps.c
index 527687afc1c4..dc9ffea2a4f7 100644
--- a/arch/sparc/kernel/traps.c
+++ b/arch/sparc/kernel/traps.c
@@ -15,6 +15,7 @@
15#include <linux/signal.h> 15#include <linux/signal.h>
16#include <linux/smp.h> 16#include <linux/smp.h>
17#include <linux/smp_lock.h> 17#include <linux/smp_lock.h>
18#include <linux/kdebug.h>
18 19
19#include <asm/delay.h> 20#include <asm/delay.h>
20#include <asm/system.h> 21#include <asm/system.h>
@@ -22,7 +23,6 @@
22#include <asm/oplib.h> 23#include <asm/oplib.h>
23#include <asm/page.h> 24#include <asm/page.h>
24#include <asm/pgtable.h> 25#include <asm/pgtable.h>
25#include <asm/kdebug.h>
26#include <asm/unistd.h> 26#include <asm/unistd.h>
27#include <asm/traps.h> 27#include <asm/traps.h>
28 28
diff --git a/arch/sparc/mm/fault.c b/arch/sparc/mm/fault.c
index 9eeed3347df3..c133f270cf70 100644
--- a/arch/sparc/mm/fault.c
+++ b/arch/sparc/mm/fault.c
@@ -21,6 +21,7 @@
21#include <linux/smp_lock.h> 21#include <linux/smp_lock.h>
22#include <linux/interrupt.h> 22#include <linux/interrupt.h>
23#include <linux/module.h> 23#include <linux/module.h>
24#include <linux/kdebug.h>
24 25
25#include <asm/system.h> 26#include <asm/system.h>
26#include <asm/page.h> 27#include <asm/page.h>
@@ -30,7 +31,6 @@
30#include <asm/oplib.h> 31#include <asm/oplib.h>
31#include <asm/smp.h> 32#include <asm/smp.h>
32#include <asm/traps.h> 33#include <asm/traps.h>
33#include <asm/kdebug.h>
34#include <asm/uaccess.h> 34#include <asm/uaccess.h>
35 35
36extern int prom_node_root; 36extern int prom_node_root;
diff --git a/arch/sparc/mm/srmmu.c b/arch/sparc/mm/srmmu.c
index 0df7121cef07..e5eaa8072ae0 100644
--- a/arch/sparc/mm/srmmu.c
+++ b/arch/sparc/mm/srmmu.c
@@ -18,13 +18,13 @@
18#include <linux/bootmem.h> 18#include <linux/bootmem.h>
19#include <linux/fs.h> 19#include <linux/fs.h>
20#include <linux/seq_file.h> 20#include <linux/seq_file.h>
21#include <linux/kdebug.h>
21 22
22#include <asm/bitext.h> 23#include <asm/bitext.h>
23#include <asm/page.h> 24#include <asm/page.h>
24#include <asm/pgalloc.h> 25#include <asm/pgalloc.h>
25#include <asm/pgtable.h> 26#include <asm/pgtable.h>
26#include <asm/io.h> 27#include <asm/io.h>
27#include <asm/kdebug.h>
28#include <asm/vaddrs.h> 28#include <asm/vaddrs.h>
29#include <asm/traps.h> 29#include <asm/traps.h>
30#include <asm/smp.h> 30#include <asm/smp.h>
diff --git a/arch/sparc64/kernel/kprobes.c b/arch/sparc64/kernel/kprobes.c
index ae221f0d4a6f..a44fe47a3c2b 100644
--- a/arch/sparc64/kernel/kprobes.c
+++ b/arch/sparc64/kernel/kprobes.c
@@ -6,7 +6,7 @@
6#include <linux/kernel.h> 6#include <linux/kernel.h>
7#include <linux/kprobes.h> 7#include <linux/kprobes.h>
8#include <linux/module.h> 8#include <linux/module.h>
9#include <asm/kdebug.h> 9#include <linux/kdebug.h>
10#include <asm/signal.h> 10#include <asm/signal.h>
11#include <asm/cacheflush.h> 11#include <asm/cacheflush.h>
12#include <asm/uaccess.h> 12#include <asm/uaccess.h>
diff --git a/arch/sparc64/kernel/traps.c b/arch/sparc64/kernel/traps.c
index ad67784292db..64057fdfc7a8 100644
--- a/arch/sparc64/kernel/traps.c
+++ b/arch/sparc64/kernel/traps.c
@@ -18,6 +18,7 @@
18#include <linux/smp_lock.h> 18#include <linux/smp_lock.h>
19#include <linux/mm.h> 19#include <linux/mm.h>
20#include <linux/init.h> 20#include <linux/init.h>
21#include <linux/kdebug.h>
21 22
22#include <asm/delay.h> 23#include <asm/delay.h>
23#include <asm/system.h> 24#include <asm/system.h>
@@ -36,26 +37,12 @@
36#include <asm/psrcompat.h> 37#include <asm/psrcompat.h>
37#include <asm/processor.h> 38#include <asm/processor.h>
38#include <asm/timer.h> 39#include <asm/timer.h>
39#include <asm/kdebug.h>
40#include <asm/head.h> 40#include <asm/head.h>
41#ifdef CONFIG_KMOD 41#ifdef CONFIG_KMOD
42#include <linux/kmod.h> 42#include <linux/kmod.h>
43#endif 43#endif
44#include <asm/prom.h> 44#include <asm/prom.h>
45 45
46ATOMIC_NOTIFIER_HEAD(sparc64die_chain);
47
48int register_die_notifier(struct notifier_block *nb)
49{
50 return atomic_notifier_chain_register(&sparc64die_chain, nb);
51}
52EXPORT_SYMBOL(register_die_notifier);
53
54int unregister_die_notifier(struct notifier_block *nb)
55{
56 return atomic_notifier_chain_unregister(&sparc64die_chain, nb);
57}
58EXPORT_SYMBOL(unregister_die_notifier);
59 46
60/* When an irrecoverable trap occurs at tl > 0, the trap entry 47/* When an irrecoverable trap occurs at tl > 0, the trap entry
61 * code logs the trap state registers at every level in the trap 48 * code logs the trap state registers at every level in the trap
diff --git a/arch/sparc64/mm/fault.c b/arch/sparc64/mm/fault.c
index 55ae802dc0ad..7c36527b7454 100644
--- a/arch/sparc64/mm/fault.c
+++ b/arch/sparc64/mm/fault.c
@@ -20,6 +20,7 @@
20#include <linux/interrupt.h> 20#include <linux/interrupt.h>
21#include <linux/kprobes.h> 21#include <linux/kprobes.h>
22#include <linux/kallsyms.h> 22#include <linux/kallsyms.h>
23#include <linux/kdebug.h>
23 24
24#include <asm/page.h> 25#include <asm/page.h>
25#include <asm/pgtable.h> 26#include <asm/pgtable.h>
@@ -29,7 +30,6 @@
29#include <asm/asi.h> 30#include <asm/asi.h>
30#include <asm/lsu.h> 31#include <asm/lsu.h>
31#include <asm/sections.h> 32#include <asm/sections.h>
32#include <asm/kdebug.h>
33#include <asm/mmu_context.h> 33#include <asm/mmu_context.h>
34 34
35#ifdef CONFIG_KPROBES 35#ifdef CONFIG_KPROBES
diff --git a/arch/x86_64/kernel/crash.c b/arch/x86_64/kernel/crash.c
index 95a7a2c13131..13432a1ae904 100644
--- a/arch/x86_64/kernel/crash.c
+++ b/arch/x86_64/kernel/crash.c
@@ -17,13 +17,13 @@
17#include <linux/delay.h> 17#include <linux/delay.h>
18#include <linux/elf.h> 18#include <linux/elf.h>
19#include <linux/elfcore.h> 19#include <linux/elfcore.h>
20#include <linux/kdebug.h>
20 21
21#include <asm/processor.h> 22#include <asm/processor.h>
22#include <asm/hardirq.h> 23#include <asm/hardirq.h>
23#include <asm/nmi.h> 24#include <asm/nmi.h>
24#include <asm/hw_irq.h> 25#include <asm/hw_irq.h>
25#include <asm/mach_apic.h> 26#include <asm/mach_apic.h>
26#include <asm/kdebug.h>
27 27
28/* This keeps a track of which one is crashing cpu. */ 28/* This keeps a track of which one is crashing cpu. */
29static int crashing_cpu; 29static int crashing_cpu;
diff --git a/arch/x86_64/kernel/kprobes.c b/arch/x86_64/kernel/kprobes.c
index 209c8c0bec71..90e7008cd899 100644
--- a/arch/x86_64/kernel/kprobes.c
+++ b/arch/x86_64/kernel/kprobes.c
@@ -37,10 +37,10 @@
37#include <linux/slab.h> 37#include <linux/slab.h>
38#include <linux/preempt.h> 38#include <linux/preempt.h>
39#include <linux/module.h> 39#include <linux/module.h>
40#include <linux/kdebug.h>
40 41
41#include <asm/cacheflush.h> 42#include <asm/cacheflush.h>
42#include <asm/pgtable.h> 43#include <asm/pgtable.h>
43#include <asm/kdebug.h>
44#include <asm/uaccess.h> 44#include <asm/uaccess.h>
45 45
46void jprobe_return_end(void); 46void jprobe_return_end(void);
diff --git a/arch/x86_64/kernel/mce.c b/arch/x86_64/kernel/mce.c
index fa2672682477..442169640e45 100644
--- a/arch/x86_64/kernel/mce.c
+++ b/arch/x86_64/kernel/mce.c
@@ -20,10 +20,10 @@
20#include <linux/percpu.h> 20#include <linux/percpu.h>
21#include <linux/ctype.h> 21#include <linux/ctype.h>
22#include <linux/kmod.h> 22#include <linux/kmod.h>
23#include <linux/kdebug.h>
23#include <asm/processor.h> 24#include <asm/processor.h>
24#include <asm/msr.h> 25#include <asm/msr.h>
25#include <asm/mce.h> 26#include <asm/mce.h>
26#include <asm/kdebug.h>
27#include <asm/uaccess.h> 27#include <asm/uaccess.h>
28#include <asm/smp.h> 28#include <asm/smp.h>
29 29
diff --git a/arch/x86_64/kernel/nmi.c b/arch/x86_64/kernel/nmi.c
index 6cd2b30e2ffc..931c64bad5e6 100644
--- a/arch/x86_64/kernel/nmi.c
+++ b/arch/x86_64/kernel/nmi.c
@@ -21,11 +21,11 @@
21#include <linux/sysctl.h> 21#include <linux/sysctl.h>
22#include <linux/kprobes.h> 22#include <linux/kprobes.h>
23#include <linux/cpumask.h> 23#include <linux/cpumask.h>
24#include <linux/kdebug.h>
24 25
25#include <asm/smp.h> 26#include <asm/smp.h>
26#include <asm/nmi.h> 27#include <asm/nmi.h>
27#include <asm/proto.h> 28#include <asm/proto.h>
28#include <asm/kdebug.h>
29#include <asm/mce.h> 29#include <asm/mce.h>
30 30
31int unknown_nmi_panic; 31int unknown_nmi_panic;
diff --git a/arch/x86_64/kernel/pci-gart.c b/arch/x86_64/kernel/pci-gart.c
index 0a762e10f2be..373ef66ca1dc 100644
--- a/arch/x86_64/kernel/pci-gart.c
+++ b/arch/x86_64/kernel/pci-gart.c
@@ -22,13 +22,13 @@
22#include <linux/topology.h> 22#include <linux/topology.h>
23#include <linux/interrupt.h> 23#include <linux/interrupt.h>
24#include <linux/bitops.h> 24#include <linux/bitops.h>
25#include <linux/kdebug.h>
25#include <asm/atomic.h> 26#include <asm/atomic.h>
26#include <asm/io.h> 27#include <asm/io.h>
27#include <asm/mtrr.h> 28#include <asm/mtrr.h>
28#include <asm/pgtable.h> 29#include <asm/pgtable.h>
29#include <asm/proto.h> 30#include <asm/proto.h>
30#include <asm/cacheflush.h> 31#include <asm/cacheflush.h>
31#include <asm/kdebug.h>
32#include <asm/swiotlb.h> 32#include <asm/swiotlb.h>
33#include <asm/dma.h> 33#include <asm/dma.h>
34#include <asm/k8.h> 34#include <asm/k8.h>
diff --git a/arch/x86_64/kernel/process.c b/arch/x86_64/kernel/process.c
index 4f21765078b7..5909039f37aa 100644
--- a/arch/x86_64/kernel/process.c
+++ b/arch/x86_64/kernel/process.c
@@ -36,6 +36,7 @@
36#include <linux/random.h> 36#include <linux/random.h>
37#include <linux/notifier.h> 37#include <linux/notifier.h>
38#include <linux/kprobes.h> 38#include <linux/kprobes.h>
39#include <linux/kdebug.h>
39 40
40#include <asm/uaccess.h> 41#include <asm/uaccess.h>
41#include <asm/pgtable.h> 42#include <asm/pgtable.h>
@@ -46,7 +47,6 @@
46#include <asm/mmu_context.h> 47#include <asm/mmu_context.h>
47#include <asm/pda.h> 48#include <asm/pda.h>
48#include <asm/prctl.h> 49#include <asm/prctl.h>
49#include <asm/kdebug.h>
50#include <asm/desc.h> 50#include <asm/desc.h>
51#include <asm/proto.h> 51#include <asm/proto.h>
52#include <asm/ia32.h> 52#include <asm/ia32.h>
diff --git a/arch/x86_64/kernel/reboot.c b/arch/x86_64/kernel/reboot.c
index 2d6769847456..c116b54d422e 100644
--- a/arch/x86_64/kernel/reboot.c
+++ b/arch/x86_64/kernel/reboot.c
@@ -7,8 +7,8 @@
7#include <linux/ctype.h> 7#include <linux/ctype.h>
8#include <linux/string.h> 8#include <linux/string.h>
9#include <linux/pm.h> 9#include <linux/pm.h>
10#include <linux/kdebug.h>
10#include <asm/io.h> 11#include <asm/io.h>
11#include <asm/kdebug.h>
12#include <asm/delay.h> 12#include <asm/delay.h>
13#include <asm/hw_irq.h> 13#include <asm/hw_irq.h>
14#include <asm/system.h> 14#include <asm/system.h>
diff --git a/arch/x86_64/kernel/smpboot.c b/arch/x86_64/kernel/smpboot.c
index 4d9dacfae575..193af9922c26 100644
--- a/arch/x86_64/kernel/smpboot.c
+++ b/arch/x86_64/kernel/smpboot.c
@@ -49,11 +49,11 @@
49#include <linux/delay.h> 49#include <linux/delay.h>
50#include <linux/mc146818rtc.h> 50#include <linux/mc146818rtc.h>
51#include <linux/smp.h> 51#include <linux/smp.h>
52#include <linux/kdebug.h>
52 53
53#include <asm/mtrr.h> 54#include <asm/mtrr.h>
54#include <asm/pgalloc.h> 55#include <asm/pgalloc.h>
55#include <asm/desc.h> 56#include <asm/desc.h>
56#include <asm/kdebug.h>
57#include <asm/tlbflush.h> 57#include <asm/tlbflush.h>
58#include <asm/proto.h> 58#include <asm/proto.h>
59#include <asm/nmi.h> 59#include <asm/nmi.h>
diff --git a/arch/x86_64/kernel/traps.c b/arch/x86_64/kernel/traps.c
index 0484a2ceac87..8c2ac41187c1 100644
--- a/arch/x86_64/kernel/traps.c
+++ b/arch/x86_64/kernel/traps.c
@@ -32,6 +32,7 @@
32#include <linux/unwind.h> 32#include <linux/unwind.h>
33#include <linux/uaccess.h> 33#include <linux/uaccess.h>
34#include <linux/bug.h> 34#include <linux/bug.h>
35#include <linux/kdebug.h>
35 36
36#include <asm/system.h> 37#include <asm/system.h>
37#include <asm/io.h> 38#include <asm/io.h>
@@ -39,7 +40,6 @@
39#include <asm/debugreg.h> 40#include <asm/debugreg.h>
40#include <asm/desc.h> 41#include <asm/desc.h>
41#include <asm/i387.h> 42#include <asm/i387.h>
42#include <asm/kdebug.h>
43#include <asm/processor.h> 43#include <asm/processor.h>
44#include <asm/unwind.h> 44#include <asm/unwind.h>
45#include <asm/smp.h> 45#include <asm/smp.h>
@@ -71,22 +71,6 @@ asmlinkage void alignment_check(void);
71asmlinkage void machine_check(void); 71asmlinkage void machine_check(void);
72asmlinkage void spurious_interrupt_bug(void); 72asmlinkage void spurious_interrupt_bug(void);
73 73
74ATOMIC_NOTIFIER_HEAD(die_chain);
75EXPORT_SYMBOL(die_chain);
76
77int register_die_notifier(struct notifier_block *nb)
78{
79 vmalloc_sync_all();
80 return atomic_notifier_chain_register(&die_chain, nb);
81}
82EXPORT_SYMBOL(register_die_notifier); /* used modular by kdb */
83
84int unregister_die_notifier(struct notifier_block *nb)
85{
86 return atomic_notifier_chain_unregister(&die_chain, nb);
87}
88EXPORT_SYMBOL(unregister_die_notifier); /* used modular by kdb */
89
90static inline void conditional_sti(struct pt_regs *regs) 74static inline void conditional_sti(struct pt_regs *regs)
91{ 75{
92 if (regs->eflags & X86_EFLAGS_IF) 76 if (regs->eflags & X86_EFLAGS_IF)
diff --git a/arch/x86_64/mm/fault.c b/arch/x86_64/mm/fault.c
index de99dba2c515..fd6ecc2cee38 100644
--- a/arch/x86_64/mm/fault.c
+++ b/arch/x86_64/mm/fault.c
@@ -21,16 +21,17 @@
21#include <linux/tty.h> 21#include <linux/tty.h>
22#include <linux/vt_kern.h> /* For unblank_screen() */ 22#include <linux/vt_kern.h> /* For unblank_screen() */
23#include <linux/compiler.h> 23#include <linux/compiler.h>
24#include <linux/vmalloc.h>
24#include <linux/module.h> 25#include <linux/module.h>
25#include <linux/kprobes.h> 26#include <linux/kprobes.h>
26#include <linux/uaccess.h> 27#include <linux/uaccess.h>
28#include <linux/kdebug.h>
27 29
28#include <asm/system.h> 30#include <asm/system.h>
29#include <asm/pgalloc.h> 31#include <asm/pgalloc.h>
30#include <asm/smp.h> 32#include <asm/smp.h>
31#include <asm/tlbflush.h> 33#include <asm/tlbflush.h>
32#include <asm/proto.h> 34#include <asm/proto.h>
33#include <asm/kdebug.h>
34#include <asm-generic/sections.h> 35#include <asm-generic/sections.h>
35 36
36/* Page fault error code bits */ 37/* Page fault error code bits */
diff --git a/drivers/char/ipmi/ipmi_watchdog.c b/drivers/char/ipmi/ipmi_watchdog.c
index 9e9c5de2e549..b6a972ed5bb3 100644
--- a/drivers/char/ipmi/ipmi_watchdog.c
+++ b/drivers/char/ipmi/ipmi_watchdog.c
@@ -39,6 +39,7 @@
39#include <linux/miscdevice.h> 39#include <linux/miscdevice.h>
40#include <linux/init.h> 40#include <linux/init.h>
41#include <linux/completion.h> 41#include <linux/completion.h>
42#include <linux/kdebug.h>
42#include <linux/rwsem.h> 43#include <linux/rwsem.h>
43#include <linux/errno.h> 44#include <linux/errno.h>
44#include <asm/uaccess.h> 45#include <asm/uaccess.h>
diff --git a/include/asm-alpha/kdebug.h b/include/asm-alpha/kdebug.h
new file mode 100644
index 000000000000..6ece1b037665
--- /dev/null
+++ b/include/asm-alpha/kdebug.h
@@ -0,0 +1 @@
#include <asm-generic/kdebug.h>
diff --git a/include/asm-arm/kdebug.h b/include/asm-arm/kdebug.h
new file mode 100644
index 000000000000..6ece1b037665
--- /dev/null
+++ b/include/asm-arm/kdebug.h
@@ -0,0 +1 @@
#include <asm-generic/kdebug.h>
diff --git a/include/asm-arm/system.h b/include/asm-arm/system.h
index 63b3080bdac4..25f84da4a97e 100644
--- a/include/asm-arm/system.h
+++ b/include/asm-arm/system.h
@@ -93,7 +93,7 @@ void die(const char *msg, struct pt_regs *regs, int err)
93 __attribute__((noreturn)); 93 __attribute__((noreturn));
94 94
95struct siginfo; 95struct siginfo;
96void notify_die(const char *str, struct pt_regs *regs, struct siginfo *info, 96void arm_notify_die(const char *str, struct pt_regs *regs, struct siginfo *info,
97 unsigned long err, unsigned long trap); 97 unsigned long err, unsigned long trap);
98 98
99void hook_fault_code(int nr, int (*fn)(unsigned long, unsigned int, 99void hook_fault_code(int nr, int (*fn)(unsigned long, unsigned int,
diff --git a/include/asm-arm26/kdebug.h b/include/asm-arm26/kdebug.h
new file mode 100644
index 000000000000..6ece1b037665
--- /dev/null
+++ b/include/asm-arm26/kdebug.h
@@ -0,0 +1 @@
#include <asm-generic/kdebug.h>
diff --git a/include/asm-avr32/kdebug.h b/include/asm-avr32/kdebug.h
index f583b643ffb2..de419278fc39 100644
--- a/include/asm-avr32/kdebug.h
+++ b/include/asm-avr32/kdebug.h
@@ -3,19 +3,6 @@
3 3
4#include <linux/notifier.h> 4#include <linux/notifier.h>
5 5
6struct pt_regs;
7
8struct die_args {
9 struct pt_regs *regs;
10 int trapnr;
11};
12
13int register_die_notifier(struct notifier_block *nb);
14int unregister_die_notifier(struct notifier_block *nb);
15int register_page_fault_notifier(struct notifier_block *nb);
16int unregister_page_fault_notifier(struct notifier_block *nb);
17extern struct atomic_notifier_head avr32_die_chain;
18
19/* Grossly misnamed. */ 6/* Grossly misnamed. */
20enum die_val { 7enum die_val {
21 DIE_FAULT, 8 DIE_FAULT,
@@ -24,15 +11,7 @@ enum die_val {
24 DIE_PAGE_FAULT, 11 DIE_PAGE_FAULT,
25}; 12};
26 13
27static inline int notify_die(enum die_val val, struct pt_regs *regs, 14int register_page_fault_notifier(struct notifier_block *nb);
28 int trap, int sig) 15int unregister_page_fault_notifier(struct notifier_block *nb);
29{
30 struct die_args args = {
31 .regs = regs,
32 .trapnr = trap,
33 };
34
35 return atomic_notifier_call_chain(&avr32_die_chain, val, &args);
36}
37 16
38#endif /* __ASM_AVR32_KDEBUG_H */ 17#endif /* __ASM_AVR32_KDEBUG_H */
diff --git a/include/asm-cris/kdebug.h b/include/asm-cris/kdebug.h
new file mode 100644
index 000000000000..6ece1b037665
--- /dev/null
+++ b/include/asm-cris/kdebug.h
@@ -0,0 +1 @@
#include <asm-generic/kdebug.h>
diff --git a/include/asm-frv/kdebug.h b/include/asm-frv/kdebug.h
new file mode 100644
index 000000000000..6ece1b037665
--- /dev/null
+++ b/include/asm-frv/kdebug.h
@@ -0,0 +1 @@
#include <asm-generic/kdebug.h>
diff --git a/include/asm-generic/kdebug.h b/include/asm-generic/kdebug.h
new file mode 100644
index 000000000000..2b799c90b2d4
--- /dev/null
+++ b/include/asm-generic/kdebug.h
@@ -0,0 +1,8 @@
1#ifndef _ASM_GENERIC_KDEBUG_H
2#define _ASM_GENERIC_KDEBUG_H
3
4enum die_val {
5 DIE_UNUSED,
6};
7
8#endif /* _ASM_GENERIC_KDEBUG_H */
diff --git a/include/asm-h8300/kdebug.h b/include/asm-h8300/kdebug.h
new file mode 100644
index 000000000000..6ece1b037665
--- /dev/null
+++ b/include/asm-h8300/kdebug.h
@@ -0,0 +1 @@
#include <asm-generic/kdebug.h>
diff --git a/include/asm-i386/kdebug.h b/include/asm-i386/kdebug.h
index 6e1c8e1b5e2b..05c3117788b9 100644
--- a/include/asm-i386/kdebug.h
+++ b/include/asm-i386/kdebug.h
@@ -9,19 +9,8 @@
9 9
10struct pt_regs; 10struct pt_regs;
11 11
12struct die_args {
13 struct pt_regs *regs;
14 const char *str;
15 long err;
16 int trapnr;
17 int signr;
18};
19
20extern int register_die_notifier(struct notifier_block *);
21extern int unregister_die_notifier(struct notifier_block *);
22extern int register_page_fault_notifier(struct notifier_block *); 12extern int register_page_fault_notifier(struct notifier_block *);
23extern int unregister_page_fault_notifier(struct notifier_block *); 13extern int unregister_page_fault_notifier(struct notifier_block *);
24extern struct atomic_notifier_head i386die_chain;
25 14
26 15
27/* Grossly misnamed. */ 16/* Grossly misnamed. */
@@ -42,17 +31,4 @@ enum die_val {
42 DIE_PAGE_FAULT, 31 DIE_PAGE_FAULT,
43}; 32};
44 33
45static inline int notify_die(enum die_val val, const char *str,
46 struct pt_regs *regs, long err, int trap, int sig)
47{
48 struct die_args args = {
49 .regs = regs,
50 .str = str,
51 .err = err,
52 .trapnr = trap,
53 .signr = sig
54 };
55 return atomic_notifier_call_chain(&i386die_chain, val, &args);
56}
57
58#endif 34#endif
diff --git a/include/asm-i386/pgtable.h b/include/asm-i386/pgtable.h
index e16359f81a40..61fbf8578ff1 100644
--- a/include/asm-i386/pgtable.h
+++ b/include/asm-i386/pgtable.h
@@ -243,8 +243,6 @@ static inline pte_t pte_mkyoung(pte_t pte) { (pte).pte_low |= _PAGE_ACCESSED; re
243static inline pte_t pte_mkwrite(pte_t pte) { (pte).pte_low |= _PAGE_RW; return pte; } 243static inline pte_t pte_mkwrite(pte_t pte) { (pte).pte_low |= _PAGE_RW; return pte; }
244static inline pte_t pte_mkhuge(pte_t pte) { (pte).pte_low |= _PAGE_PSE; return pte; } 244static inline pte_t pte_mkhuge(pte_t pte) { (pte).pte_low |= _PAGE_PSE; return pte; }
245 245
246extern void vmalloc_sync_all(void);
247
248#ifdef CONFIG_X86_PAE 246#ifdef CONFIG_X86_PAE
249# include <asm/pgtable-3level.h> 247# include <asm/pgtable-3level.h>
250#else 248#else
diff --git a/include/asm-ia64/kdebug.h b/include/asm-ia64/kdebug.h
index aed7142f9e4a..ba211e011a1d 100644
--- a/include/asm-ia64/kdebug.h
+++ b/include/asm-ia64/kdebug.h
@@ -28,21 +28,8 @@
28 */ 28 */
29#include <linux/notifier.h> 29#include <linux/notifier.h>
30 30
31struct pt_regs;
32
33struct die_args {
34 struct pt_regs *regs;
35 const char *str;
36 long err;
37 int trapnr;
38 int signr;
39};
40
41extern int register_die_notifier(struct notifier_block *);
42extern int unregister_die_notifier(struct notifier_block *);
43extern int register_page_fault_notifier(struct notifier_block *); 31extern int register_page_fault_notifier(struct notifier_block *);
44extern int unregister_page_fault_notifier(struct notifier_block *); 32extern int unregister_page_fault_notifier(struct notifier_block *);
45extern struct atomic_notifier_head ia64die_chain;
46 33
47enum die_val { 34enum die_val {
48 DIE_BREAK = 1, 35 DIE_BREAK = 1,
@@ -74,18 +61,4 @@ enum die_val {
74 DIE_KDUMP_LEAVE, 61 DIE_KDUMP_LEAVE,
75}; 62};
76 63
77static inline int notify_die(enum die_val val, char *str, struct pt_regs *regs,
78 long err, int trap, int sig)
79{
80 struct die_args args = {
81 .regs = regs,
82 .str = str,
83 .err = err,
84 .trapnr = trap,
85 .signr = sig
86 };
87
88 return atomic_notifier_call_chain(&ia64die_chain, val, &args);
89}
90
91#endif 64#endif
diff --git a/include/asm-m32r/kdebug.h b/include/asm-m32r/kdebug.h
new file mode 100644
index 000000000000..6ece1b037665
--- /dev/null
+++ b/include/asm-m32r/kdebug.h
@@ -0,0 +1 @@
#include <asm-generic/kdebug.h>
diff --git a/include/asm-m68k/kdebug.h b/include/asm-m68k/kdebug.h
new file mode 100644
index 000000000000..6ece1b037665
--- /dev/null
+++ b/include/asm-m68k/kdebug.h
@@ -0,0 +1 @@
#include <asm-generic/kdebug.h>
diff --git a/include/asm-m68knommu/kdebug.h b/include/asm-m68knommu/kdebug.h
new file mode 100644
index 000000000000..6ece1b037665
--- /dev/null
+++ b/include/asm-m68knommu/kdebug.h
@@ -0,0 +1 @@
#include <asm-generic/kdebug.h>
diff --git a/include/asm-mips/kdebug.h b/include/asm-mips/kdebug.h
new file mode 100644
index 000000000000..6ece1b037665
--- /dev/null
+++ b/include/asm-mips/kdebug.h
@@ -0,0 +1 @@
#include <asm-generic/kdebug.h>
diff --git a/include/asm-parisc/kdebug.h b/include/asm-parisc/kdebug.h
new file mode 100644
index 000000000000..6ece1b037665
--- /dev/null
+++ b/include/asm-parisc/kdebug.h
@@ -0,0 +1 @@
#include <asm-generic/kdebug.h>
diff --git a/include/asm-powerpc/kdebug.h b/include/asm-powerpc/kdebug.h
index 532bfee934f4..1c73d2ec9b59 100644
--- a/include/asm-powerpc/kdebug.h
+++ b/include/asm-powerpc/kdebug.h
@@ -6,18 +6,6 @@
6 6
7#include <linux/notifier.h> 7#include <linux/notifier.h>
8 8
9struct pt_regs;
10
11struct die_args {
12 struct pt_regs *regs;
13 const char *str;
14 long err;
15 int trapnr;
16 int signr;
17};
18
19extern int register_die_notifier(struct notifier_block *);
20extern int unregister_die_notifier(struct notifier_block *);
21extern int register_page_fault_notifier(struct notifier_block *); 9extern int register_page_fault_notifier(struct notifier_block *);
22extern int unregister_page_fault_notifier(struct notifier_block *); 10extern int unregister_page_fault_notifier(struct notifier_block *);
23extern struct atomic_notifier_head powerpc_die_chain; 11extern struct atomic_notifier_head powerpc_die_chain;
@@ -32,11 +20,5 @@ enum die_val {
32 DIE_PAGE_FAULT, 20 DIE_PAGE_FAULT,
33}; 21};
34 22
35static inline int notify_die(enum die_val val,char *str,struct pt_regs *regs,long err,int trap, int sig)
36{
37 struct die_args args = { .regs=regs, .str=str, .err=err, .trapnr=trap,.signr=sig };
38 return atomic_notifier_call_chain(&powerpc_die_chain, val, &args);
39}
40
41#endif /* __KERNEL__ */ 23#endif /* __KERNEL__ */
42#endif /* _ASM_POWERPC_KDEBUG_H */ 24#endif /* _ASM_POWERPC_KDEBUG_H */
diff --git a/include/asm-ppc/kdebug.h b/include/asm-ppc/kdebug.h
new file mode 100644
index 000000000000..6ece1b037665
--- /dev/null
+++ b/include/asm-ppc/kdebug.h
@@ -0,0 +1 @@
#include <asm-generic/kdebug.h>
diff --git a/include/asm-s390/kdebug.h b/include/asm-s390/kdebug.h
index d2d7ad276148..04418af08f85 100644
--- a/include/asm-s390/kdebug.h
+++ b/include/asm-s390/kdebug.h
@@ -8,21 +8,6 @@
8 8
9struct pt_regs; 9struct pt_regs;
10 10
11struct die_args {
12 struct pt_regs *regs;
13 const char *str;
14 long err;
15 int trapnr;
16 int signr;
17};
18
19/* Note - you should never unregister because that can race with NMIs.
20 * If you really want to do it first unregister - then synchronize_sched
21 * - then free.
22 */
23extern int register_die_notifier(struct notifier_block *);
24extern int unregister_die_notifier(struct notifier_block *);
25
26/* 11/*
27 * These are only here because kprobes.c wants them to implement a 12 * These are only here because kprobes.c wants them to implement a
28 * blatant layering violation. Will hopefully go away soon once all 13 * blatant layering violation. Will hopefully go away soon once all
@@ -37,8 +22,6 @@ static inline int unregister_page_fault_notifier(struct notifier_block *nb)
37 return 0; 22 return 0;
38} 23}
39 24
40extern struct atomic_notifier_head s390die_chain;
41
42enum die_val { 25enum die_val {
43 DIE_OOPS = 1, 26 DIE_OOPS = 1,
44 DIE_BPT, 27 DIE_BPT,
@@ -54,19 +37,6 @@ enum die_val {
54 DIE_NMI_IPI, 37 DIE_NMI_IPI,
55}; 38};
56 39
57static inline int notify_die(enum die_val val, const char *str,
58 struct pt_regs *regs, long err, int trap, int sig)
59{
60 struct die_args args = {
61 .regs = regs,
62 .str = str,
63 .err = err,
64 .trapnr = trap,
65 .signr = sig
66 };
67 return atomic_notifier_call_chain(&s390die_chain, val, &args);
68}
69
70extern void die(const char *, struct pt_regs *, long); 40extern void die(const char *, struct pt_regs *, long);
71 41
72#endif 42#endif
diff --git a/include/asm-sh/kdebug.h b/include/asm-sh/kdebug.h
index ef009baf5a11..493c20629747 100644
--- a/include/asm-sh/kdebug.h
+++ b/include/asm-sh/kdebug.h
@@ -2,6 +2,7 @@
2#define __ASM_SH_KDEBUG_H 2#define __ASM_SH_KDEBUG_H
3 3
4#include <linux/notifier.h> 4#include <linux/notifier.h>
5#include <asm-generic/kdebug.h>
5 6
6struct pt_regs; 7struct pt_regs;
7 8
diff --git a/include/asm-sh64/kdebug.h b/include/asm-sh64/kdebug.h
new file mode 100644
index 000000000000..6ece1b037665
--- /dev/null
+++ b/include/asm-sh64/kdebug.h
@@ -0,0 +1 @@
#include <asm-generic/kdebug.h>
diff --git a/include/asm-sparc/kdebug.h b/include/asm-sparc/kdebug.h
index fba92485fdba..404d80767323 100644
--- a/include/asm-sparc/kdebug.h
+++ b/include/asm-sparc/kdebug.h
@@ -66,4 +66,8 @@ static inline void sp_enter_debugger(void)
66#define KDEBUG_DUNNO2_OFF 0x8 66#define KDEBUG_DUNNO2_OFF 0x8
67#define KDEBUG_TEACH_OFF 0xc 67#define KDEBUG_TEACH_OFF 0xc
68 68
69enum die_val {
70 DIE_UNUSED,
71};
72
69#endif /* !(_SPARC_KDEBUG_H) */ 73#endif /* !(_SPARC_KDEBUG_H) */
diff --git a/include/asm-sparc64/kdebug.h b/include/asm-sparc64/kdebug.h
index 11251bdd00cb..f8032e73f384 100644
--- a/include/asm-sparc64/kdebug.h
+++ b/include/asm-sparc64/kdebug.h
@@ -7,19 +7,8 @@
7 7
8struct pt_regs; 8struct pt_regs;
9 9
10struct die_args {
11 struct pt_regs *regs;
12 const char *str;
13 long err;
14 int trapnr;
15 int signr;
16};
17
18extern int register_die_notifier(struct notifier_block *);
19extern int unregister_die_notifier(struct notifier_block *);
20extern int register_page_fault_notifier(struct notifier_block *); 10extern int register_page_fault_notifier(struct notifier_block *);
21extern int unregister_page_fault_notifier(struct notifier_block *); 11extern int unregister_page_fault_notifier(struct notifier_block *);
22extern struct atomic_notifier_head sparc64die_chain;
23 12
24extern void bad_trap(struct pt_regs *, long); 13extern void bad_trap(struct pt_regs *, long);
25 14
@@ -36,16 +25,4 @@ enum die_val {
36 DIE_PAGE_FAULT, 25 DIE_PAGE_FAULT,
37}; 26};
38 27
39static inline int notify_die(enum die_val val,char *str, struct pt_regs *regs,
40 long err, int trap, int sig)
41{
42 struct die_args args = { .regs = regs,
43 .str = str,
44 .err = err,
45 .trapnr = trap,
46 .signr = sig };
47
48 return atomic_notifier_call_chain(&sparc64die_chain, val, &args);
49}
50
51#endif 28#endif
diff --git a/include/asm-um/kdebug.h b/include/asm-um/kdebug.h
new file mode 100644
index 000000000000..6ece1b037665
--- /dev/null
+++ b/include/asm-um/kdebug.h
@@ -0,0 +1 @@
#include <asm-generic/kdebug.h>
diff --git a/include/asm-v850/kdebug.h b/include/asm-v850/kdebug.h
new file mode 100644
index 000000000000..6ece1b037665
--- /dev/null
+++ b/include/asm-v850/kdebug.h
@@ -0,0 +1 @@
#include <asm-generic/kdebug.h>
diff --git a/include/asm-x86_64/kdebug.h b/include/asm-x86_64/kdebug.h
index e9ce163b1550..74feae945a26 100644
--- a/include/asm-x86_64/kdebug.h
+++ b/include/asm-x86_64/kdebug.h
@@ -5,19 +5,8 @@
5 5
6struct pt_regs; 6struct pt_regs;
7 7
8struct die_args {
9 struct pt_regs *regs;
10 const char *str;
11 long err;
12 int trapnr;
13 int signr;
14};
15
16extern int register_die_notifier(struct notifier_block *);
17extern int unregister_die_notifier(struct notifier_block *);
18extern int register_page_fault_notifier(struct notifier_block *); 8extern int register_page_fault_notifier(struct notifier_block *);
19extern int unregister_page_fault_notifier(struct notifier_block *); 9extern int unregister_page_fault_notifier(struct notifier_block *);
20extern struct atomic_notifier_head die_chain;
21 10
22/* Grossly misnamed. */ 11/* Grossly misnamed. */
23enum die_val { 12enum die_val {
@@ -37,19 +26,6 @@ enum die_val {
37 DIE_PAGE_FAULT, 26 DIE_PAGE_FAULT,
38}; 27};
39 28
40static inline int notify_die(enum die_val val, const char *str,
41 struct pt_regs *regs, long err, int trap, int sig)
42{
43 struct die_args args = {
44 .regs = regs,
45 .str = str,
46 .err = err,
47 .trapnr = trap,
48 .signr = sig
49 };
50 return atomic_notifier_call_chain(&die_chain, val, &args);
51}
52
53extern void printk_address(unsigned long address); 29extern void printk_address(unsigned long address);
54extern void die(const char *,struct pt_regs *,long); 30extern void die(const char *,struct pt_regs *,long);
55extern void __die(const char *,struct pt_regs *,long); 31extern void __die(const char *,struct pt_regs *,long);
diff --git a/include/asm-x86_64/pgtable.h b/include/asm-x86_64/pgtable.h
index da3390faaea6..5f75ee5379a7 100644
--- a/include/asm-x86_64/pgtable.h
+++ b/include/asm-x86_64/pgtable.h
@@ -411,7 +411,6 @@ static inline pte_t pte_modify(pte_t pte, pgprot_t newprot)
411 411
412extern spinlock_t pgd_lock; 412extern spinlock_t pgd_lock;
413extern struct list_head pgd_list; 413extern struct list_head pgd_list;
414void vmalloc_sync_all(void);
415 414
416extern int kern_addr_valid(unsigned long addr); 415extern int kern_addr_valid(unsigned long addr);
417 416
diff --git a/include/asm-xtensa/kdebug.h b/include/asm-xtensa/kdebug.h
new file mode 100644
index 000000000000..6ece1b037665
--- /dev/null
+++ b/include/asm-xtensa/kdebug.h
@@ -0,0 +1 @@
#include <asm-generic/kdebug.h>
diff --git a/include/linux/kdebug.h b/include/linux/kdebug.h
new file mode 100644
index 000000000000..5db38d6d8b92
--- /dev/null
+++ b/include/linux/kdebug.h
@@ -0,0 +1,20 @@
1#ifndef _LINUX_KDEBUG_H
2#define _LINUX_KDEBUG_H
3
4#include <asm/kdebug.h>
5
6struct die_args {
7 struct pt_regs *regs;
8 const char *str;
9 long err;
10 int trapnr;
11 int signr;
12};
13
14int register_die_notifier(struct notifier_block *nb);
15int unregister_die_notifier(struct notifier_block *nb);
16
17int notify_die(enum die_val val, const char *str,
18 struct pt_regs *regs, long err, int trap, int sig);
19
20#endif /* _LINUX_KDEBUG_H */
diff --git a/include/linux/vmalloc.h b/include/linux/vmalloc.h
index 924e502905d4..4b7ee83787c1 100644
--- a/include/linux/vmalloc.h
+++ b/include/linux/vmalloc.h
@@ -53,6 +53,7 @@ extern void vunmap(void *addr);
53 53
54extern int remap_vmalloc_range(struct vm_area_struct *vma, void *addr, 54extern int remap_vmalloc_range(struct vm_area_struct *vma, void *addr,
55 unsigned long pgoff); 55 unsigned long pgoff);
56void vmalloc_sync_all(void);
56 57
57/* 58/*
58 * Lowlevel-APIs (not for driver use!) 59 * Lowlevel-APIs (not for driver use!)
diff --git a/kernel/Makefile b/kernel/Makefile
index ac6b27abb1ad..642d4277c2ea 100644
--- a/kernel/Makefile
+++ b/kernel/Makefile
@@ -8,7 +8,7 @@ obj-y = sched.o fork.o exec_domain.o panic.o printk.o profile.o \
8 signal.o sys.o kmod.o workqueue.o pid.o \ 8 signal.o sys.o kmod.o workqueue.o pid.o \
9 rcupdate.o extable.o params.o posix-timers.o \ 9 rcupdate.o extable.o params.o posix-timers.o \
10 kthread.o wait.o kfifo.o sys_ni.o posix-cpu-timers.o mutex.o \ 10 kthread.o wait.o kfifo.o sys_ni.o posix-cpu-timers.o mutex.o \
11 hrtimer.o rwsem.o latency.o nsproxy.o srcu.o 11 hrtimer.o rwsem.o latency.o nsproxy.o srcu.o die_notifier.o
12 12
13obj-$(CONFIG_STACKTRACE) += stacktrace.o 13obj-$(CONFIG_STACKTRACE) += stacktrace.o
14obj-y += time/ 14obj-y += time/
diff --git a/kernel/die_notifier.c b/kernel/die_notifier.c
new file mode 100644
index 000000000000..0d98827887a7
--- /dev/null
+++ b/kernel/die_notifier.c
@@ -0,0 +1,38 @@
1
2#include <linux/module.h>
3#include <linux/notifier.h>
4#include <linux/vmalloc.h>
5#include <linux/kdebug.h>
6
7
8static ATOMIC_NOTIFIER_HEAD(die_chain);
9
10int notify_die(enum die_val val, const char *str,
11 struct pt_regs *regs, long err, int trap, int sig)
12{
13 struct die_args args = {
14 .regs = regs,
15 .str = str,
16 .err = err,
17 .trapnr = trap,
18 .signr = sig,
19
20 };
21
22 return atomic_notifier_call_chain(&die_chain, val, &args);
23}
24
25int register_die_notifier(struct notifier_block *nb)
26{
27 vmalloc_sync_all();
28 return atomic_notifier_chain_register(&die_chain, nb);
29}
30EXPORT_SYMBOL_GPL(register_die_notifier);
31
32int unregister_die_notifier(struct notifier_block *nb)
33{
34 return atomic_notifier_chain_unregister(&die_chain, nb);
35}
36EXPORT_SYMBOL_GPL(unregister_die_notifier);
37
38
diff --git a/kernel/kprobes.c b/kernel/kprobes.c
index 6c86d67ed1a7..0207045b4f6f 100644
--- a/kernel/kprobes.c
+++ b/kernel/kprobes.c
@@ -42,10 +42,10 @@
42#include <linux/freezer.h> 42#include <linux/freezer.h>
43#include <linux/seq_file.h> 43#include <linux/seq_file.h>
44#include <linux/debugfs.h> 44#include <linux/debugfs.h>
45#include <linux/kdebug.h>
45#include <asm-generic/sections.h> 46#include <asm-generic/sections.h>
46#include <asm/cacheflush.h> 47#include <asm/cacheflush.h>
47#include <asm/errno.h> 48#include <asm/errno.h>
48#include <asm/kdebug.h>
49 49
50#define KPROBE_HASH_BITS 6 50#define KPROBE_HASH_BITS 6
51#define KPROBE_TABLE_SIZE (1 << KPROBE_HASH_BITS) 51#define KPROBE_TABLE_SIZE (1 << KPROBE_HASH_BITS)
diff --git a/mm/nommu.c b/mm/nommu.c
index 1f60194d9b9b..2b16b00a5b11 100644
--- a/mm/nommu.c
+++ b/mm/nommu.c
@@ -262,6 +262,14 @@ void vunmap(void *addr)
262} 262}
263 263
264/* 264/*
265 * Implement a stub for vmalloc_sync_all() if the architecture chose not to
266 * have one.
267 */
268void __attribute__((weak)) vmalloc_sync_all(void)
269{
270}
271
272/*
265 * sys_brk() for the most part doesn't need the global kernel 273 * sys_brk() for the most part doesn't need the global kernel
266 * lock, except when an application is doing something nasty 274 * lock, except when an application is doing something nasty
267 * like trying to un-brk an area that has already been mapped 275 * like trying to un-brk an area that has already been mapped
diff --git a/mm/vmalloc.c b/mm/vmalloc.c
index cb5aabda7046..faa2a521dea3 100644
--- a/mm/vmalloc.c
+++ b/mm/vmalloc.c
@@ -755,3 +755,10 @@ out_einval_locked:
755} 755}
756EXPORT_SYMBOL(remap_vmalloc_range); 756EXPORT_SYMBOL(remap_vmalloc_range);
757 757
758/*
759 * Implement a stub for vmalloc_sync_all() if the architecture chose not to
760 * have one.
761 */
762void __attribute__((weak)) vmalloc_sync_all(void)
763{
764}