From cefc8be82403cfc4325e7b9b063f77dc0f34e19e Mon Sep 17 00:00:00 2001 From: Kirill Korotaev Date: Sat, 10 Feb 2007 01:46:18 -0800 Subject: [PATCH] [PATCH] Consolidate bust_spinlocks() Part of long forgotten patch http://groups.google.com/group/fa.linux.kernel/msg/e98e941ce1cf29f6?dmode=source Since then, m32r grabbed two copies. Leave s390 copy because of important absence of CONFIG_VT, but remove references to non-existent timerlist_lock. ia64 also loses timerlist_lock. Signed-off-by: Alexey Dobriyan Acked-by: Martin Schwidefsky Cc: Andi Kleen Cc: "Luck, Tony" Cc: Hirokazu Takata Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- arch/i386/mm/fault.c | 26 -------------------------- arch/ia64/kernel/traps.c | 30 ------------------------------ arch/m32r/mm/fault-nommu.c | 26 -------------------------- arch/m32r/mm/fault.c | 26 -------------------------- arch/s390/mm/fault.c | 4 +--- arch/x86_64/mm/fault.c | 21 --------------------- lib/Makefile | 5 +++-- lib/bust_spinlocks.c | 2 +- 8 files changed, 5 insertions(+), 135 deletions(-) diff --git a/arch/i386/mm/fault.c b/arch/i386/mm/fault.c index aaaa4d225f7e..cba9b3894a33 100644 --- a/arch/i386/mm/fault.c +++ b/arch/i386/mm/fault.c @@ -59,32 +59,6 @@ static inline int notify_page_fault(enum die_val val, const char *str, return atomic_notifier_call_chain(¬ify_page_fault_chain, val, &args); } -/* - * Unlock any spinlocks which will prevent us from getting the - * message out - */ -void bust_spinlocks(int yes) -{ - int loglevel_save = console_loglevel; - - if (yes) { - oops_in_progress = 1; - return; - } -#ifdef CONFIG_VT - unblank_screen(); -#endif - oops_in_progress = 0; - /* - * OK, the message is on the console. Now we call printk() - * without oops_in_progress set so that printk will give klogd - * a poke. Hold onto your hats... - */ - console_loglevel = 15; /* NMI oopser may have shut the console up */ - printk(" "); - console_loglevel = loglevel_save; -} - /* * Return EIP plus the CS segment base. The segment limit is also * adjusted, clamped to the kernel/user address space (whichever is diff --git a/arch/ia64/kernel/traps.c b/arch/ia64/kernel/traps.c index ab684747036f..765cbe5ba6ae 100644 --- a/arch/ia64/kernel/traps.c +++ b/arch/ia64/kernel/traps.c @@ -24,8 +24,6 @@ #include #include -extern spinlock_t timerlist_lock; - fpswa_interface_t *fpswa_interface; EXPORT_SYMBOL(fpswa_interface); @@ -53,34 +51,6 @@ trap_init (void) fpswa_interface = __va(ia64_boot_param->fpswa); } -/* - * Unlock any spinlocks which will prevent us from getting the message out (timerlist_lock - * is acquired through the console unblank code) - */ -void -bust_spinlocks (int yes) -{ - int loglevel_save = console_loglevel; - - if (yes) { - oops_in_progress = 1; - return; - } - -#ifdef CONFIG_VT - unblank_screen(); -#endif - oops_in_progress = 0; - /* - * OK, the message is on the console. Now we call printk() without - * oops_in_progress set so that printk will give klogd a poke. Hold onto - * your hats... - */ - console_loglevel = 15; /* NMI oopser may have shut the console up */ - printk(" "); - console_loglevel = loglevel_save; -} - void die (const char *str, struct pt_regs *regs, long err) { diff --git a/arch/m32r/mm/fault-nommu.c b/arch/m32r/mm/fault-nommu.c index 0a09cc01212b..9880abac3f54 100644 --- a/arch/m32r/mm/fault-nommu.c +++ b/arch/m32r/mm/fault-nommu.c @@ -44,32 +44,6 @@ unsigned int tlb_entry_d_dat[NR_CPUS]; #define tlb_entry_d tlb_entry_d_dat[smp_processor_id()] #endif -/* - * Unlock any spinlocks which will prevent us from getting the - * message out - */ -void bust_spinlocks(int yes) -{ - int loglevel_save = console_loglevel; - - if (yes) { - oops_in_progress = 1; - return; - } -#ifdef CONFIG_VT - unblank_screen(); -#endif - oops_in_progress = 0; - /* - * OK, the message is on the console. Now we call printk() - * without oops_in_progress set so that printk will give klogd - * a poke. Hold onto your hats... - */ - console_loglevel = 15; /* NMI oopser may have shut the console up */ - printk(" "); - console_loglevel = loglevel_save; -} - void do_BUG(const char *file, int line) { bust_spinlocks(1); diff --git a/arch/m32r/mm/fault.c b/arch/m32r/mm/fault.c index fc7ccdf829e2..037d58e82fb5 100644 --- a/arch/m32r/mm/fault.c +++ b/arch/m32r/mm/fault.c @@ -49,32 +49,6 @@ unsigned int tlb_entry_d_dat[NR_CPUS]; extern void init_tlb(void); -/* - * Unlock any spinlocks which will prevent us from getting the - * message out - */ -void bust_spinlocks(int yes) -{ - int loglevel_save = console_loglevel; - - if (yes) { - oops_in_progress = 1; - return; - } -#ifdef CONFIG_VT - unblank_screen(); -#endif - oops_in_progress = 0; - /* - * OK, the message is on the console. Now we call printk() - * without oops_in_progress set so that printk will give klogd - * a poke. Hold onto your hats... - */ - console_loglevel = 15; /* NMI oopser may have shut the console up */ - printk(" "); - console_loglevel = loglevel_save; -} - /*======================================================================* * do_page_fault() *======================================================================* diff --git a/arch/s390/mm/fault.c b/arch/s390/mm/fault.c index 9ff143e87746..641aef36ccc4 100644 --- a/arch/s390/mm/fault.c +++ b/arch/s390/mm/fault.c @@ -83,12 +83,10 @@ static inline int notify_page_fault(enum die_val val, const char *str, } #endif -extern spinlock_t timerlist_lock; /* * Unlock any spinlocks which will prevent us from getting the - * message out (timerlist_lock is acquired through the - * console unblank code) + * message out. */ void bust_spinlocks(int yes) { diff --git a/arch/x86_64/mm/fault.c b/arch/x86_64/mm/fault.c index a65fc6f1dcaf..49e8cf2e06f8 100644 --- a/arch/x86_64/mm/fault.c +++ b/arch/x86_64/mm/fault.c @@ -69,27 +69,6 @@ static inline int notify_page_fault(enum die_val val, const char *str, return atomic_notifier_call_chain(¬ify_page_fault_chain, val, &args); } -void bust_spinlocks(int yes) -{ - int loglevel_save = console_loglevel; - if (yes) { - oops_in_progress = 1; - } else { -#ifdef CONFIG_VT - unblank_screen(); -#endif - oops_in_progress = 0; - /* - * OK, the message is on the console. Now we call printk() - * without oops_in_progress set so that printk will give klogd - * a poke. Hold onto your hats... - */ - console_loglevel = 15; /* NMI oopser may have shut the console up */ - printk(" "); - console_loglevel = loglevel_save; - } -} - /* Sometimes the CPU reports invalid exceptions on prefetch. Check that here and ignore. Opcode checker based on code by Richard Brunner */ diff --git a/lib/Makefile b/lib/Makefile index 3b605da448f4..b819e37440db 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -3,7 +3,7 @@ # lib-y := ctype.o string.o vsprintf.o cmdline.o \ - bust_spinlocks.o rbtree.o radix-tree.o dump_stack.o \ + rbtree.o radix-tree.o dump_stack.o \ idr.o div64.o int_sqrt.o bitmap.o extable.o prio_tree.o \ sha1.o irq_regs.o reciprocal_div.o @@ -12,7 +12,8 @@ lib-$(CONFIG_SMP) += cpumask.o lib-y += kobject.o kref.o kobject_uevent.o klist.o -obj-y += sort.o parser.o halfmd4.o debug_locks.o random32.o iomap.o +obj-y += sort.o parser.o halfmd4.o debug_locks.o random32.o iomap.o \ + bust_spinlocks.o ifeq ($(CONFIG_DEBUG_KOBJECT),y) CFLAGS_kobject.o += -DDEBUG diff --git a/lib/bust_spinlocks.c b/lib/bust_spinlocks.c index a2055bc3ef62..0ee968e8e023 100644 --- a/lib/bust_spinlocks.c +++ b/lib/bust_spinlocks.c @@ -14,7 +14,7 @@ #include -void bust_spinlocks(int yes) +void __attribute__((weak)) bust_spinlocks(int yes) { if (yes) { oops_in_progress = 1;