blob: ab719495e2cb42ba7b8c85e7ef5dfadff4695946 [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 *
5 * Provides a minimal bust_spinlocks for architectures which don't have one of their own.
6 *
7 * bust_spinlocks() clears any spinlocks which would prevent oops, die(), BUG()
8 * and panic() information from reaching the user.
9 */
10
Linus Torvalds1da177e2005-04-16 15:20:36 -070011#include <linux/kernel.h>
Frederic Weisbeckerdc72c322013-03-22 15:04:39 -070012#include <linux/printk.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070013#include <linux/spinlock.h>
14#include <linux/tty.h>
15#include <linux/wait.h>
16#include <linux/vt_kern.h>
Viktor Rosendahlb61312d2009-01-06 14:40:42 -080017#include <linux/console.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070018
19
Kirill Korotaevcefc8be2007-02-10 01:46:18 -080020void __attribute__((weak)) 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}