blob: 8be59f84eaeaf495e9dcf6b3ca049ab360f04753 [file] [log] [blame]
Greg Kroah-Hartmanb2441312017-11-01 15:07:57 +01001// SPDX-License-Identifier: GPL-2.0
Linus Torvalds1da177e2005-04-16 15:20:36 -07002/*
3 * lib/bust_spinlocks.c
4 *
Sergey Senozhatsky5b39fc042018-10-25 16:05:43 +09005 * Provides a minimal bust_spinlocks for architectures which don't
6 * have one of their own.
Linus Torvalds1da177e2005-04-16 15:20:36 -07007 *
8 * bust_spinlocks() clears any spinlocks which would prevent oops, die(), BUG()
9 * and panic() information from reaching the user.
10 */
11
Linus Torvalds1da177e2005-04-16 15:20:36 -070012#include <linux/kernel.h>
Frederic Weisbeckerdc72c322013-03-22 15:04:39 -070013#include <linux/printk.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070014#include <linux/spinlock.h>
15#include <linux/tty.h>
16#include <linux/wait.h>
17#include <linux/vt_kern.h>
Viktor Rosendahlb61312d2009-01-06 14:40:42 -080018#include <linux/console.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070019
Sergey Senozhatsky5b39fc042018-10-25 16:05:43 +090020void bust_spinlocks(int yes)
Linus Torvalds1da177e2005-04-16 15:20:36 -070021{
22 if (yes) {
Jan Beulich00442992007-10-16 23:29:33 -070023 ++oops_in_progress;
Linus Torvalds1da177e2005-04-16 15:20:36 -070024 } else {
Linus Torvalds1da177e2005-04-16 15:20:36 -070025#ifdef CONFIG_VT
26 unblank_screen();
27#endif
Viktor Rosendahlb61312d2009-01-06 14:40:42 -080028 console_unblank();
Jan Beulich00442992007-10-16 23:29:33 -070029 if (--oops_in_progress == 0)
30 wake_up_klogd();
Linus Torvalds1da177e2005-04-16 15:20:36 -070031 }
32}