git: kernel - Make kprintf / kputchar more robust

Aaron LI aly at
Tue Jul 20 16:30:35 PDT 2021

commit d9126105909034b7d4010f933837c7db307c8ebf
Author: Matthew Dillon <dillon at>
Date:   Thu Jul 15 14:02:21 2021 -0700

    kernel - Make kprintf / kputchar more robust
    * kprintf() via kputchar() can deadlock due to kprintf()s made from
      Xinvltlb (which ignores critical sections).  However, we still want
      to be able to dump diagnostic information from Xinvltlb!
    * Adjust sccnputc() to use a non-blocking syscons lock.
    * Adjust kputchar() to not issue a wakeup() on the console support
      thread if called with mycpu->gd_intr_nesting_level != 0.  To
      compensate, the support thread now checks at a minimum rate of
      once per second.
    * Adjust kvcprintf() to always spin_trylock(), which means that
      lines will be lost if multiple cpu's compete for the console
      (but all lines will still wind up in the dmesg buffer).  This
      needs to be done to allow kprintf()s from Xinvltlb (which ignore
      critical sections) to not deadlock the machine.

Summary of changes:
 sys/dev/misc/syscons/syscons.c |  3 ++-
 sys/kern/subr_prf.c            | 42 ++++++++++++++++++++----------------------
 2 files changed, 22 insertions(+), 23 deletions(-)

DragonFly BSD source repository

More information about the Commits mailing list