Patch "kgdb: Flush console before entering kgdb on panic" has been added to the 5.4-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

    kgdb: Flush console before entering kgdb on panic

to the 5.4-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:
     kgdb-flush-console-before-entering-kgdb-on-panic.patch
and it can be found in the queue-5.4 subdirectory.

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



commit 68899b4e8f79a7a6763fc7c716c504f4121fbfb9
Author: Douglas Anderson <dianders@xxxxxxxxxxxx>
Date:   Tue Aug 22 13:19:46 2023 -0700

    kgdb: Flush console before entering kgdb on panic
    
    [ Upstream commit dd712d3d45807db9fcae28a522deee85c1f2fde6 ]
    
    When entering kdb/kgdb on a kernel panic, it was be observed that the
    console isn't flushed before the `kdb` prompt came up. Specifically,
    when using the buddy lockup detector on arm64 and running:
      echo HARDLOCKUP > /sys/kernel/debug/provoke-crash/DIRECT
    
    I could see:
      [   26.161099] lkdtm: Performing direct entry HARDLOCKUP
      [   32.499881] watchdog: Watchdog detected hard LOCKUP on cpu 6
      [   32.552865] Sending NMI from CPU 5 to CPUs 6:
      [   32.557359] NMI backtrace for cpu 6
      ... [backtrace for cpu 6] ...
      [   32.558353] NMI backtrace for cpu 5
      ... [backtrace for cpu 5] ...
      [   32.867471] Sending NMI from CPU 5 to CPUs 0-4,7:
      [   32.872321] NMI backtrace forP cpuANC: Hard LOCKUP
    
      Entering kdb (current=..., pid 0) on processor 5 due to Keyboard Entry
      [5]kdb>
    
    As you can see, backtraces for the other CPUs start printing and get
    interleaved with the kdb PANIC print.
    
    Let's replicate the commands to flush the console in the kdb panic
    entry point to avoid this.
    
    Signed-off-by: Douglas Anderson <dianders@xxxxxxxxxxxx>
    Link: https://lore.kernel.org/r/20230822131945.1.I5b460ae8f954e4c4f628a373d6e74713c06dd26f@changeid
    Signed-off-by: Daniel Thompson <daniel.thompson@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/kernel/debug/debug_core.c b/kernel/debug/debug_core.c
index f88611fadb195..1ab2e97034868 100644
--- a/kernel/debug/debug_core.c
+++ b/kernel/debug/debug_core.c
@@ -945,6 +945,9 @@ void kgdb_panic(const char *msg)
 	if (panic_timeout)
 		return;
 
+	debug_locks_off();
+	console_flush_on_panic(CONSOLE_FLUSH_PENDING);
+
 	if (dbg_kdb_mode)
 		kdb_printf("PANIC: %s\n", msg);
 



[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