Commit 004429956b4875e6bc2a31833f75363ce48cbea9

Authored by Jan Beulich
Committed by Linus Torvalds
1 parent b311e921b3

handle recursive calls to bust_spinlocks()

Various architectures may call bust_spinlocks() recursively; the function
itself, however, doesn't appear to be meant to be called in this manner.
Nevertheless, this doesn't appear to be a problem as long as
bust_spinlocks(0) doesn't get called twice in a row (otherwise,
unblank_screen() may enter the scheduler).  However, at least on i386 die()
has been capable of returning (and on other architectures this should
really be that way, too) when notify_die() returns NOTIFY_STOP.

Short of getting a reply to a respective query, this patch makes
bust_spinlocks() increment/decrement oops_in_progress, and wake klogd only
when the count drops back to zero.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

Showing 1 changed file with 3 additions and 3 deletions Inline Diff

lib/bust_spinlocks.c
1 /* 1 /*
2 * lib/bust_spinlocks.c 2 * lib/bust_spinlocks.c
3 * 3 *
4 * Provides a minimal bust_spinlocks for architectures which don't have one of their own. 4 * Provides a minimal bust_spinlocks for architectures which don't have one of their own.
5 * 5 *
6 * bust_spinlocks() clears any spinlocks which would prevent oops, die(), BUG() 6 * bust_spinlocks() clears any spinlocks which would prevent oops, die(), BUG()
7 * and panic() information from reaching the user. 7 * and panic() information from reaching the user.
8 */ 8 */
9 9
10 #include <linux/kernel.h> 10 #include <linux/kernel.h>
11 #include <linux/spinlock.h> 11 #include <linux/spinlock.h>
12 #include <linux/tty.h> 12 #include <linux/tty.h>
13 #include <linux/wait.h> 13 #include <linux/wait.h>
14 #include <linux/vt_kern.h> 14 #include <linux/vt_kern.h>
15 15
16 16
17 void __attribute__((weak)) bust_spinlocks(int yes) 17 void __attribute__((weak)) bust_spinlocks(int yes)
18 { 18 {
19 if (yes) { 19 if (yes) {
20 oops_in_progress = 1; 20 ++oops_in_progress;
21 } else { 21 } else {
22 #ifdef CONFIG_VT 22 #ifdef CONFIG_VT
23 unblank_screen(); 23 unblank_screen();
24 #endif 24 #endif
25 oops_in_progress = 0; 25 if (--oops_in_progress == 0)
26 wake_up_klogd(); 26 wake_up_klogd();
27 } 27 }
28 } 28 }
29 29
30 30
31 31