]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - queue-6.8/printk-for-suppress_panic_printk-check-for-other-cpu.patch
Linux 6.6.27
[thirdparty/kernel/stable-queue.git] / queue-6.8 / printk-for-suppress_panic_printk-check-for-other-cpu.patch
1 From 71ae9b330f906cb7e8c43e1fd0c7136e54bc0034 Mon Sep 17 00:00:00 2001
2 From: Sasha Levin <sashal@kernel.org>
3 Date: Wed, 7 Feb 2024 14:46:55 +0106
4 Subject: printk: For @suppress_panic_printk check for other CPU in panic
5
6 From: John Ogness <john.ogness@linutronix.de>
7
8 [ Upstream commit 0ab7cdd00491b532591ef065be706301de7e448f ]
9
10 Currently @suppress_panic_printk is checked along with
11 non-matching @panic_cpu and current CPU. This works
12 because @suppress_panic_printk is only set when
13 panic_in_progress() is true.
14
15 Rather than relying on the @suppress_panic_printk semantics,
16 use the concise helper function other_cpu_in_progress(). The
17 helper function exists to avoid open coding such tests.
18
19 Signed-off-by: John Ogness <john.ogness@linutronix.de>
20 Reviewed-by: Petr Mladek <pmladek@suse.com>
21 Link: https://lore.kernel.org/r/20240207134103.1357162-7-john.ogness@linutronix.de
22 Signed-off-by: Petr Mladek <pmladek@suse.com>
23 Signed-off-by: Sasha Levin <sashal@kernel.org>
24 ---
25 kernel/printk/printk.c | 3 +--
26 1 file changed, 1 insertion(+), 2 deletions(-)
27
28 diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c
29 index 7a835b277e98d..e1b992652ab25 100644
30 --- a/kernel/printk/printk.c
31 +++ b/kernel/printk/printk.c
32 @@ -2328,8 +2328,7 @@ asmlinkage int vprintk_emit(int facility, int level,
33 if (unlikely(suppress_printk))
34 return 0;
35
36 - if (unlikely(suppress_panic_printk) &&
37 - atomic_read(&panic_cpu) != raw_smp_processor_id())
38 + if (unlikely(suppress_panic_printk) && other_cpu_in_panic())
39 return 0;
40
41 if (level == LOGLEVEL_SCHED) {
42 --
43 2.43.0
44