These changes are the raw update to linux-4.4.6-rt14. Kernel sources
[kvmfornfv.git] / kernel / kernel / panic.c
index 0436090..50d4ae2 100644 (file)
@@ -23,6 +23,7 @@
 #include <linux/sysrq.h>
 #include <linux/init.h>
 #include <linux/nmi.h>
+#include <linux/console.h>
 
 #define PANIC_TIMER_STEP 100
 #define PANIC_BLINK_SPD 18
@@ -32,7 +33,7 @@ static unsigned long tainted_mask;
 static int pause_on_oops;
 static int pause_on_oops_flag;
 static DEFINE_SPINLOCK(pause_on_oops_lock);
-static bool crash_kexec_post_notifiers;
+bool crash_kexec_post_notifiers;
 int panic_on_warn __read_mostly;
 
 int panic_timeout = CONFIG_PANIC_TIMEOUT;
@@ -142,10 +143,22 @@ void panic(const char *fmt, ...)
         * Note: since some panic_notifiers can make crashed kernel
         * more unstable, it can increase risks of the kdump failure too.
         */
-       crash_kexec(NULL);
+       if (crash_kexec_post_notifiers)
+               crash_kexec(NULL);
 
        bust_spinlocks(0);
 
+       /*
+        * We may have ended up stopping the CPU holding the lock (in
+        * smp_send_stop()) while still having some valuable data in the console
+        * buffer.  Try to acquire the lock then release it regardless of the
+        * result.  The release will also print the buffers out.  Locks debug
+        * should be disabled to avoid reporting bad unlock balance when
+        * panic() is not being callled from OOPS.
+        */
+       debug_locks_off();
+       console_flush_on_panic();
+
        if (!panic_blink)
                panic_blink = no_blink;