Skip to content

Commit

Permalink
printk: For @suppress_panic_printk check for other CPU in panic
Browse files Browse the repository at this point in the history
[ Upstream commit 0ab7cdd ]

Currently @suppress_panic_printk is checked along with
non-matching @panic_cpu and current CPU. This works
because @suppress_panic_printk is only set when
panic_in_progress() is true.

Rather than relying on the @suppress_panic_printk semantics,
use the concise helper function other_cpu_in_progress(). The
helper function exists to avoid open coding such tests.

Signed-off-by: John Ogness <john.ogness@linutronix.de>
Reviewed-by: Petr Mladek <pmladek@suse.com>
Link: https://lore.kernel.org/r/20240207134103.1357162-7-john.ogness@linutronix.de
Signed-off-by: Petr Mladek <pmladek@suse.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
jogness authored and gregkh committed Apr 13, 2024
1 parent dbd3c05 commit a2e14cc
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions kernel/printk/printk.c
Expand Up @@ -2309,8 +2309,7 @@ asmlinkage int vprintk_emit(int facility, int level,
if (unlikely(suppress_printk))
return 0;

if (unlikely(suppress_panic_printk) &&
atomic_read(&panic_cpu) != raw_smp_processor_id())
if (unlikely(suppress_panic_printk) && other_cpu_in_panic())
return 0;

if (level == LOGLEVEL_SCHED) {
Expand Down

0 comments on commit a2e14cc

Please sign in to comment.