Support atomic printks
authorBarret Rhoden <brho@cs.berkeley.edu>
Thu, 19 Jul 2018 18:54:09 +0000 (14:54 -0400)
committerBarret Rhoden <brho@cs.berkeley.edu>
Thu, 19 Jul 2018 18:54:09 +0000 (14:54 -0400)
commitcdc994e1e33ddb5137d46bc6664077e03e51a5a0
tree954f091db10fc2036937e07c9bbacf8e9180a575
parent20f634615cf93f80d77529bf97109891f481566b
Support atomic printks

printk() was atomic at the granularity of a line - most of the time.  It
wasn't for kernel faults, which leads to inscrutable bug reports.  At the
time, I avoided the lock to avoid deadlocking.  Instead, we can use a
recursive lock, which I'm not normally a fan of.

Additionally, other callers can use print_lock() to atomically print
multiple lines.  The classic example is panic() and warn().  panic() has a
few issues of its own, so we have print_unlock_force().

Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
kern/include/stdio.h
kern/src/init.c
kern/src/printf.c