> The per-CPU struct is mapped using a 64K locked TLB entry. That TLB > entry is installed by sun4u_bootstrap_cpu(), which gets called *after* > initsmgbuf() is called. So this issue was introduced when locking was > added to msgbuf_putchar(). > > Now the real question is why this doesn't crash even on a cold boot? > I suspect that is because on a cold boot the buffer is clean and the > msgbuf_putchar() call in initmsgbuf() is skipped. > > It may be possible to do some reordering in pmap_bootstrap(), but > frankly I think the locking added to msgbuf_putchar() was a mistake. > Or maybe the locking code should be bypassed when cold.
Indeed. Wrappinge the mutex operations in msgbuf_putchar with if (!cold) makes the kernel boot again.