From: John Ogness Date: Wed, 7 Feb 2024 13:40:55 +0000 (+0106) Subject: printk: For @suppress_panic_printk check for other CPU in panic X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=0ab7cdd00491b532591ef065be706301de7e448f;p=linux.git printk: For @suppress_panic_printk check for other CPU in panic 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 Reviewed-by: Petr Mladek Link: https://lore.kernel.org/r/20240207134103.1357162-7-john.ogness@linutronix.de Signed-off-by: Petr Mladek --- diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c index be95a68511647..22bb45d8f2f21 100644 --- a/kernel/printk/printk.c +++ b/kernel/printk/printk.c @@ -2270,8 +2270,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) {