kernel - Stop KTR logging during panic
authorMatthew Dillon <dillon@apollo.backplane.com>
Thu, 16 Aug 2012 16:11:07 +0000 (09:11 -0700)
committerMatthew Dillon <dillon@apollo.backplane.com>
Thu, 16 Aug 2012 16:11:07 +0000 (09:11 -0700)
* Stop all KTR logging when a panic occurs so the KTR buffer doesn't
  get wiped out by events during the panic & core dump.  This gives
  us a KTR buf snapshot as of the panic entry.

sys/kern/kern_ktr.c

index e4c819c..2963c79 100644 (file)
@@ -419,7 +419,9 @@ ktr_begin_write_entry(struct ktr_info *info, const char *file, int line)
 
        cpu = mycpu->gd_cpuid;
        kcpu = &ktr_cpu[cpu].core;
 
        cpu = mycpu->gd_cpuid;
        kcpu = &ktr_cpu[cpu].core;
-       if (kcpu->ktr_buf == NULL)
+       if (panicstr)                   /* stop logging during panic */
+               return NULL;
+       if (kcpu->ktr_buf == NULL)      /* too early in boot */
                return NULL;
 
        crit_enter();
                return NULL;
 
        crit_enter();