Commit 1eeb66a1 authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Linus Torvalds
Browse files

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: default avatarChristoph Hellwig <hch@lst.de>
Cc: <linux-arch@vger.kernel.org>
Cc: Russell King <rmk@arm.linux.org.uk>
Signed-off-by: default avatarBryan Wu <bryan.wu@analog.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent e3869792
...@@ -245,8 +245,8 @@ NORET_TYPE void die(const char *str, struct pt_regs *regs, int err) ...@@ -245,8 +245,8 @@ NORET_TYPE void die(const char *str, struct pt_regs *regs, int err)
do_exit(SIGSEGV); do_exit(SIGSEGV);
} }
void notify_die(const char *str, struct pt_regs *regs, struct siginfo *info, void arm_notify_die(const char *str, struct pt_regs *regs,
unsigned long err, unsigned long trap) struct siginfo *info, unsigned long err, unsigned long trap)
{ {
if (user_mode(regs)) { if (user_mode(regs)) {
current->thread.error_code = err; current->thread.error_code = err;
...@@ -330,7 +330,7 @@ asmlinkage void __exception do_undefinstr(struct pt_regs *regs) ...@@ -330,7 +330,7 @@ asmlinkage void __exception do_undefinstr(struct pt_regs *regs)
info.si_code = ILL_ILLOPC; info.si_code = ILL_ILLOPC;
info.si_addr = pc; 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) asmlinkage void do_unexp_fiq (struct pt_regs *regs)
...@@ -384,7 +384,7 @@ static int bad_syscall(int n, 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) - info.si_addr = (void __user *)instruction_pointer(regs) -
(thumb_mode(regs) ? 2 : 4); (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; return regs->ARM_r0;
} }
...@@ -428,7 +428,7 @@ asmlinkage int arm_syscall(int no, struct pt_regs *regs) ...@@ -428,7 +428,7 @@ asmlinkage int arm_syscall(int no, struct pt_regs *regs)
info.si_code = SEGV_MAPERR; info.si_code = SEGV_MAPERR;
info.si_addr = NULL; 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; return 0;
case NR(breakpoint): /* SWI BREAK_POINT */ case NR(breakpoint): /* SWI BREAK_POINT */
...@@ -564,7 +564,7 @@ asmlinkage int arm_syscall(int no, struct pt_regs *regs) ...@@ -564,7 +564,7 @@ asmlinkage int arm_syscall(int no, struct pt_regs *regs)
info.si_addr = (void __user *)instruction_pointer(regs) - info.si_addr = (void __user *)instruction_pointer(regs) -
(thumb_mode(regs) ? 2 : 4); (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; return 0;
} }
...@@ -638,7 +638,7 @@ baddataabort(int code, unsigned long instr, struct pt_regs *regs) ...@@ -638,7 +638,7 @@ baddataabort(int code, unsigned long instr, struct pt_regs *regs)
info.si_code = ILL_ILLOPC; info.si_code = ILL_ILLOPC;
info.si_addr = (void __user *)addr; 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) void __attribute__((noreturn)) __bug(const char *file, int line)
......
...@@ -453,7 +453,7 @@ do_DataAbort(unsigned long addr, unsigned int fsr, struct pt_regs *regs) ...@@ -453,7 +453,7 @@ do_DataAbort(unsigned long addr, unsigned int fsr, struct pt_regs *regs)
info.si_errno = 0; info.si_errno = 0;
info.si_code = inf->code; info.si_code = inf->code;
info.si_addr = (void __user *)addr; info.si_addr = (void __user *)addr;
notify_die("", regs, &info, fsr, 0); arm_notify_die("", regs, &info, fsr, 0);
} }
asmlinkage void __exception asmlinkage void __exception
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
#include <linux/ptrace.h> #include <linux/ptrace.h>
#include <asm/cacheflush.h> #include <asm/cacheflush.h>
#include <asm/kdebug.h> #include <linux/kdebug.h>
#include <asm/ocd.h> #include <asm/ocd.h>
DEFINE_PER_CPU(struct kprobe *, current_kprobe); DEFINE_PER_CPU(struct kprobe *, current_kprobe);
......
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
#include <asm/uaccess.h> #include <asm/uaccess.h>
#include <asm/ocd.h> #include <asm/ocd.h>
#include <asm/mmu_context.h> #include <asm/mmu_context.h>
#include <asm/kdebug.h> #include <linux/kdebug.h>
static struct pt_regs *get_user_regs(struct task_struct *tsk) static struct pt_regs *get_user_regs(struct task_struct *tsk)
{ {
...@@ -300,7 +300,7 @@ asmlinkage void do_debug_priv(struct pt_regs *regs) ...@@ -300,7 +300,7 @@ asmlinkage void do_debug_priv(struct pt_regs *regs)
else else
die_val = DIE_BREAKPOINT; 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; return;
if (likely(ds & DS_SSS)) { if (likely(ds & DS_SSS)) {
......
...@@ -20,20 +20,6 @@ ...@@ -20,20 +20,6 @@
#include <asm/sysreg.h> #include <asm/sysreg.h>
#include <asm/traps.h> #include <asm/traps.h>
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); static DEFINE_SPINLOCK(die_lock);
void NORET_TYPE die(const char *str, struct pt_regs *regs, long err) void NORET_TYPE die(const char *str, struct pt_regs *regs, long err)
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
#include <linux/module.h> #include <linux/module.h>
#include <linux/pagemap.h> #include <linux/pagemap.h>
#include <asm/kdebug.h> #include <linux/kdebug.h>
#include <asm/mmu_context.h> #include <asm/mmu_context.h>
#include <asm/sysreg.h> #include <asm/sysreg.h>
#include <asm/tlb.h> #include <asm/tlb.h>
......
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
#include <asm/nmi.h> #include <asm/nmi.h>
#include <asm/hw_irq.h> #include <asm/hw_irq.h>
#include <asm/apic.h> #include <asm/apic.h>
#include <asm/kdebug.h> #include <linux/kdebug.h>
#include <asm/smp.h> #include <asm/smp.h>
#include <mach_ipi.h> #include <mach_ipi.h>
......
...@@ -31,8 +31,8 @@ ...@@ -31,8 +31,8 @@
#include <linux/kprobes.h> #include <linux/kprobes.h>
#include <linux/ptrace.h> #include <linux/ptrace.h>
#include <linux/preempt.h> #include <linux/preempt.h>
#include <linux/kdebug.h>
#include <asm/cacheflush.h> #include <asm/cacheflush.h>
#include <asm/kdebug.h>
#include <asm/desc.h> #include <asm/desc.h>
#include <asm/uaccess.h> #include <asm/uaccess.h>
......
...@@ -23,10 +23,10 @@ ...@@ -23,10 +23,10 @@
#include <linux/kprobes.h> #include <linux/kprobes.h>
#include <linux/cpumask.h> #include <linux/cpumask.h>
#include <linux/kernel_stat.h> #include <linux/kernel_stat.h>
#include <linux/kdebug.h>
#include <asm/smp.h> #include <asm/smp.h>
#include <asm/nmi.h> #include <asm/nmi.h>
#include <asm/kdebug.h>
#include "mach_traps.h" #include "mach_traps.h"
......
...@@ -52,7 +52,7 @@ ...@@ -52,7 +52,7 @@
#include <asm/unwind.h> #include <asm/unwind.h>
#include <asm/smp.h> #include <asm/smp.h>
#include <asm/arch_hooks.h> #include <asm/arch_hooks.h>
#include <asm/kdebug.h> #include <linux/kdebug.h>
#include <asm/stacktrace.h> #include <asm/stacktrace.h>
#include <linux/module.h> #include <linux/module.h>
...@@ -95,20 +95,6 @@ asmlinkage void machine_check(void); ...@@ -95,20 +95,6 @@ asmlinkage void machine_check(void);
int kstack_depth_to_print = 24; int kstack_depth_to_print = 24;
static unsigned int code_bytes = 64; 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) static inline int valid_stack_ptr(struct thread_info *tinfo, void *p)
{ {
......
...@@ -21,13 +21,14 @@ ...@@ -21,13 +21,14 @@
#include <linux/vt_kern.h> /* For unblank_screen() */ #include <linux/vt_kern.h> /* For unblank_screen() */
#include <linux/highmem.h> #include <linux/highmem.h>
#include <linux/bootmem.h> /* for max_low_pfn */ #include <linux/bootmem.h> /* for max_low_pfn */
#include <linux/vmalloc.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/kprobes.h> #include <linux/kprobes.h>
#include <linux/uaccess.h> #include <linux/uaccess.h>
#include <linux/kdebug.h>
#include <asm/system.h> #include <asm/system.h>
#include <asm/desc.h> #include <asm/desc.h>
#include <asm/kdebug.h>
#include <asm/segment.h> #include <asm/segment.h>
extern void die(const char *,struct pt_regs *,long); extern void die(const char *,struct pt_regs *,long);
......
...@@ -14,10 +14,10 @@ ...@@ -14,10 +14,10 @@
#include <linux/sysdev.h> #include <linux/sysdev.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/moduleparam.h> #include <linux/moduleparam.h>
#include <linux/kdebug.h>
#include <asm/nmi.h> #include <asm/nmi.h>
#include <asm/msr.h> #include <asm/msr.h>
#include <asm/apic.h> #include <asm/apic.h>
#include <asm/kdebug.h>
#include "op_counter.h" #include "op_counter.h"
#include "op_x86_model.h" #include "op_x86_model.h"
......
...@@ -12,12 +12,11 @@ ...@@ -12,12 +12,11 @@
#include <linux/errno.h> #include <linux/errno.h>
#include <linux/oprofile.h> #include <linux/oprofile.h>
#include <linux/rcupdate.h> #include <linux/rcupdate.h>
#include <linux/kdebug.h>
#include <asm/nmi.h> #include <asm/nmi.h>
#include <asm/apic.h> #include <asm/apic.h>
#include <asm/ptrace.h> #include <asm/ptrace.h>
#include <asm/kdebug.h>
static int profile_timer_exceptions_notify(struct notifier_block *self, static int profile_timer_exceptions_notify(struct notifier_block *self,
unsigned long val, void *data) unsigned long val, void *data)
......
...@@ -16,8 +16,8 @@ ...@@ -16,8 +16,8 @@
#include <linux/elfcore.h> #include <linux/elfcore.h>
#include <linux/sysctl.h> #include <linux/sysctl.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/kdebug.h>
#include <asm/kdebug.h>
#include <asm/mca.h> #include <asm/mca.h>
int kdump_status[NR_CPUS]; int kdump_status[NR_CPUS];
......
...@@ -29,9 +29,9 @@ ...@@ -29,9 +29,9 @@
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/preempt.h> #include <linux/preempt.h>
#include <linux/moduleloader.h> #include <linux/moduleloader.h>
#include <linux/kdebug.h>
#include <asm/pgtable.h> #include <asm/pgtable.h>
#include <asm/kdebug.h>
#include <asm/sections.h> #include <asm/sections.h>
#include <asm/uaccess.h> #include <asm/uaccess.h>
......
...@@ -72,9 +72,9 @@ ...@@ -72,9 +72,9 @@
#include <linux/smp.h> #include <linux/smp.h>
#include <linux/workqueue.h> #include <linux/workqueue.h>
#include <linux/cpumask.h> #include <linux/cpumask.h>
#include <linux/kdebug.h>
#include <asm/delay.h> #include <asm/delay.h>
#include <asm/kdebug.h>
#include <asm/machvec.h> #include <asm/machvec.h>
#include <asm/meminit.h> #include <asm/meminit.h>
#include <asm/page.h> #include <asm/page.h>
......
...@@ -27,13 +27,13 @@ ...@@ -27,13 +27,13 @@
#include <linux/efi.h> #include <linux/efi.h>
#include <linux/interrupt.h> #include <linux/interrupt.h>
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/kdebug.h>
#include <asm/cpu.h> #include <asm/cpu.h>
#include <asm/delay.h> #include <asm/delay.h>
#include <asm/elf.h> #include <asm/elf.h>
#include <asm/ia32.h> #include <asm/ia32.h>
#include <asm/irq.h> #include <asm/irq.h>
#include <asm/kdebug.h>
#include <asm/kexec.h> #include <asm/kexec.h>
#include <asm/pgalloc.h> #include <asm/pgalloc.h>
#include <asm/processor.h> #include <asm/processor.h>
......
...@@ -16,33 +16,17 @@ ...@@ -16,33 +16,17 @@
#include <linux/hardirq.h> #include <linux/hardirq.h>
#include <linux/kprobes.h> #include <linux/kprobes.h>
#include <linux/delay.h> /* for ssleep() */ #include <linux/delay.h> /* for ssleep() */
#include <linux/kdebug.h>
#include <asm/fpswa.h> #include <asm/fpswa.h>
#include <asm/ia32.h> #include <asm/ia32.h>
#include <asm/intrinsics.h> #include <asm/intrinsics.h>
#include <asm/processor.h> #include <asm/processor.h>
#include <asm/uaccess.h> #include <asm/uaccess.h>
#include <asm/kdebug.h>
fpswa_interface_t *fpswa_interface; fpswa_interface_t *fpswa_interface;
EXPORT_SYMBOL(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 void __init
trap_init (void) trap_init (void)
{ {
......
...@@ -10,12 +10,12 @@ ...@@ -10,12 +10,12 @@
#include <linux/smp_lock.h> #include <linux/smp_lock.h>
#include <linux/interrupt.h> #include <linux/interrupt.h>
#include <linux/kprobes.h> #include <linux/kprobes.h>
#include <linux/kdebug.h>
#include <asm/pgtable.h> #include <asm/pgtable.h>
#include <asm/processor.h> #include <asm/processor.h>
#include <asm/system.h> #include <asm/system.h>
#include <asm/uaccess.h> #include <asm/uaccess.h>
#include <asm/kdebug.h>
extern void die (char *, struct pt_regs *, long); extern void die (char *, struct pt_regs *, long);
......
...@@ -55,9 +55,9 @@ ...@@ -55,9 +55,9 @@
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/reboot.h> #include <linux/reboot.h>
#include <linux/completion.h> #include <linux/completion.h>
#include <linux/kdebug.h>
#include <asm/sn/intr.h> #include <asm/sn/intr.h>
#include <asm/sn/sn_sal.h> #include <asm/sn/sn_sal.h>
#include <asm/kdebug.h>
#include <asm/uaccess.h> #include <asm/uaccess.h>
#include <asm/sn/xpc.h> #include <asm/sn/xpc.h>
...@@ -1332,7 +1332,7 @@ xpc_init(void) ...@@ -1332,7 +1332,7 @@ xpc_init(void)
dev_warn(xpc_part, "can't register reboot notifier\n"); 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); ret = register_die_notifier(&xpc_die_notifier);
if (ret != 0) { if (ret != 0) {
dev_warn(xpc_part, "can't register die notifier\n"); dev_warn(xpc_part, "can't register die notifier\n");
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment