Skip to content

Commit 7749861

Browse files
brenns10pmladek
authored andcommitted
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 <pmladek@suse.com> Signed-off-by: Stephen Brennan <stephen.s.brennan@oracle.com> Reviewed-by: Petr Mladek <pmladek@suse.com> Reviewed-by: Sergey Senozhatsky <senozhatsky@chromium.org> Signed-off-by: Petr Mladek <pmladek@suse.com> Link: https://lore.kernel.org/r/20220202171821.179394-2-stephen.s.brennan@oracle.com
1 parent a229327 commit 7749861

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

kernel/printk/printk.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,11 @@ static void __up_console_sem(unsigned long ip)
256256
}
257257
#define up_console_sem() __up_console_sem(_RET_IP_)
258258

259+
static bool panic_in_progress(void)
260+
{
261+
return unlikely(atomic_read(&panic_cpu) != PANIC_CPU_INVALID);
262+
}
263+
259264
/*
260265
* This is used for debugging the mess that is the VT code by
261266
* keeping track if we have the console semaphore held. It's

0 commit comments

Comments
 (0)