From: Christoph Hellwig Date: Tue, 8 May 2007 07:27:03 +0000 (-0700) Subject: move die notifier handling to common code X-Git-Tag: v2.6.22-rc1~722 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1eeb66a1bb973534dc3d064920a5ca683823372e;p=linux-2.6 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 Cc: Cc: Russell King Signed-off-by: Bryan Wu Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/arch/arm/kernel/traps.c b/arch/arm/kernel/traps.c index f05e66b0f8..10ff36e4e4 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) do_exit(SIGSEGV); } -void notify_die(const char *str, struct pt_regs *regs, struct siginfo *info, - unsigned long err, unsigned long trap) +void arm_notify_die(const char *str, struct pt_regs *regs, + struct siginfo *info, unsigned long err, unsigned long trap) { if (user_mode(regs)) { current->thread.error_code = err; @@ -330,7 +330,7 @@ asmlinkage void __exception do_undefinstr(struct pt_regs *regs) info.si_code = ILL_ILLOPC; info.si_addr = pc; - notify_die("Oops - undefined instruction", regs, &info, 0, 6); + arm_notify_die("Oops - undefined instruction", regs, &info, 0, 6); } asmlinkage void do_unexp_fiq (struct pt_regs *regs) @@ -384,7 +384,7 @@ static int bad_syscall(int n, struct pt_regs *regs) info.si_addr = (void __user *)instruction_pointer(regs) - (thumb_mode(regs) ? 2 : 4); - notify_die("Oops - bad syscall", regs, &info, n, 0); + arm_notify_die("Oops - bad syscall", regs, &info, n, 0); return regs->ARM_r0; } @@ -428,7 +428,7 @@ asmlinkage int arm_syscall(int no, struct pt_regs *regs) info.si_code = SEGV_MAPERR; info.si_addr = NULL; - notify_die("branch through zero", regs, &info, 0, 0); + arm_notify_die("branch through zero", regs, &info, 0, 0); return 0; case NR(breakpoint): /* SWI BREAK_POINT */ @@ -564,7 +564,7 @@ asmlinkage int arm_syscall(int no, struct pt_regs *regs) info.si_addr = (void __user *)instruction_pointer(regs) - (thumb_mode(regs) ? 2 : 4); - notify_die("Oops - bad syscall(2)", regs, &info, no, 0); + arm_notify_die("Oops - bad syscall(2)", regs, &info, no, 0); return 0; } @@ -638,7 +638,7 @@ baddataabort(int code, unsigned long instr, struct pt_regs *regs) info.si_code = ILL_ILLOPC; info.si_addr = (void __user *)addr; - notify_die("unknown data abort code", regs, &info, instr, 0); + arm_notify_die("unknown data abort code", regs, &info, instr, 0); } void __attribute__((noreturn)) __bug(const char *file, int line) diff --git a/arch/arm/mm/fault.c b/arch/arm/mm/fault.c index 5d9ce7deb4..75d491448e 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) info.si_errno = 0; info.si_code = inf->code; info.si_addr = (void __user *)addr; - notify_die("", regs, &info, fsr, 0); + arm_notify_die("", regs, &info, fsr, 0); } asmlinkage void __exception diff --git a/arch/avr32/kernel/kprobes.c b/arch/avr32/kernel/kprobes.c index d0abbcaf1c..004c94b6fc 100644 --- a/arch/avr32/kernel/kprobes.c +++ b/arch/avr32/kernel/kprobes.c @@ -15,7 +15,7 @@ #include #include -#include +#include #include DEFINE_PER_CPU(struct kprobe *, current_kprobe); diff --git a/arch/avr32/kernel/ptrace.c b/arch/avr32/kernel/ptrace.c index 6f4388f7c2..e8a3d7f01b 100644 --- a/arch/avr32/kernel/ptrace.c +++ b/arch/avr32/kernel/ptrace.c @@ -21,7 +21,7 @@ #include #include #include -#include +#include static struct pt_regs *get_user_regs(struct task_struct *tsk) { @@ -300,7 +300,7 @@ asmlinkage void do_debug_priv(struct pt_regs *regs) else die_val = DIE_BREAKPOINT; - if (notify_die(die_val, regs, 0, SIGTRAP) == NOTIFY_STOP) + if (notify_die(die_val, "ptrace", regs, 0, 0, SIGTRAP) == NOTIFY_STOP) return; if (likely(ds & DS_SSS)) { diff --git a/arch/avr32/kernel/traps.c b/arch/avr32/kernel/traps.c index 4f0382d848..4de9edf96e 100644 --- a/arch/avr32/kernel/traps.c +++ b/arch/avr32/kernel/traps.c @@ -20,20 +20,6 @@ #include #include -ATOMIC_NOTIFIER_HEAD(avr32_die_chain); - -int register_die_notifier(struct notifier_block *nb) -{ - return atomic_notifier_chain_register(&avr32_die_chain, nb); -} -EXPORT_SYMBOL(register_die_notifier); - -int unregister_die_notifier(struct notifier_block *nb) -{ - return atomic_notifier_chain_unregister(&avr32_die_chain, nb); -} -EXPORT_SYMBOL(unregister_die_notifier); - static DEFINE_SPINLOCK(die_lock); void 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 146ebdbdc3..88b00b1597 100644 --- a/arch/avr32/mm/fault.c +++ b/arch/avr32/mm/fault.c @@ -13,7 +13,7 @@ #include #include -#include +#include #include #include #include diff --git a/arch/i386/kernel/crash.c b/arch/i386/kernel/crash.c index a5e0e990ea..53589d1b1a 100644 --- a/arch/i386/kernel/crash.c +++ b/arch/i386/kernel/crash.c @@ -22,7 +22,7 @@ #include #include #include -#include +#include #include #include diff --git a/arch/i386/kernel/kprobes.c b/arch/i386/kernel/kprobes.c index b545bc746f..e00f75ecf1 100644 --- a/arch/i386/kernel/kprobes.c +++ b/arch/i386/kernel/kprobes.c @@ -31,8 +31,8 @@ #include #include #include +#include #include -#include #include #include diff --git a/arch/i386/kernel/nmi.c b/arch/i386/kernel/nmi.c index 33cf2f3c44..fba121f797 100644 --- a/arch/i386/kernel/nmi.c +++ b/arch/i386/kernel/nmi.c @@ -23,10 +23,10 @@ #include #include #include +#include #include #include -#include #include "mach_traps.h" diff --git a/arch/i386/kernel/traps.c b/arch/i386/kernel/traps.c index 58c8e015e7..4bec0cbf40 100644 --- a/arch/i386/kernel/traps.c +++ b/arch/i386/kernel/traps.c @@ -52,7 +52,7 @@ #include #include #include -#include +#include #include #include @@ -95,20 +95,6 @@ asmlinkage void machine_check(void); int kstack_depth_to_print = 24; static unsigned int code_bytes = 64; -ATOMIC_NOTIFIER_HEAD(i386die_chain); - -int register_die_notifier(struct notifier_block *nb) -{ - vmalloc_sync_all(); - return atomic_notifier_chain_register(&i386die_chain, nb); -} -EXPORT_SYMBOL(register_die_notifier); /* used modular by kdb */ - -int unregister_die_notifier(struct notifier_block *nb) -{ - return atomic_notifier_chain_unregister(&i386die_chain, nb); -} -EXPORT_SYMBOL(unregister_die_notifier); /* used modular by kdb */ static inline int valid_stack_ptr(struct thread_info *tinfo, void *p) { diff --git a/arch/i386/mm/fault.c b/arch/i386/mm/fault.c index f534c29e80..ca0aa0cedc 100644 --- a/arch/i386/mm/fault.c +++ b/arch/i386/mm/fault.c @@ -21,13 +21,14 @@ #include /* For unblank_screen() */ #include #include /* for max_low_pfn */ +#include #include #include #include +#include #include #include -#include #include extern 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 695f737516..8e185208df 100644 --- a/arch/i386/oprofile/nmi_int.c +++ b/arch/i386/oprofile/nmi_int.c @@ -14,10 +14,10 @@ #include #include #include +#include #include #include #include -#include #include "op_counter.h" #include "op_x86_model.h" diff --git a/arch/i386/oprofile/nmi_timer_int.c b/arch/i386/oprofile/nmi_timer_int.c index abf0ba52a6..1418e36ae7 100644 --- a/arch/i386/oprofile/nmi_timer_int.c +++ b/arch/i386/oprofile/nmi_timer_int.c @@ -12,12 +12,11 @@ #include #include #include - +#include #include #include #include -#include static int profile_timer_exceptions_notify(struct notifier_block *self, unsigned long val, void *data) diff --git a/arch/ia64/kernel/crash.c b/arch/ia64/kernel/crash.c index 80a94e7078..3d51a3f770 100644 --- a/arch/ia64/kernel/crash.c +++ b/arch/ia64/kernel/crash.c @@ -16,8 +16,8 @@ #include #include #include +#include -#include #include int kdump_status[NR_CPUS]; diff --git a/arch/ia64/kernel/kprobes.c b/arch/ia64/kernel/kprobes.c index 6cb56dd405..779fe00c90 100644 --- a/arch/ia64/kernel/kprobes.c +++ b/arch/ia64/kernel/kprobes.c @@ -29,9 +29,9 @@ #include #include #include +#include #include -#include #include #include diff --git a/arch/ia64/kernel/mca.c b/arch/ia64/kernel/mca.c index 491687f84f..65e3b81a44 100644 --- a/arch/ia64/kernel/mca.c +++ b/arch/ia64/kernel/mca.c @@ -72,9 +72,9 @@ #include #include #include +#include #include -#include #include #include #include diff --git a/arch/ia64/kernel/process.c b/arch/ia64/kernel/process.c index ae96d41769..7ab36c772e 100644 --- a/arch/ia64/kernel/process.c +++ b/arch/ia64/kernel/process.c @@ -27,13 +27,13 @@ #include #include #include +#include #include #include #include #include #include -#include #include #include #include diff --git a/arch/ia64/kernel/traps.c b/arch/ia64/kernel/traps.c index 765cbe5ba6..5bfb8be02b 100644 --- a/arch/ia64/kernel/traps.c +++ b/arch/ia64/kernel/traps.c @@ -16,33 +16,17 @@ #include #include #include /* for ssleep() */ +#include #include #include #include #include #include -#include fpswa_interface_t *fpswa_interface; EXPORT_SYMBOL(fpswa_interface); -ATOMIC_NOTIFIER_HEAD(ia64die_chain); - -int -register_die_notifier(struct notifier_block *nb) -{ - return atomic_notifier_chain_register(&ia64die_chain, nb); -} -EXPORT_SYMBOL_GPL(register_die_notifier); - -int -unregister_die_notifier(struct notifier_block *nb) -{ - return atomic_notifier_chain_unregister(&ia64die_chain, nb); -} -EXPORT_SYMBOL_GPL(unregister_die_notifier); - void __init trap_init (void) { diff --git a/arch/ia64/mm/fault.c b/arch/ia64/mm/fault.c index 59f3ab9376..cb4791d17c 100644 --- a/arch/ia64/mm/fault.c +++ b/arch/ia64/mm/fault.c @@ -10,12 +10,12 @@ #include #include #include +#include #include #include #include #include -#include extern void die (char *, struct pt_regs *, long); diff --git a/arch/ia64/sn/kernel/xpc_main.c b/arch/ia64/sn/kernel/xpc_main.c index 68355ef6f8..e336e1692a 100644 --- a/arch/ia64/sn/kernel/xpc_main.c +++ b/arch/ia64/sn/kernel/xpc_main.c @@ -55,9 +55,9 @@ #include #include #include +#include #include #include -#include #include #include @@ -1332,7 +1332,7 @@ xpc_init(void) dev_warn(xpc_part, "can't register reboot notifier\n"); } - /* add ourselves to the die_notifier list (i.e., ia64die_chain) */ + /* add ourselves to the die_notifier list */ ret = register_die_notifier(&xpc_die_notifier); if (ret != 0) { 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 ef647e7a9d..2a2c696dcc 100644 --- a/arch/powerpc/kernel/kprobes.c +++ b/arch/powerpc/kernel/kprobes.c @@ -30,8 +30,8 @@ #include #include #include +#include #include -#include #include #include diff --git a/arch/powerpc/kernel/traps.c b/arch/powerpc/kernel/traps.c index f7862224fe..bf6445ac9f 100644 --- a/arch/powerpc/kernel/traps.c +++ b/arch/powerpc/kernel/traps.c @@ -33,8 +33,8 @@ #include #include #include +#include -#include #include #include #include @@ -72,20 +72,6 @@ EXPORT_SYMBOL(__debugger_dabr_match); EXPORT_SYMBOL(__debugger_fault_handler); #endif -ATOMIC_NOTIFIER_HEAD(powerpc_die_chain); - -int register_die_notifier(struct notifier_block *nb) -{ - return atomic_notifier_chain_register(&powerpc_die_chain, nb); -} -EXPORT_SYMBOL(register_die_notifier); - -int unregister_die_notifier(struct notifier_block *nb) -{ - return atomic_notifier_chain_unregister(&powerpc_die_chain, nb); -} -EXPORT_SYMBOL(unregister_die_notifier); - /* * Trap & Exception support */ diff --git a/arch/powerpc/mm/fault.c b/arch/powerpc/mm/fault.c index 03aeb3a460..bec0cce79a 100644 --- a/arch/powerpc/mm/fault.c +++ b/arch/powerpc/mm/fault.c @@ -28,6 +28,7 @@ #include #include #include +#include #include #include @@ -36,7 +37,6 @@ #include #include #include -#include #include #ifdef CONFIG_KPROBES diff --git a/arch/s390/kernel/kprobes.c b/arch/s390/kernel/kprobes.c index 23c61f6d96..8516a94d81 100644 --- a/arch/s390/kernel/kprobes.c +++ b/arch/s390/kernel/kprobes.c @@ -24,8 +24,8 @@ #include #include #include +#include #include -#include #include #include #include diff --git a/arch/s390/kernel/traps.c b/arch/s390/kernel/traps.c index 49dec83037..a750bcc69a 100644 --- a/arch/s390/kernel/traps.c +++ b/arch/s390/kernel/traps.c @@ -27,6 +27,7 @@ #include #include #include +#include #include #include #include @@ -40,7 +41,6 @@ #include #include #include -#include /* Called from entry.S only */ extern void handle_per_exception(struct pt_regs *regs); @@ -70,20 +70,6 @@ static int kstack_depth_to_print = 12; static int kstack_depth_to_print = 20; #endif /* CONFIG_64BIT */ -ATOMIC_NOTIFIER_HEAD(s390die_chain); - -int register_die_notifier(struct notifier_block *nb) -{ - return atomic_notifier_chain_register(&s390die_chain, nb); -} -EXPORT_SYMBOL(register_die_notifier); - -int unregister_die_notifier(struct notifier_block *nb) -{ - return atomic_notifier_chain_unregister(&s390die_chain, nb); -} -EXPORT_SYMBOL(unregister_die_notifier); - /* * For show_trace we have tree different stack to consider: * - 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 91f705adc3..8b924b3597 100644 --- a/arch/s390/mm/fault.c +++ b/arch/s390/mm/fault.c @@ -20,6 +20,7 @@ #include #include #include +#include #include #include #include @@ -30,7 +31,6 @@ #include #include -#include #include #ifndef CONFIG_64BIT diff --git a/arch/sparc/kernel/head.S b/arch/sparc/kernel/head.S index 9a219e8b5d..97da13c525 100644 --- a/arch/sparc/kernel/head.S +++ b/arch/sparc/kernel/head.S @@ -19,7 +19,7 @@ #include #include #include -#include +#include #include #include /* TI_UWINMASK */ #include diff --git a/arch/sparc/kernel/setup.c b/arch/sparc/kernel/setup.c index eccd8e87f5..64c0ed9882 100644 --- a/arch/sparc/kernel/setup.c +++ b/arch/sparc/kernel/setup.c @@ -31,6 +31,7 @@ #include #include #include +#include #include #include @@ -40,7 +41,6 @@ #include #include #include -#include #include #include #include diff --git a/arch/sparc/kernel/traps.c b/arch/sparc/kernel/traps.c index 527687afc1..dc9ffea2a4 100644 --- a/arch/sparc/kernel/traps.c +++ b/arch/sparc/kernel/traps.c @@ -15,6 +15,7 @@ #include #include #include +#include #include #include @@ -22,7 +23,6 @@ #include #include #include -#include #include #include diff --git a/arch/sparc/mm/fault.c b/arch/sparc/mm/fault.c index 9eeed3347d..c133f270cf 100644 --- a/arch/sparc/mm/fault.c +++ b/arch/sparc/mm/fault.c @@ -21,6 +21,7 @@ #include #include #include +#include #include #include @@ -30,7 +31,6 @@ #include #include #include -#include #include extern int prom_node_root; diff --git a/arch/sparc/mm/srmmu.c b/arch/sparc/mm/srmmu.c index 0df7121cef..e5eaa8072a 100644 --- a/arch/sparc/mm/srmmu.c +++ b/arch/sparc/mm/srmmu.c @@ -18,13 +18,13 @@ #include #include #include +#include #include #include #include #include #include -#include #include #include #include diff --git a/arch/sparc64/kernel/kprobes.c b/arch/sparc64/kernel/kprobes.c index ae221f0d4a..a44fe47a3c 100644 --- a/arch/sparc64/kernel/kprobes.c +++ b/arch/sparc64/kernel/kprobes.c @@ -6,7 +6,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/arch/sparc64/kernel/traps.c b/arch/sparc64/kernel/traps.c index ad67784292..64057fdfc7 100644 --- a/arch/sparc64/kernel/traps.c +++ b/arch/sparc64/kernel/traps.c @@ -18,6 +18,7 @@ #include #include #include +#include #include #include @@ -36,26 +37,12 @@ #include #include #include -#include #include #ifdef CONFIG_KMOD #include #endif #include -ATOMIC_NOTIFIER_HEAD(sparc64die_chain); - -int register_die_notifier(struct notifier_block *nb) -{ - return atomic_notifier_chain_register(&sparc64die_chain, nb); -} -EXPORT_SYMBOL(register_die_notifier); - -int unregister_die_notifier(struct notifier_block *nb) -{ - return atomic_notifier_chain_unregister(&sparc64die_chain, nb); -} -EXPORT_SYMBOL(unregister_die_notifier); /* When an irrecoverable trap occurs at tl > 0, the trap entry * 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 55ae802dc0..7c36527b74 100644 --- a/arch/sparc64/mm/fault.c +++ b/arch/sparc64/mm/fault.c @@ -20,6 +20,7 @@ #include #include #include +#include #include #include @@ -29,7 +30,6 @@ #include #include #include -#include #include #ifdef CONFIG_KPROBES diff --git a/arch/x86_64/kernel/crash.c b/arch/x86_64/kernel/crash.c index 95a7a2c131..13432a1ae9 100644 --- a/arch/x86_64/kernel/crash.c +++ b/arch/x86_64/kernel/crash.c @@ -17,13 +17,13 @@ #include #include #include +#include #include #include #include #include #include -#include /* This keeps a track of which one is crashing cpu. */ static int crashing_cpu; diff --git a/arch/x86_64/kernel/kprobes.c b/arch/x86_64/kernel/kprobes.c index 209c8c0bec..90e7008cd8 100644 --- a/arch/x86_64/kernel/kprobes.c +++ b/arch/x86_64/kernel/kprobes.c @@ -37,10 +37,10 @@ #include #include #include +#include #include #include -#include #include void jprobe_return_end(void); diff --git a/arch/x86_64/kernel/mce.c b/arch/x86_64/kernel/mce.c index fa26726824..442169640e 100644 --- a/arch/x86_64/kernel/mce.c +++ b/arch/x86_64/kernel/mce.c @@ -20,10 +20,10 @@ #include #include #include +#include #include #include #include -#include #include #include diff --git a/arch/x86_64/kernel/nmi.c b/arch/x86_64/kernel/nmi.c index 6cd2b30e2f..931c64bad5 100644 --- a/arch/x86_64/kernel/nmi.c +++ b/arch/x86_64/kernel/nmi.c @@ -21,11 +21,11 @@ #include #include #include +#include #include #include #include -#include #include int unknown_nmi_panic; diff --git a/arch/x86_64/kernel/pci-gart.c b/arch/x86_64/kernel/pci-gart.c index 0a762e10f2..373ef66ca1 100644 --- a/arch/x86_64/kernel/pci-gart.c +++ b/arch/x86_64/kernel/pci-gart.c @@ -22,13 +22,13 @@ #include #include #include +#include #include #include #include #include #include #include -#include #include #include #include diff --git a/arch/x86_64/kernel/process.c b/arch/x86_64/kernel/process.c index 4f21765078..5909039f37 100644 --- a/arch/x86_64/kernel/process.c +++ b/arch/x86_64/kernel/process.c @@ -36,6 +36,7 @@ #include #include #include +#include #include #include @@ -46,7 +47,6 @@ #include #include #include -#include #include #include #include diff --git a/arch/x86_64/kernel/reboot.c b/arch/x86_64/kernel/reboot.c index 2d67698474..c116b54d42 100644 --- a/arch/x86_64/kernel/reboot.c +++ b/arch/x86_64/kernel/reboot.c @@ -7,8 +7,8 @@ #include #include #include +#include #include -#include #include #include #include diff --git a/arch/x86_64/kernel/smpboot.c b/arch/x86_64/kernel/smpboot.c index 4d9dacfae5..193af9922c 100644 --- a/arch/x86_64/kernel/smpboot.c +++ b/arch/x86_64/kernel/smpboot.c @@ -49,11 +49,11 @@ #include #include #include +#include #include #include #include -#include #include #include #include diff --git a/arch/x86_64/kernel/traps.c b/arch/x86_64/kernel/traps.c index 0484a2ceac..8c2ac41187 100644 --- a/arch/x86_64/kernel/traps.c +++ b/arch/x86_64/kernel/traps.c @@ -32,6 +32,7 @@ #include #include #include +#include #include #include @@ -39,7 +40,6 @@ #include #include #include -#include #include #include #include @@ -71,22 +71,6 @@ asmlinkage void alignment_check(void); asmlinkage void machine_check(void); asmlinkage void spurious_interrupt_bug(void); -ATOMIC_NOTIFIER_HEAD(die_chain); -EXPORT_SYMBOL(die_chain); - -int register_die_notifier(struct notifier_block *nb) -{ - vmalloc_sync_all(); - return atomic_notifier_chain_register(&die_chain, nb); -} -EXPORT_SYMBOL(register_die_notifier); /* used modular by kdb */ - -int unregister_die_notifier(struct notifier_block *nb) -{ - return atomic_notifier_chain_unregister(&die_chain, nb); -} -EXPORT_SYMBOL(unregister_die_notifier); /* used modular by kdb */ - static inline void conditional_sti(struct pt_regs *regs) { if (regs->eflags & X86_EFLAGS_IF) diff --git a/arch/x86_64/mm/fault.c b/arch/x86_64/mm/fault.c index de99dba2c5..fd6ecc2cee 100644 --- a/arch/x86_64/mm/fault.c +++ b/arch/x86_64/mm/fault.c @@ -21,16 +21,17 @@ #include #include /* For unblank_screen() */ #include +#include #include #include #include +#include #include #include #include #include #include -#include #include /* Page fault error code bits */ diff --git a/drivers/char/ipmi/ipmi_watchdog.c b/drivers/char/ipmi/ipmi_watchdog.c index 9e9c5de2e5..b6a972ed5b 100644 --- a/drivers/char/ipmi/ipmi_watchdog.c +++ b/drivers/char/ipmi/ipmi_watchdog.c @@ -39,6 +39,7 @@ #include #include #include +#include #include #include #include diff --git a/include/asm-alpha/kdebug.h b/include/asm-alpha/kdebug.h new file mode 100644 index 0000000000..6ece1b0376 --- /dev/null +++ b/include/asm-alpha/kdebug.h @@ -0,0 +1 @@ +#include diff --git a/include/asm-arm/kdebug.h b/include/asm-arm/kdebug.h new file mode 100644 index 0000000000..6ece1b0376 --- /dev/null +++ b/include/asm-arm/kdebug.h @@ -0,0 +1 @@ +#include diff --git a/include/asm-arm/system.h b/include/asm-arm/system.h index 63b3080bda..25f84da4a9 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) __attribute__((noreturn)); struct siginfo; -void notify_die(const char *str, struct pt_regs *regs, struct siginfo *info, +void arm_notify_die(const char *str, struct pt_regs *regs, struct siginfo *info, unsigned long err, unsigned long trap); void 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 0000000000..6ece1b0376 --- /dev/null +++ b/include/asm-arm26/kdebug.h @@ -0,0 +1 @@ +#include diff --git a/include/asm-avr32/kdebug.h b/include/asm-avr32/kdebug.h index f583b643ff..de419278fc 100644 --- a/include/asm-avr32/kdebug.h +++ b/include/asm-avr32/kdebug.h @@ -3,19 +3,6 @@ #include -struct pt_regs; - -struct die_args { - struct pt_regs *regs; - int trapnr; -}; - -int register_die_notifier(struct notifier_block *nb); -int unregister_die_notifier(struct notifier_block *nb); -int register_page_fault_notifier(struct notifier_block *nb); -int unregister_page_fault_notifier(struct notifier_block *nb); -extern struct atomic_notifier_head avr32_die_chain; - /* Grossly misnamed. */ enum die_val { DIE_FAULT, @@ -24,15 +11,7 @@ enum die_val { DIE_PAGE_FAULT, }; -static inline int notify_die(enum die_val val, struct pt_regs *regs, - int trap, int sig) -{ - struct die_args args = { - .regs = regs, - .trapnr = trap, - }; - - return atomic_notifier_call_chain(&avr32_die_chain, val, &args); -} +int register_page_fault_notifier(struct notifier_block *nb); +int unregister_page_fault_notifier(struct notifier_block *nb); #endif /* __ASM_AVR32_KDEBUG_H */ diff --git a/include/asm-cris/kdebug.h b/include/asm-cris/kdebug.h new file mode 100644 index 0000000000..6ece1b0376 --- /dev/null +++ b/include/asm-cris/kdebug.h @@ -0,0 +1 @@ +#include diff --git a/include/asm-frv/kdebug.h b/include/asm-frv/kdebug.h new file mode 100644 index 0000000000..6ece1b0376 --- /dev/null +++ b/include/asm-frv/kdebug.h @@ -0,0 +1 @@ +#include diff --git a/include/asm-generic/kdebug.h b/include/asm-generic/kdebug.h new file mode 100644 index 0000000000..2b799c90b2 --- /dev/null +++ b/include/asm-generic/kdebug.h @@ -0,0 +1,8 @@ +#ifndef _ASM_GENERIC_KDEBUG_H +#define _ASM_GENERIC_KDEBUG_H + +enum die_val { + DIE_UNUSED, +}; + +#endif /* _ASM_GENERIC_KDEBUG_H */ diff --git a/include/asm-h8300/kdebug.h b/include/asm-h8300/kdebug.h new file mode 100644 index 0000000000..6ece1b0376 --- /dev/null +++ b/include/asm-h8300/kdebug.h @@ -0,0 +1 @@ +#include diff --git a/include/asm-i386/kdebug.h b/include/asm-i386/kdebug.h index 6e1c8e1b5e..05c3117788 100644 --- a/include/asm-i386/kdebug.h +++ b/include/asm-i386/kdebug.h @@ -9,19 +9,8 @@ struct pt_regs; -struct die_args { - struct pt_regs *regs; - const char *str; - long err; - int trapnr; - int signr; -}; - -extern int register_die_notifier(struct notifier_block *); -extern int unregister_die_notifier(struct notifier_block *); extern int register_page_fault_notifier(struct notifier_block *); extern int unregister_page_fault_notifier(struct notifier_block *); -extern struct atomic_notifier_head i386die_chain; /* Grossly misnamed. */ @@ -42,17 +31,4 @@ enum die_val { DIE_PAGE_FAULT, }; -static inline int notify_die(enum die_val val, const char *str, - struct pt_regs *regs, long err, int trap, int sig) -{ - struct die_args args = { - .regs = regs, - .str = str, - .err = err, - .trapnr = trap, - .signr = sig - }; - return atomic_notifier_call_chain(&i386die_chain, val, &args); -} - #endif diff --git a/include/asm-i386/pgtable.h b/include/asm-i386/pgtable.h index e16359f81a..61fbf8578f 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 static inline pte_t pte_mkwrite(pte_t pte) { (pte).pte_low |= _PAGE_RW; return pte; } static inline pte_t pte_mkhuge(pte_t pte) { (pte).pte_low |= _PAGE_PSE; return pte; } -extern void vmalloc_sync_all(void); - #ifdef CONFIG_X86_PAE # include #else diff --git a/include/asm-ia64/kdebug.h b/include/asm-ia64/kdebug.h index aed7142f9e..ba211e011a 100644 --- a/include/asm-ia64/kdebug.h +++ b/include/asm-ia64/kdebug.h @@ -28,21 +28,8 @@ */ #include -struct pt_regs; - -struct die_args { - struct pt_regs *regs; - const char *str; - long err; - int trapnr; - int signr; -}; - -extern int register_die_notifier(struct notifier_block *); -extern int unregister_die_notifier(struct notifier_block *); extern int register_page_fault_notifier(struct notifier_block *); extern int unregister_page_fault_notifier(struct notifier_block *); -extern struct atomic_notifier_head ia64die_chain; enum die_val { DIE_BREAK = 1, @@ -74,18 +61,4 @@ enum die_val { DIE_KDUMP_LEAVE, }; -static inline int notify_die(enum die_val val, char *str, struct pt_regs *regs, - long err, int trap, int sig) -{ - struct die_args args = { - .regs = regs, - .str = str, - .err = err, - .trapnr = trap, - .signr = sig - }; - - return atomic_notifier_call_chain(&ia64die_chain, val, &args); -} - #endif diff --git a/include/asm-m32r/kdebug.h b/include/asm-m32r/kdebug.h new file mode 100644 index 0000000000..6ece1b0376 --- /dev/null +++ b/include/asm-m32r/kdebug.h @@ -0,0 +1 @@ +#include diff --git a/include/asm-m68k/kdebug.h b/include/asm-m68k/kdebug.h new file mode 100644 index 0000000000..6ece1b0376 --- /dev/null +++ b/include/asm-m68k/kdebug.h @@ -0,0 +1 @@ +#include diff --git a/include/asm-m68knommu/kdebug.h b/include/asm-m68knommu/kdebug.h new file mode 100644 index 0000000000..6ece1b0376 --- /dev/null +++ b/include/asm-m68knommu/kdebug.h @@ -0,0 +1 @@ +#include diff --git a/include/asm-mips/kdebug.h b/include/asm-mips/kdebug.h new file mode 100644 index 0000000000..6ece1b0376 --- /dev/null +++ b/include/asm-mips/kdebug.h @@ -0,0 +1 @@ +#include diff --git a/include/asm-parisc/kdebug.h b/include/asm-parisc/kdebug.h new file mode 100644 index 0000000000..6ece1b0376 --- /dev/null +++ b/include/asm-parisc/kdebug.h @@ -0,0 +1 @@ +#include diff --git a/include/asm-powerpc/kdebug.h b/include/asm-powerpc/kdebug.h index 532bfee934..1c73d2ec9b 100644 --- a/include/asm-powerpc/kdebug.h +++ b/include/asm-powerpc/kdebug.h @@ -6,18 +6,6 @@ #include -struct pt_regs; - -struct die_args { - struct pt_regs *regs; - const char *str; - long err; - int trapnr; - int signr; -}; - -extern int register_die_notifier(struct notifier_block *); -extern int unregister_die_notifier(struct notifier_block *); extern int register_page_fault_notifier(struct notifier_block *); extern int unregister_page_fault_notifier(struct notifier_block *); extern struct atomic_notifier_head powerpc_die_chain; @@ -32,11 +20,5 @@ enum die_val { DIE_PAGE_FAULT, }; -static inline int notify_die(enum die_val val,char *str,struct pt_regs *regs,long err,int trap, int sig) -{ - struct die_args args = { .regs=regs, .str=str, .err=err, .trapnr=trap,.signr=sig }; - return atomic_notifier_call_chain(&powerpc_die_chain, val, &args); -} - #endif /* __KERNEL__ */ #endif /* _ASM_POWERPC_KDEBUG_H */ diff --git a/include/asm-ppc/kdebug.h b/include/asm-ppc/kdebug.h new file mode 100644 index 0000000000..6ece1b0376 --- /dev/null +++ b/include/asm-ppc/kdebug.h @@ -0,0 +1 @@ +#include diff --git a/include/asm-s390/kdebug.h b/include/asm-s390/kdebug.h index d2d7ad2761..04418af08f 100644 --- a/include/asm-s390/kdebug.h +++ b/include/asm-s390/kdebug.h @@ -8,21 +8,6 @@ struct pt_regs; -struct die_args { - struct pt_regs *regs; - const char *str; - long err; - int trapnr; - int signr; -}; - -/* Note - you should never unregister because that can race with NMIs. - * If you really want to do it first unregister - then synchronize_sched - * - then free. - */ -extern int register_die_notifier(struct notifier_block *); -extern int unregister_die_notifier(struct notifier_block *); - /* * These are only here because kprobes.c wants them to implement a * 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) return 0; } -extern struct atomic_notifier_head s390die_chain; - enum die_val { DIE_OOPS = 1, DIE_BPT, @@ -54,19 +37,6 @@ enum die_val { DIE_NMI_IPI, }; -static inline int notify_die(enum die_val val, const char *str, - struct pt_regs *regs, long err, int trap, int sig) -{ - struct die_args args = { - .regs = regs, - .str = str, - .err = err, - .trapnr = trap, - .signr = sig - }; - return atomic_notifier_call_chain(&s390die_chain, val, &args); -} - extern void die(const char *, struct pt_regs *, long); #endif diff --git a/include/asm-sh/kdebug.h b/include/asm-sh/kdebug.h index ef009baf5a..493c206297 100644 --- a/include/asm-sh/kdebug.h +++ b/include/asm-sh/kdebug.h @@ -2,6 +2,7 @@ #define __ASM_SH_KDEBUG_H #include +#include struct pt_regs; diff --git a/include/asm-sh64/kdebug.h b/include/asm-sh64/kdebug.h new file mode 100644 index 0000000000..6ece1b0376 --- /dev/null +++ b/include/asm-sh64/kdebug.h @@ -0,0 +1 @@ +#include diff --git a/include/asm-sparc/kdebug.h b/include/asm-sparc/kdebug.h index fba92485fd..404d807673 100644 --- a/include/asm-sparc/kdebug.h +++ b/include/asm-sparc/kdebug.h @@ -66,4 +66,8 @@ static inline void sp_enter_debugger(void) #define KDEBUG_DUNNO2_OFF 0x8 #define KDEBUG_TEACH_OFF 0xc +enum die_val { + DIE_UNUSED, +}; + #endif /* !(_SPARC_KDEBUG_H) */ diff --git a/include/asm-sparc64/kdebug.h b/include/asm-sparc64/kdebug.h index 11251bdd00..f8032e73f3 100644 --- a/include/asm-sparc64/kdebug.h +++ b/include/asm-sparc64/kdebug.h @@ -7,19 +7,8 @@ struct pt_regs; -struct die_args { - struct pt_regs *regs; - const char *str; - long err; - int trapnr; - int signr; -}; - -extern int register_die_notifier(struct notifier_block *); -extern int unregister_die_notifier(struct notifier_block *); extern int register_page_fault_notifier(struct notifier_block *); extern int unregister_page_fault_notifier(struct notifier_block *); -extern struct atomic_notifier_head sparc64die_chain; extern void bad_trap(struct pt_regs *, long); @@ -36,16 +25,4 @@ enum die_val { DIE_PAGE_FAULT, }; -static inline int notify_die(enum die_val val,char *str, struct pt_regs *regs, - long err, int trap, int sig) -{ - struct die_args args = { .regs = regs, - .str = str, - .err = err, - .trapnr = trap, - .signr = sig }; - - return atomic_notifier_call_chain(&sparc64die_chain, val, &args); -} - #endif diff --git a/include/asm-um/kdebug.h b/include/asm-um/kdebug.h new file mode 100644 index 0000000000..6ece1b0376 --- /dev/null +++ b/include/asm-um/kdebug.h @@ -0,0 +1 @@ +#include diff --git a/include/asm-v850/kdebug.h b/include/asm-v850/kdebug.h new file mode 100644 index 0000000000..6ece1b0376 --- /dev/null +++ b/include/asm-v850/kdebug.h @@ -0,0 +1 @@ +#include diff --git a/include/asm-x86_64/kdebug.h b/include/asm-x86_64/kdebug.h index e9ce163b15..74feae945a 100644 --- a/include/asm-x86_64/kdebug.h +++ b/include/asm-x86_64/kdebug.h @@ -5,19 +5,8 @@ struct pt_regs; -struct die_args { - struct pt_regs *regs; - const char *str; - long err; - int trapnr; - int signr; -}; - -extern int register_die_notifier(struct notifier_block *); -extern int unregister_die_notifier(struct notifier_block *); extern int register_page_fault_notifier(struct notifier_block *); extern int unregister_page_fault_notifier(struct notifier_block *); -extern struct atomic_notifier_head die_chain; /* Grossly misnamed. */ enum die_val { @@ -37,19 +26,6 @@ enum die_val { DIE_PAGE_FAULT, }; -static inline int notify_die(enum die_val val, const char *str, - struct pt_regs *regs, long err, int trap, int sig) -{ - struct die_args args = { - .regs = regs, - .str = str, - .err = err, - .trapnr = trap, - .signr = sig - }; - return atomic_notifier_call_chain(&die_chain, val, &args); -} - extern void printk_address(unsigned long address); extern void die(const char *,struct pt_regs *,long); extern 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 da3390faae..5f75ee5379 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) extern spinlock_t pgd_lock; extern struct list_head pgd_list; -void vmalloc_sync_all(void); extern int kern_addr_valid(unsigned long addr); diff --git a/include/asm-xtensa/kdebug.h b/include/asm-xtensa/kdebug.h new file mode 100644 index 0000000000..6ece1b0376 --- /dev/null +++ b/include/asm-xtensa/kdebug.h @@ -0,0 +1 @@ +#include diff --git a/include/linux/kdebug.h b/include/linux/kdebug.h new file mode 100644 index 0000000000..5db38d6d8b --- /dev/null +++ b/include/linux/kdebug.h @@ -0,0 +1,20 @@ +#ifndef _LINUX_KDEBUG_H +#define _LINUX_KDEBUG_H + +#include + +struct die_args { + struct pt_regs *regs; + const char *str; + long err; + int trapnr; + int signr; +}; + +int register_die_notifier(struct notifier_block *nb); +int unregister_die_notifier(struct notifier_block *nb); + +int notify_die(enum die_val val, const char *str, + struct pt_regs *regs, long err, int trap, int sig); + +#endif /* _LINUX_KDEBUG_H */ diff --git a/include/linux/vmalloc.h b/include/linux/vmalloc.h index 924e502905..4b7ee83787 100644 --- a/include/linux/vmalloc.h +++ b/include/linux/vmalloc.h @@ -53,6 +53,7 @@ extern void vunmap(void *addr); extern int remap_vmalloc_range(struct vm_area_struct *vma, void *addr, unsigned long pgoff); +void vmalloc_sync_all(void); /* * Lowlevel-APIs (not for driver use!) diff --git a/kernel/Makefile b/kernel/Makefile index ac6b27abb1..642d4277c2 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 \ signal.o sys.o kmod.o workqueue.o pid.o \ rcupdate.o extable.o params.o posix-timers.o \ kthread.o wait.o kfifo.o sys_ni.o posix-cpu-timers.o mutex.o \ - hrtimer.o rwsem.o latency.o nsproxy.o srcu.o + hrtimer.o rwsem.o latency.o nsproxy.o srcu.o die_notifier.o obj-$(CONFIG_STACKTRACE) += stacktrace.o obj-y += time/ diff --git a/kernel/die_notifier.c b/kernel/die_notifier.c new file mode 100644 index 0000000000..0d98827887 --- /dev/null +++ b/kernel/die_notifier.c @@ -0,0 +1,38 @@ + +#include +#include +#include +#include + + +static ATOMIC_NOTIFIER_HEAD(die_chain); + +int notify_die(enum die_val val, const char *str, + struct pt_regs *regs, long err, int trap, int sig) +{ + struct die_args args = { + .regs = regs, + .str = str, + .err = err, + .trapnr = trap, + .signr = sig, + + }; + + return atomic_notifier_call_chain(&die_chain, val, &args); +} + +int register_die_notifier(struct notifier_block *nb) +{ + vmalloc_sync_all(); + return atomic_notifier_chain_register(&die_chain, nb); +} +EXPORT_SYMBOL_GPL(register_die_notifier); + +int unregister_die_notifier(struct notifier_block *nb) +{ + return atomic_notifier_chain_unregister(&die_chain, nb); +} +EXPORT_SYMBOL_GPL(unregister_die_notifier); + + diff --git a/kernel/kprobes.c b/kernel/kprobes.c index 6c86d67ed1..0207045b4f 100644 --- a/kernel/kprobes.c +++ b/kernel/kprobes.c @@ -42,10 +42,10 @@ #include #include #include +#include #include #include #include -#include #define KPROBE_HASH_BITS 6 #define KPROBE_TABLE_SIZE (1 << KPROBE_HASH_BITS) diff --git a/mm/nommu.c b/mm/nommu.c index 1f60194d9b..2b16b00a5b 100644 --- a/mm/nommu.c +++ b/mm/nommu.c @@ -261,6 +261,14 @@ void vunmap(void *addr) BUG(); } +/* + * Implement a stub for vmalloc_sync_all() if the architecture chose not to + * have one. + */ +void __attribute__((weak)) vmalloc_sync_all(void) +{ +} + /* * sys_brk() for the most part doesn't need the global kernel * lock, except when an application is doing something nasty diff --git a/mm/vmalloc.c b/mm/vmalloc.c index cb5aabda70..faa2a521de 100644 --- a/mm/vmalloc.c +++ b/mm/vmalloc.c @@ -755,3 +755,10 @@ out_einval_locked: } EXPORT_SYMBOL(remap_vmalloc_range); +/* + * Implement a stub for vmalloc_sync_all() if the architecture chose not to + * have one. + */ +void __attribute__((weak)) vmalloc_sync_all(void) +{ +}