]> git.itanic.dy.fi Git - linux-stable/commit
dump_stack: Do not get cpu_sync for panic CPU
authorJohn Ogness <john.ogness@linutronix.de>
Wed, 7 Feb 2024 13:41:03 +0000 (14:47 +0106)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 13 Apr 2024 11:09:58 +0000 (13:09 +0200)
commita63a05db132b9a75e6bc3345ac8185c957d045dd
tree435080ce64e32d313e9b7fb94efea394ba48bdc2
parent365224c74cb3c47547bfb270d57ebe458c315318
dump_stack: Do not get cpu_sync for panic CPU

[ Upstream commit 7412dc6d55eed6b76180e40ac3601412ebde29bd ]

dump_stack() is called in panic(). If for some reason another CPU
is holding the printk_cpu_sync and is unable to release it, the
panic CPU will be unable to continue and print the stacktrace.

Since non-panic CPUs are not allowed to store new printk messages
anyway, there is no need to synchronize the stacktrace output in
a panic situation.

For the panic CPU, do not get the printk_cpu_sync because it is
not needed and avoids a potential deadlock scenario in panic().

Link: https://lore.kernel.org/lkml/ZcIGKU8sxti38Kok@alley
Signed-off-by: John Ogness <john.ogness@linutronix.de>
Reviewed-by: Petr Mladek <pmladek@suse.com>
Link: https://lore.kernel.org/r/20240207134103.1357162-15-john.ogness@linutronix.de
Signed-off-by: Petr Mladek <pmladek@suse.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
include/linux/printk.h
kernel/printk/internal.h
lib/dump_stack.c