Commit d18bbc21 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

kernel/printk/printk.c: revert "printk: enable interrupts before calling...

kernel/printk/printk.c: revert "printk: enable interrupts before calling console_trylock_for_printk()"

Revert commit 939f04be ("printk: enable interrupts before calling
console_trylock_for_printk()").

Andreas reported:

: None of the post 3.15 kernel boot for me. They all hang at the GRUB
: screen telling me it loaded and started the kernel, but the kernel
: itself stops before it prints anything (or even replaces the GRUB
: background graphics).

939f04be is modest latency reduction.  Revert it until we understand
the reason for these failures.
Reported-by: default avatarAndreas Bombe <aeb@debian.org>
Cc: Jan Kara <jack@suse.cz>
Cc: Steven Rostedt <rostedt@goodmis.org>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent e84f1ab3
...@@ -1416,9 +1416,10 @@ static int have_callable_console(void) ...@@ -1416,9 +1416,10 @@ static int have_callable_console(void)
/* /*
* Can we actually use the console at this time on this cpu? * Can we actually use the console at this time on this cpu?
* *
* Console drivers may assume that per-cpu resources have been allocated. So * Console drivers may assume that per-cpu resources have
* unless they're explicitly marked as being able to cope (CON_ANYTIME) don't * been allocated. So unless they're explicitly marked as
* call them until this CPU is officially up. * being able to cope (CON_ANYTIME) don't call them until
* this CPU is officially up.
*/ */
static inline int can_use_console(unsigned int cpu) static inline int can_use_console(unsigned int cpu)
{ {
...@@ -1431,10 +1432,8 @@ static inline int can_use_console(unsigned int cpu) ...@@ -1431,10 +1432,8 @@ static inline int can_use_console(unsigned int cpu)
* console_lock held, and 'console_locked' set) if it * console_lock held, and 'console_locked' set) if it
* is successful, false otherwise. * is successful, false otherwise.
*/ */
static int console_trylock_for_printk(void) static int console_trylock_for_printk(unsigned int cpu)
{ {
unsigned int cpu = smp_processor_id();
if (!console_trylock()) if (!console_trylock())
return 0; return 0;
/* /*
...@@ -1609,8 +1608,7 @@ asmlinkage int vprintk_emit(int facility, int level, ...@@ -1609,8 +1608,7 @@ asmlinkage int vprintk_emit(int facility, int level,
*/ */
if (!oops_in_progress && !lockdep_recursing(current)) { if (!oops_in_progress && !lockdep_recursing(current)) {
recursion_bug = 1; recursion_bug = 1;
local_irq_restore(flags); goto out_restore_irqs;
return 0;
} }
zap_locks(); zap_locks();
} }
...@@ -1718,27 +1716,21 @@ asmlinkage int vprintk_emit(int facility, int level, ...@@ -1718,27 +1716,21 @@ asmlinkage int vprintk_emit(int facility, int level,
logbuf_cpu = UINT_MAX; logbuf_cpu = UINT_MAX;
raw_spin_unlock(&logbuf_lock); raw_spin_unlock(&logbuf_lock);
lockdep_on();
local_irq_restore(flags);
/* If called from the scheduler, we can not call up(). */ /* If called from the scheduler, we can not call up(). */
if (in_sched) if (!in_sched) {
return printed_len;
/* /*
* Disable preemption to avoid being preempted while holding * Try to acquire and then immediately release the console
* console_sem which would prevent anyone from printing to console * semaphore. The release will print out buffers and wake up
* /dev/kmsg and syslog() users.
*/ */
preempt_disable(); if (console_trylock_for_printk(this_cpu))
/*
* Try to acquire and then immediately release the console semaphore.
* The release will print out buffers and wake up /dev/kmsg and syslog()
* users.
*/
if (console_trylock_for_printk())
console_unlock(); console_unlock();
preempt_enable(); }
lockdep_on();
out_restore_irqs:
local_irq_restore(flags);
return printed_len; return printed_len;
} }
EXPORT_SYMBOL(vprintk_emit); EXPORT_SYMBOL(vprintk_emit);
......
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