aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephen Brennan <[email protected]>2022-02-02 09:18:18 -0800
committerPetr Mladek <[email protected]>2022-02-14 13:39:20 +0100
commit77498617857f68496b360081dde1a492d40c28b2 (patch)
tree292499391fc52f5875c2a62d2a8f170cc1e1a2b9
parenta229327733b86aa585effdb0d27a87b12aa51597 (diff)
printk: Add panic_in_progress helper
This will be used help avoid deadlocks during panics. Although it would be better to include this in linux/panic.h, it would require that header to include linux/atomic.h as well. On some architectures, this results in a circular dependency as well. So instead add the helper directly to printk.c. Suggested-by: Petr Mladek <[email protected]> Signed-off-by: Stephen Brennan <[email protected]> Reviewed-by: Petr Mladek <[email protected]> Reviewed-by: Sergey Senozhatsky <[email protected]> Signed-off-by: Petr Mladek <[email protected]> Link: https://lore.kernel.org/r/[email protected]
-rw-r--r--kernel/printk/printk.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c
index 155229f0cf0f..f04bbed0aa79 100644
--- a/kernel/printk/printk.c
+++ b/kernel/printk/printk.c
@@ -256,6 +256,11 @@ static void __up_console_sem(unsigned long ip)
}
#define up_console_sem() __up_console_sem(_RET_IP_)
+static bool panic_in_progress(void)
+{
+ return unlikely(atomic_read(&panic_cpu) != PANIC_CPU_INVALID);
+}
+
/*
* This is used for debugging the mess that is the VT code by
* keeping track if we have the console semaphore held. It's