Merge branch 'for-davem' of git://git.kernel.org/pub/scm/linux/kernel/git/linville...
[pandora-kernel.git] / kernel / printk.c
index 7982a0a..32690a0 100644 (file)
@@ -199,7 +199,7 @@ void __init setup_log_buf(int early)
                unsigned long mem;
 
                mem = memblock_alloc(new_log_buf_len, PAGE_SIZE);
-               if (mem == MEMBLOCK_ERROR)
+               if (!mem)
                        return;
                new_log_buf = __va(mem);
        } else {
@@ -521,7 +521,7 @@ static void __call_console_drivers(unsigned start, unsigned end)
        }
 }
 
-static int __read_mostly ignore_loglevel;
+static bool __read_mostly ignore_loglevel;
 
 static int __init ignore_loglevel_setup(char *str)
 {
@@ -532,7 +532,7 @@ static int __init ignore_loglevel_setup(char *str)
 }
 
 early_param("ignore_loglevel", ignore_loglevel_setup);
-module_param_named(ignore_loglevel, ignore_loglevel, bool, S_IRUGO | S_IWUSR);
+module_param(ignore_loglevel, bool, S_IRUGO | S_IWUSR);
 MODULE_PARM_DESC(ignore_loglevel, "ignore loglevel setting, to"
        "print all kernel messages to the console.");
 
@@ -688,6 +688,7 @@ static void zap_locks(void)
 
        oops_timestamp = jiffies;
 
+       debug_locks_off();
        /* If a crash is occurring, make sure we can't deadlock */
        raw_spin_lock_init(&logbuf_lock);
        /* And make sure that we print immediately */
@@ -695,12 +696,15 @@ static void zap_locks(void)
 }
 
 #if defined(CONFIG_PRINTK_TIME)
-static int printk_time = 1;
+static bool printk_time = 1;
 #else
-static int printk_time = 0;
+static bool printk_time = 0;
 #endif
 module_param_named(time, printk_time, bool, S_IRUGO | S_IWUSR);
 
+static bool always_kmsg_dump;
+module_param_named(always_kmsg_dump, always_kmsg_dump, bool, S_IRUGO | S_IWUSR);
+
 /* Check if we have any console registered that can be called early in boot. */
 static int have_callable_console(void)
 {
@@ -840,9 +844,8 @@ asmlinkage int vprintk(const char *fmt, va_list args)
        boot_delay_msec();
        printk_delay();
 
-       preempt_disable();
        /* This stops the holder of console_sem just where we want him */
-       raw_local_irq_save(flags);
+       local_irq_save(flags);
        this_cpu = smp_processor_id();
 
        /*
@@ -856,7 +859,7 @@ asmlinkage int vprintk(const char *fmt, va_list args)
                 * recursion and return - but flag the recursion so that
                 * it can be printed at the next appropriate moment:
                 */
-               if (!oops_in_progress) {
+               if (!oops_in_progress && !lockdep_recursing(current)) {
                        recursion_bug = 1;
                        goto out_restore_irqs;
                }
@@ -962,9 +965,8 @@ asmlinkage int vprintk(const char *fmt, va_list args)
 
        lockdep_on();
 out_restore_irqs:
-       raw_local_irq_restore(flags);
+       local_irq_restore(flags);
 
-       preempt_enable();
        return printed_len;
 }
 EXPORT_SYMBOL(printk);
@@ -1099,7 +1101,7 @@ int update_console_cmdline(char *name, int idx, char *name_new, int idx_new, cha
        return -1;
 }
 
-int console_suspend_enabled = 1;
+bool console_suspend_enabled = 1;
 EXPORT_SYMBOL(console_suspend_enabled);
 
 static int __init console_suspend_disable(char *str)
@@ -1733,6 +1735,9 @@ void kmsg_dump(enum kmsg_dump_reason reason)
        unsigned long l1, l2;
        unsigned long flags;
 
+       if ((reason > KMSG_DUMP_OOPS) && !always_kmsg_dump)
+               return;
+
        /* Theoretically, the log could move on after we do this, but
           there's not a lot we can do about that. The new messages
           will overwrite the start of what we dump. */