Subject: [PATCH 02/48] printk: For @suppress_panic_printk check for other CPU in panic
From: John Ogness <[email-masked]>
Date: Wed, 7 Feb 2024 14:46:55 +0106

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 <[email-masked]>
Reviewed-by: Petr Mladek <[email-masked]>
Link: https://lore.kernel.org/r/[email-masked]
Signed-off-by: Petr Mladek <[email-masked]>
Signed-off-by: Sebastian Andrzej Siewior <[email-masked]>
---
 kernel/printk/printk.c |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Index: linux-6.8.2-rt10/kernel/printk/printk.c
===================================================================
--- linux-6.8.2-rt10.orig/kernel/printk/printk.c
+++ linux-6.8.2-rt10/kernel/printk/printk.c
@@ -2322,8 +2322,7 @@ asmlinkage int vprintk_emit(int facility
 	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) {