]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - arch/x86/kernel/dumpstack_32.c
Merge git://git.kernel.org/pub/scm/linux/kernel/git/bart/ide-2.6
[linux-2.6-omap-h63xx.git] / arch / x86 / kernel / dumpstack_32.c
index 9a8920abe4ba7bc1a9eb1c127a9a9b54d0519df9..b3614752197b6c6e3c0cf53c7b718dd0167fbdea 100644 (file)
 #include <linux/kexec.h>
 #include <linux/bug.h>
 #include <linux/nmi.h>
+#include <linux/sysfs.h>
 
 #include <asm/stacktrace.h>
 
+#define STACKSLOTS_PER_LINE 8
+#define get_bp(bp) asm("movl %%ebp, %0" : "=r" (bp) :)
+
 int panic_on_unrecovered_nmi;
-int kstack_depth_to_print = 24;
+int kstack_depth_to_print = 3 * STACKSLOTS_PER_LINE;
 static unsigned int code_bytes = 64;
 static int die_counter;
 
@@ -82,7 +86,7 @@ void dump_trace(struct task_struct *task, struct pt_regs *regs,
        if (!stack) {
                unsigned long dummy;
                stack = &dummy;
-               if (task != current)
+               if (task && task != current)
                        stack = (unsigned long *)task->thread.sp;
        }
 
@@ -90,7 +94,7 @@ void dump_trace(struct task_struct *task, struct pt_regs *regs,
        if (!bp) {
                if (task == current) {
                        /* Grab bp right from our regs */
-                       asm("movl %%ebp, %0" : "=r" (bp) :);
+                       get_bp(bp);
                } else {
                        /* bp is the last reg pushed by switch_to */
                        bp = *(unsigned long *) task->thread.sp;
@@ -167,7 +171,7 @@ void show_trace(struct task_struct *task, struct pt_regs *regs,
 
 static void
 show_stack_log_lvl(struct task_struct *task, struct pt_regs *regs,
-                  unsigned long *sp, unsigned long bp, char *log_lvl)
+               unsigned long *sp, unsigned long bp, char *log_lvl)
 {
        unsigned long *stack;
        int i;
@@ -183,7 +187,7 @@ show_stack_log_lvl(struct task_struct *task, struct pt_regs *regs,
        for (i = 0; i < kstack_depth_to_print; i++) {
                if (kstack_end(stack))
                        break;
-               if (i && ((i % 8) == 0))
+               if (i && ((i % STACKSLOTS_PER_LINE) == 0))
                        printk("\n%s", log_lvl);
                printk(" %08lx", *stack++);
                touch_nmi_watchdog();
@@ -207,7 +211,7 @@ void dump_stack(void)
 
 #ifdef CONFIG_FRAME_POINTER
        if (!bp)
-               asm("movl %%ebp, %0" : "=r" (bp):);
+               get_bp(bp);
 #endif
 
        printk("Pid: %d, comm: %.20s %s %s %.*s\n",
@@ -215,8 +219,7 @@ void dump_stack(void)
                init_utsname()->release,
                (int)strcspn(init_utsname()->version, " "),
                init_utsname()->version);
-
-       show_trace(current, NULL, &stack, bp);
+       show_trace(NULL, NULL, &stack, bp);
 }
 
 EXPORT_SYMBOL(dump_stack);
@@ -249,7 +252,7 @@ void show_registers(struct pt_regs *regs)
 
                ip = (u8 *)regs->ip - code_prologue;
                if (ip < (u8 *)PAGE_OFFSET || probe_kernel_address(ip, c)) {
-                       /* try starting at EIP */
+                       /* try starting at IP */
                        ip = (u8 *)regs->ip;
                        code_len = code_len - code_prologue + 1;
                }
@@ -317,13 +320,10 @@ void __kprobes oops_end(unsigned long flags, struct pt_regs *regs, int signr)
 
        if (kexec_should_crash(current))
                crash_kexec(regs);
-
        if (in_interrupt())
                panic("Fatal exception in interrupt");
-
        if (panic_on_oops)
                panic("Fatal exception");
-
        oops_exit();
        do_exit(signr);
 }
@@ -344,6 +344,7 @@ int __kprobes __die(const char *str, struct pt_regs *regs, long err)
        printk("DEBUG_PAGEALLOC");
 #endif
        printk("\n");
+       sysfs_printk_last_file();
        if (notify_die(DIE_OOPS, str, regs, err,
                        current->thread.trap_no, SIGSEGV) == NOTIFY_STOP)
                return 1;
@@ -404,7 +405,6 @@ die_nmi(char *str, struct pt_regs *regs, int do_panic)
                panic("Non maskable interrupt");
        console_silent();
        spin_unlock(&nmi_print_lock);
-       bust_spinlocks(0);
 
        /*
         * If we are in kernel we are probably nested up pretty bad
@@ -415,6 +415,7 @@ die_nmi(char *str, struct pt_regs *regs, int do_panic)
                crash_kexec(regs);
        }
 
+       bust_spinlocks(0);
        do_exit(SIGSEGV);
 }