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 <[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]
1 parent a229327 commit 7749861

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

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)