summaryrefslogtreecommitdiffstats
path: root/debian/patches-rt/0091-printk-Add-this_cpu_in_panic.patch
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-11 08:28:00 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-11 08:28:00 +0000
commit3565071f226432336a54d0193d729fa4508a3394 (patch)
tree4cde13f078f84c0a7785d234fd52edce7c90546a /debian/patches-rt/0091-printk-Add-this_cpu_in_panic.patch
parentAdding upstream version 6.6.15. (diff)
downloadlinux-3565071f226432336a54d0193d729fa4508a3394.tar.xz
linux-3565071f226432336a54d0193d729fa4508a3394.zip
Adding debian version 6.6.15-2.debian/6.6.15-2
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'debian/patches-rt/0091-printk-Add-this_cpu_in_panic.patch')
-rw-r--r--debian/patches-rt/0091-printk-Add-this_cpu_in_panic.patch88
1 files changed, 88 insertions, 0 deletions
diff --git a/debian/patches-rt/0091-printk-Add-this_cpu_in_panic.patch b/debian/patches-rt/0091-printk-Add-this_cpu_in_panic.patch
new file mode 100644
index 000000000..092591125
--- /dev/null
+++ b/debian/patches-rt/0091-printk-Add-this_cpu_in_panic.patch
@@ -0,0 +1,88 @@
+From: John Ogness <john.ogness@linutronix.de>
+Date: Fri, 13 Oct 2023 14:30:49 +0000
+Subject: [PATCH 091/134] printk: Add this_cpu_in_panic()
+Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/6.6/older/patches-6.6.7-rt18.tar.xz
+
+There is already panic_in_progress() and other_cpu_in_panic(),
+but checking if the current CPU is the panic CPU must still be
+open coded.
+
+Add this_cpu_in_panic() to complete the set.
+
+Signed-off-by: John Ogness <john.ogness@linutronix.de>
+Reviewed-by: Petr Mladek <pmladek@suse.com>
+Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
+---
+ kernel/printk/internal.h | 1 +
+ kernel/printk/printk.c | 43 +++++++++++++++++++++++--------------------
+ 2 files changed, 24 insertions(+), 20 deletions(-)
+
+--- a/kernel/printk/internal.h
++++ b/kernel/printk/internal.h
+@@ -130,6 +130,7 @@ struct printk_message {
+ };
+
+ bool other_cpu_in_panic(void);
++bool this_cpu_in_panic(void);
+ bool printk_get_next_message(struct printk_message *pmsg, u64 seq,
+ bool is_extended, bool may_supress);
+
+--- a/kernel/printk/printk.c
++++ b/kernel/printk/printk.c
+@@ -347,6 +347,29 @@ static bool panic_in_progress(void)
+ return unlikely(atomic_read(&panic_cpu) != PANIC_CPU_INVALID);
+ }
+
++/* Return true if a panic is in progress on the current CPU. */
++bool this_cpu_in_panic(void)
++{
++ /*
++ * We can use raw_smp_processor_id() here because it is impossible for
++ * the task to be migrated to the panic_cpu, or away from it. If
++ * panic_cpu has already been set, and we're not currently executing on
++ * that CPU, then we never will be.
++ */
++ return unlikely(atomic_read(&panic_cpu) == raw_smp_processor_id());
++}
++
++/*
++ * Return true if a panic is in progress on a remote CPU.
++ *
++ * On true, the local CPU should immediately release any printing resources
++ * that may be needed by the panic CPU.
++ */
++bool other_cpu_in_panic(void)
++{
++ return (panic_in_progress() && !this_cpu_in_panic());
++}
++
+ /*
+ * This is used for debugging the mess that is the VT code by
+ * keeping track if we have the console semaphore held. It's
+@@ -2593,26 +2616,6 @@ static int console_cpu_notify(unsigned i
+ return 0;
+ }
+
+-/*
+- * Return true if a panic is in progress on a remote CPU.
+- *
+- * On true, the local CPU should immediately release any printing resources
+- * that may be needed by the panic CPU.
+- */
+-bool other_cpu_in_panic(void)
+-{
+- if (!panic_in_progress())
+- return false;
+-
+- /*
+- * We can use raw_smp_processor_id() here because it is impossible for
+- * the task to be migrated to the panic_cpu, or away from it. If
+- * panic_cpu has already been set, and we're not currently executing on
+- * that CPU, then we never will be.
+- */
+- return atomic_read(&panic_cpu) != raw_smp_processor_id();
+-}
+-
+ /**
+ * console_lock - block the console subsystem from printing
+ *