Patch "printk/panic: Allow cpu backtraces to be written into ringbuffer during panic" has been added to the 6.10-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    printk/panic: Allow cpu backtraces to be written into ringbuffer during panic

to the 6.10-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     printk-panic-allow-cpu-backtraces-to-be-written-into.patch
and it can be found in the queue-6.10 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 9df5bb24c6776879ab6f75ed206fb343f6070b4c
Author: Ryo Takakura <takakura@xxxxxxxxxxxxx>
Date:   Mon Aug 12 16:27:03 2024 +0900

    printk/panic: Allow cpu backtraces to be written into ringbuffer during panic
    
    [ Upstream commit bcc954c6caba01fca143162d5fbb90e46aa1ad80 ]
    
    commit 779dbc2e78d7 ("printk: Avoid non-panic CPUs writing
    to ringbuffer") disabled non-panic CPUs to further write messages to
    ringbuffer after panicked.
    
    Since the commit, non-panicked CPU's are not allowed to write to
    ring buffer after panicked and CPU backtrace which is triggered
    after panicked to sample non-panicked CPUs' backtrace no longer
    serves its function as it has nothing to print.
    
    Fix the issue by allowing non-panicked CPUs to write into ringbuffer
    while CPU backtrace is in flight.
    
    Fixes: 779dbc2e78d7 ("printk: Avoid non-panic CPUs writing to ringbuffer")
    Signed-off-by: Ryo Takakura <takakura@xxxxxxxxxxxxx>
    Reviewed-by: Petr Mladek <pmladek@xxxxxxxx>
    Link: https://lore.kernel.org/r/20240812072703.339690-1-takakura@xxxxxxxxxxxxx
    Signed-off-by: Petr Mladek <pmladek@xxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/include/linux/panic.h b/include/linux/panic.h
index 6717b15e798c3..556b4e2ad9aa5 100644
--- a/include/linux/panic.h
+++ b/include/linux/panic.h
@@ -16,6 +16,7 @@ extern void oops_enter(void);
 extern void oops_exit(void);
 extern bool oops_may_print(void);
 
+extern bool panic_triggering_all_cpu_backtrace;
 extern int panic_timeout;
 extern unsigned long panic_print;
 extern int panic_on_oops;
diff --git a/kernel/panic.c b/kernel/panic.c
index 8bff183d6180e..30342568e935f 100644
--- a/kernel/panic.c
+++ b/kernel/panic.c
@@ -63,6 +63,8 @@ unsigned long panic_on_taint;
 bool panic_on_taint_nousertaint = false;
 static unsigned int warn_limit __read_mostly;
 
+bool panic_triggering_all_cpu_backtrace;
+
 int panic_timeout = CONFIG_PANIC_TIMEOUT;
 EXPORT_SYMBOL_GPL(panic_timeout);
 
@@ -252,8 +254,12 @@ void check_panic_on_warn(const char *origin)
  */
 static void panic_other_cpus_shutdown(bool crash_kexec)
 {
-	if (panic_print & PANIC_PRINT_ALL_CPU_BT)
+	if (panic_print & PANIC_PRINT_ALL_CPU_BT) {
+		/* Temporary allow non-panic CPUs to write their backtraces. */
+		panic_triggering_all_cpu_backtrace = true;
 		trigger_all_cpu_backtrace();
+		panic_triggering_all_cpu_backtrace = false;
+	}
 
 	/*
 	 * Note that smp_send_stop() is the usual SMP shutdown function,
diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c
index dddb15f48d595..c5d844f727f63 100644
--- a/kernel/printk/printk.c
+++ b/kernel/printk/printk.c
@@ -2316,7 +2316,7 @@ asmlinkage int vprintk_emit(int facility, int level,
 	 * non-panic CPUs are generating any messages, they will be
 	 * silently dropped.
 	 */
-	if (other_cpu_in_panic())
+	if (other_cpu_in_panic() && !panic_triggering_all_cpu_backtrace)
 		return 0;
 
 	if (level == LOGLEVEL_SCHED) {




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux