Commit 77498617 authored by Stephen Brennan's avatar Stephen Brennan Committed by Petr Mladek

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: default avatarPetr Mladek <pmladek@suse.com>
Signed-off-by: default avatarStephen Brennan <stephen.s.brennan@oracle.com>
Reviewed-by: default avatarPetr Mladek <pmladek@suse.com>
Reviewed-by: default avatarSergey Senozhatsky <senozhatsky@chromium.org>
Signed-off-by: default avatarPetr Mladek <pmladek@suse.com>
Link: https://lore.kernel.org/r/20220202171821.179394-2-stephen.s.brennan@oracle.com
parent a2293277
...@@ -256,6 +256,11 @@ static void __up_console_sem(unsigned long ip) ...@@ -256,6 +256,11 @@ static void __up_console_sem(unsigned long ip)
} }
#define up_console_sem() __up_console_sem(_RET_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 * This is used for debugging the mess that is the VT code by
* keeping track if we have the console semaphore held. It's * keeping track if we have the console semaphore held. It's
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment