> From: Dave Voutila <[email protected]>
> Date: Sun, 28 Nov 2021 22:51:59 -0500
>
> The last vmm diff I'll be sending tonight...promise! This swaps out
> usage of printf(9) outside the autoconf(4) functions.
>
> The reason for this change is printf(9) could acquire a sleepable
> lock.
Huh?
/*
* printf: print a message to the console and the log
*/
int
printf(const char *fmt, ...)
{
va_list ap;
int retval;
va_start(ap, fmt);
mtx_enter(&kprintf_mutex);
retval = kprintf(fmt, TOCONS | TOLOG, NULL, NULL, ap);
mtx_leave(&kprintf_mutex);
va_end(ap);
if (!panicstr)
logwakeup();
return(retval);
}
The guts of the the code runs while holding a mutex, which means it
can't sleep. And logwakeup() doesn't sleep either.