blob: f8e0e536739832bdd05df68647e373788c060fda [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
2 * lib/bust_spinlocks.c
3 *
4 * Provides a minimal bust_spinlocks for architectures which don't have one of their own.
5 *
6 * bust_spinlocks() clears any spinlocks which would prevent oops, die(), BUG()
7 * and panic() information from reaching the user.
8 */
9
Linus Torvalds1da177e2005-04-16 15:20:36 -070010#include <linux/kernel.h>
Frederic Weisbeckerdc72c322013-03-22 15:04:39 -070011#include <linux/printk.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070012#include <linux/spinlock.h>
13#include <linux/tty.h>
14#include <linux/wait.h>
15#include <linux/vt_kern.h>
Viktor Rosendahlb61312d2009-01-06 14:40:42 -080016#include <linux/console.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070017
18
Kirill Korotaevcefc8be2007-02-10 01:46:18 -080019void __attribute__((weak)) bust_spinlocks(int yes)
Linus Torvalds1da177e2005-04-16 15:20:36 -070020{
21 if (yes) {
Jan Beulich00442992007-10-16 23:29:33 -070022 ++oops_in_progress;
Linus Torvalds1da177e2005-04-16 15:20:36 -070023 } else {
Linus Torvalds1da177e2005-04-16 15:20:36 -070024#ifdef CONFIG_VT
25 unblank_screen();
26#endif
Viktor Rosendahlb61312d2009-01-06 14:40:42 -080027 console_unblank();
Jan Beulich00442992007-10-16 23:29:33 -070028 if (--oops_in_progress == 0)
29 wake_up_klogd();
Linus Torvalds1da177e2005-04-16 15:20:36 -070030 }
31}