Commit e3e8a75d2acfc61ebf25524666a0a2c6abb0620c

Authored by Kirill Korotaev
Committed by Linus Torvalds
1 parent cefc8be824

[PATCH] Extract and use wake_up_klogd()

Remove hack with printing space to wake up klogd.  Use explicit
wake_up_klogd().

See earlier discussion
http://groups.google.com/group/fa.linux.kernel/browse_frm/thread/75f496668409f58d/1a8f28983a51e1ff?lnk=st&q=wake_up_klogd+group%3Afa.linux.kernel&rnum=2#1a8f28983a51e1ff

Signed-off-by: Alexey Dobriyan <adobriyan@openvz.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

Showing 3 changed files with 10 additions and 11 deletions Side-by-side Diff

include/linux/kernel.h
... ... @@ -176,6 +176,7 @@
176 176 }
177 177  
178 178 extern void bust_spinlocks(int yes);
  179 +extern void wake_up_klogd(void);
179 180 extern int oops_in_progress; /* If set, an oops, panic(), BUG() or die() is in progress */
180 181 extern int panic_timeout;
181 182 extern int panic_on_oops;
... ... @@ -783,6 +783,12 @@
783 783 return console_locked;
784 784 }
785 785  
  786 +void wake_up_klogd(void)
  787 +{
  788 + if (!oops_in_progress && waitqueue_active(&log_wait))
  789 + wake_up_interruptible(&log_wait);
  790 +}
  791 +
786 792 /**
787 793 * release_console_sem - unlock the console system
788 794 *
... ... @@ -825,8 +831,8 @@
825 831 console_locked = 0;
826 832 up(&console_sem);
827 833 spin_unlock_irqrestore(&logbuf_lock, flags);
828   - if (wake_klogd && !oops_in_progress && waitqueue_active(&log_wait))
829   - wake_up_interruptible(&log_wait);
  834 + if (wake_klogd)
  835 + wake_up_klogd();
830 836 }
831 837 EXPORT_SYMBOL(release_console_sem);
832 838  
lib/bust_spinlocks.c
... ... @@ -19,19 +19,11 @@
19 19 if (yes) {
20 20 oops_in_progress = 1;
21 21 } else {
22   - int loglevel_save = console_loglevel;
23 22 #ifdef CONFIG_VT
24 23 unblank_screen();
25 24 #endif
26 25 oops_in_progress = 0;
27   - /*
28   - * OK, the message is on the console. Now we call printk()
29   - * without oops_in_progress set so that printk() will give klogd
30   - * and the blanked console a poke. Hold onto your hats...
31   - */
32   - console_loglevel = 15; /* NMI oopser may have shut the console up */
33   - printk(" ");
34   - console_loglevel = loglevel_save;
  26 + wake_up_klogd();
35 27 }
36 28 }