From: Sasha Levin Date: Tue, 26 Mar 2024 19:45:17 +0000 (-0400) Subject: Drop printk patches from older trees X-Git-Tag: v6.8.2~1 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=dcf51cf31078998ff9718da53705b96be230337f;p=thirdparty%2Fkernel%2Fstable-queue.git Drop printk patches from older trees --- diff --git a/queue-5.10/printk-add-panic_in_progress-helper.patch b/queue-5.10/printk-add-panic_in_progress-helper.patch deleted file mode 100644 index 2dc4500a6d2..00000000000 --- a/queue-5.10/printk-add-panic_in_progress-helper.patch +++ /dev/null @@ -1,46 +0,0 @@ -From 39a193250eef2ead8b1eff317ba76941c2188c82 Mon Sep 17 00:00:00 2001 -From: Sasha Levin -Date: Wed, 2 Feb 2022 09:18:18 -0800 -Subject: printk: Add panic_in_progress helper - -From: Stephen Brennan - -[ Upstream commit 77498617857f68496b360081dde1a492d40c28b2 ] - -This will be used help avoid deadlocks during panics. Although it would -be better to include this in linux/panic.h, it would require that header -to include linux/atomic.h as well. On some architectures, this results -in a circular dependency as well. So instead add the helper directly to -printk.c. - -Suggested-by: Petr Mladek -Signed-off-by: Stephen Brennan -Reviewed-by: Petr Mladek -Reviewed-by: Sergey Senozhatsky -Signed-off-by: Petr Mladek -Link: https://lore.kernel.org/r/20220202171821.179394-2-stephen.s.brennan@oracle.com -Stable-dep-of: d04d5882cd67 ("printk: Disable passing console lock owner completely during panic()") -Signed-off-by: Sasha Levin ---- - kernel/printk/printk.c | 5 +++++ - 1 file changed, 5 insertions(+) - -diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c -index 17a310dcb6d96..94af80b7fa9b5 100644 ---- a/kernel/printk/printk.c -+++ b/kernel/printk/printk.c -@@ -258,6 +258,11 @@ static void __up_console_sem(unsigned long ip) - } - #define up_console_sem() __up_console_sem(_RET_IP_) - -+static bool panic_in_progress(void) -+{ -+ return unlikely(atomic_read(&panic_cpu) != PANIC_CPU_INVALID); -+} -+ - /* - * This is used for debugging the mess that is the VT code by - * keeping track if we have the console semaphore held. It's --- -2.43.0 - diff --git a/queue-5.10/printk-disable-passing-console-lock-owner-completely.patch b/queue-5.10/printk-disable-passing-console-lock-owner-completely.patch deleted file mode 100644 index 65f54fd5811..00000000000 --- a/queue-5.10/printk-disable-passing-console-lock-owner-completely.patch +++ /dev/null @@ -1,116 +0,0 @@ -From b8b3bf167cb2439f091179cd6054ab6927273a56 Mon Sep 17 00:00:00 2001 -From: Sasha Levin -Date: Wed, 7 Feb 2024 14:47:00 +0106 -Subject: printk: Disable passing console lock owner completely during panic() - -From: Petr Mladek - -[ Upstream commit d04d5882cd678b898a9d7c5aee6afbe9e6e77fcd ] - -The commit d51507098ff91 ("printk: disable optimistic spin -during panic") added checks to avoid becoming a console waiter -if a panic is in progress. - -However, the transition to panic can occur while there is -already a waiter. The current owner should not pass the lock to -the waiter because it might get stopped or blocked anytime. - -Also the panic context might pass the console lock owner to an -already stopped waiter by mistake. It might happen when -console_flush_on_panic() ignores the current lock owner, for -example: - -CPU0 CPU1 ----- ---- -console_lock_spinning_enable() - console_trylock_spinning() - [CPU1 now console waiter] -NMI: panic() - panic_other_cpus_shutdown() - [stopped as console waiter] - console_flush_on_panic() - console_lock_spinning_enable() - [print 1 record] - console_lock_spinning_disable_and_check() - [handover to stopped CPU1] - -This results in panic() not flushing the panic messages. - -Fix these problems by disabling all spinning operations -completely during panic(). - -Another advantage is that it prevents possible deadlocks caused -by "console_owner_lock". The panic() context does not need to -take it any longer. The lockless checks are safe because the -functions become NOPs when they see the panic in progress. All -operations manipulating the state are still synchronized by the -lock even when non-panic CPUs would notice the panic -synchronously. - -The current owner might stay spinning. But non-panic() CPUs -would get stopped anyway and the panic context will never start -spinning. - -Fixes: dbdda842fe96 ("printk: Add console owner and waiter logic to load balance console writes") -Signed-off-by: John Ogness -Link: https://lore.kernel.org/r/20240207134103.1357162-12-john.ogness@linutronix.de -Signed-off-by: Petr Mladek -Signed-off-by: Sasha Levin ---- - kernel/printk/printk.c | 29 +++++++++++++++++++++++++++++ - 1 file changed, 29 insertions(+) - -diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c -index 94af80b7fa9b5..d109411f108f9 100644 ---- a/kernel/printk/printk.c -+++ b/kernel/printk/printk.c -@@ -1760,10 +1760,23 @@ static bool console_waiter; - */ - static void console_lock_spinning_enable(void) - { -+ /* -+ * Do not use spinning in panic(). The panic CPU wants to keep the lock. -+ * Non-panic CPUs abandon the flush anyway. -+ * -+ * Just keep the lockdep annotation. The panic-CPU should avoid -+ * taking console_owner_lock because it might cause a deadlock. -+ * This looks like the easiest way how to prevent false lockdep -+ * reports without handling races a lockless way. -+ */ -+ if (panic_in_progress()) -+ goto lockdep; -+ - raw_spin_lock(&console_owner_lock); - console_owner = current; - raw_spin_unlock(&console_owner_lock); - -+lockdep: - /* The waiter may spin on us after setting console_owner */ - spin_acquire(&console_owner_dep_map, 0, 0, _THIS_IP_); - } -@@ -1787,6 +1800,22 @@ static int console_lock_spinning_disable_and_check(void) - { - int waiter; - -+ /* -+ * Ignore spinning waiters during panic() because they might get stopped -+ * or blocked at any time, -+ * -+ * It is safe because nobody is allowed to start spinning during panic -+ * in the first place. If there has been a waiter then non panic CPUs -+ * might stay spinning. They would get stopped anyway. The panic context -+ * will never start spinning and an interrupted spin on panic CPU will -+ * never continue. -+ */ -+ if (panic_in_progress()) { -+ /* Keep lockdep happy. */ -+ spin_release(&console_owner_dep_map, _THIS_IP_); -+ return 0; -+ } -+ - raw_spin_lock(&console_owner_lock); - waiter = READ_ONCE(console_waiter); - console_owner = NULL; --- -2.43.0 - diff --git a/queue-5.10/series b/queue-5.10/series index fb824a9dbe5..e21735b25bd 100644 --- a/queue-5.10/series +++ b/queue-5.10/series @@ -55,8 +55,6 @@ wifi-iwlwifi-dbg-tlv-ensure-nul-termination.patch wifi-iwlwifi-fix-ewrd-table-validity-check.patch net-blackhole_dev-fix-build-warning-for-ethh-set-but.patch wifi-libertas-fix-some-memleaks-in-lbs_allocate_cmd_.patch -printk-add-panic_in_progress-helper.patch -printk-disable-passing-console-lock-owner-completely.patch arm64-dts-mediatek-mt7622-add-missing-device_type-to.patch bpf-factor-out-bpf_spin_lock-into-helpers.patch bpf-mark-bpf_spin_-lock-unlock-helpers-with-notrace-.patch diff --git a/queue-5.15/printk-add-panic_in_progress-helper.patch b/queue-5.15/printk-add-panic_in_progress-helper.patch deleted file mode 100644 index a8ce95161cd..00000000000 --- a/queue-5.15/printk-add-panic_in_progress-helper.patch +++ /dev/null @@ -1,46 +0,0 @@ -From 638bff97b02854768b03c7de106b677613c51560 Mon Sep 17 00:00:00 2001 -From: Sasha Levin -Date: Wed, 2 Feb 2022 09:18:18 -0800 -Subject: printk: Add panic_in_progress helper - -From: Stephen Brennan - -[ Upstream commit 77498617857f68496b360081dde1a492d40c28b2 ] - -This will be used help avoid deadlocks during panics. Although it would -be better to include this in linux/panic.h, it would require that header -to include linux/atomic.h as well. On some architectures, this results -in a circular dependency as well. So instead add the helper directly to -printk.c. - -Suggested-by: Petr Mladek -Signed-off-by: Stephen Brennan -Reviewed-by: Petr Mladek -Reviewed-by: Sergey Senozhatsky -Signed-off-by: Petr Mladek -Link: https://lore.kernel.org/r/20220202171821.179394-2-stephen.s.brennan@oracle.com -Stable-dep-of: d04d5882cd67 ("printk: Disable passing console lock owner completely during panic()") -Signed-off-by: Sasha Levin ---- - kernel/printk/printk.c | 5 +++++ - 1 file changed, 5 insertions(+) - -diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c -index 8b110b245d92c..de44ccf9743c1 100644 ---- a/kernel/printk/printk.c -+++ b/kernel/printk/printk.c -@@ -258,6 +258,11 @@ static void __up_console_sem(unsigned long ip) - } - #define up_console_sem() __up_console_sem(_RET_IP_) - -+static bool panic_in_progress(void) -+{ -+ return unlikely(atomic_read(&panic_cpu) != PANIC_CPU_INVALID); -+} -+ - /* - * This is used for debugging the mess that is the VT code by - * keeping track if we have the console semaphore held. It's --- -2.43.0 - diff --git a/queue-5.15/printk-disable-passing-console-lock-owner-completely.patch b/queue-5.15/printk-disable-passing-console-lock-owner-completely.patch deleted file mode 100644 index 4defae7c2ce..00000000000 --- a/queue-5.15/printk-disable-passing-console-lock-owner-completely.patch +++ /dev/null @@ -1,116 +0,0 @@ -From edf4e1e6001bf8bc53c4ed01fc18f8ea53e06e64 Mon Sep 17 00:00:00 2001 -From: Sasha Levin -Date: Wed, 7 Feb 2024 14:47:00 +0106 -Subject: printk: Disable passing console lock owner completely during panic() - -From: Petr Mladek - -[ Upstream commit d04d5882cd678b898a9d7c5aee6afbe9e6e77fcd ] - -The commit d51507098ff91 ("printk: disable optimistic spin -during panic") added checks to avoid becoming a console waiter -if a panic is in progress. - -However, the transition to panic can occur while there is -already a waiter. The current owner should not pass the lock to -the waiter because it might get stopped or blocked anytime. - -Also the panic context might pass the console lock owner to an -already stopped waiter by mistake. It might happen when -console_flush_on_panic() ignores the current lock owner, for -example: - -CPU0 CPU1 ----- ---- -console_lock_spinning_enable() - console_trylock_spinning() - [CPU1 now console waiter] -NMI: panic() - panic_other_cpus_shutdown() - [stopped as console waiter] - console_flush_on_panic() - console_lock_spinning_enable() - [print 1 record] - console_lock_spinning_disable_and_check() - [handover to stopped CPU1] - -This results in panic() not flushing the panic messages. - -Fix these problems by disabling all spinning operations -completely during panic(). - -Another advantage is that it prevents possible deadlocks caused -by "console_owner_lock". The panic() context does not need to -take it any longer. The lockless checks are safe because the -functions become NOPs when they see the panic in progress. All -operations manipulating the state are still synchronized by the -lock even when non-panic CPUs would notice the panic -synchronously. - -The current owner might stay spinning. But non-panic() CPUs -would get stopped anyway and the panic context will never start -spinning. - -Fixes: dbdda842fe96 ("printk: Add console owner and waiter logic to load balance console writes") -Signed-off-by: John Ogness -Link: https://lore.kernel.org/r/20240207134103.1357162-12-john.ogness@linutronix.de -Signed-off-by: Petr Mladek -Signed-off-by: Sasha Levin ---- - kernel/printk/printk.c | 29 +++++++++++++++++++++++++++++ - 1 file changed, 29 insertions(+) - -diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c -index de44ccf9743c1..5ad824b080e27 100644 ---- a/kernel/printk/printk.c -+++ b/kernel/printk/printk.c -@@ -1802,10 +1802,23 @@ static bool console_waiter; - */ - static void console_lock_spinning_enable(void) - { -+ /* -+ * Do not use spinning in panic(). The panic CPU wants to keep the lock. -+ * Non-panic CPUs abandon the flush anyway. -+ * -+ * Just keep the lockdep annotation. The panic-CPU should avoid -+ * taking console_owner_lock because it might cause a deadlock. -+ * This looks like the easiest way how to prevent false lockdep -+ * reports without handling races a lockless way. -+ */ -+ if (panic_in_progress()) -+ goto lockdep; -+ - raw_spin_lock(&console_owner_lock); - console_owner = current; - raw_spin_unlock(&console_owner_lock); - -+lockdep: - /* The waiter may spin on us after setting console_owner */ - spin_acquire(&console_owner_dep_map, 0, 0, _THIS_IP_); - } -@@ -1829,6 +1842,22 @@ static int console_lock_spinning_disable_and_check(void) - { - int waiter; - -+ /* -+ * Ignore spinning waiters during panic() because they might get stopped -+ * or blocked at any time, -+ * -+ * It is safe because nobody is allowed to start spinning during panic -+ * in the first place. If there has been a waiter then non panic CPUs -+ * might stay spinning. They would get stopped anyway. The panic context -+ * will never start spinning and an interrupted spin on panic CPU will -+ * never continue. -+ */ -+ if (panic_in_progress()) { -+ /* Keep lockdep happy. */ -+ spin_release(&console_owner_dep_map, _THIS_IP_); -+ return 0; -+ } -+ - raw_spin_lock(&console_owner_lock); - waiter = READ_ONCE(console_waiter); - console_owner = NULL; --- -2.43.0 - diff --git a/queue-5.15/series b/queue-5.15/series index 6c0ed72b0c4..8be6542ca51 100644 --- a/queue-5.15/series +++ b/queue-5.15/series @@ -78,8 +78,6 @@ pwm-atmel-hlcdc-use-consistent-variable-naming.patch pwm-atmel-hlcdc-fix-clock-imbalance-related-to-suspe.patch net-blackhole_dev-fix-build-warning-for-ethh-set-but.patch wifi-libertas-fix-some-memleaks-in-lbs_allocate_cmd_.patch -printk-add-panic_in_progress-helper.patch -printk-disable-passing-console-lock-owner-completely.patch pwm-sti-implement-.apply-callback.patch pwm-sti-fix-capture-for-st-pwm-num-chan-st-capture-n.patch wifi-iwlwifi-mvm-don-t-set-replay-counters-to-0xff.patch