avoid pserialize usage in early boot there are DEBUG-only aprint_normal() calls early in eg, ksyms setup that may happen before eg curcpu() is setup. this is the case in sparc64, where it sets up ksyms as early as it can so that DDB has symbols early, which is before the curcpu() setup is created, and thus the calls to pserialize_read_enter() and pserialize_read_exit() attempt to access unmapped cpu_info and due to being so early, the system faults to the prom. this workaround uses the pre-existing "kprintf_inited" bool to determine whether to skip these pserialize calls or not. Index: kern/subr_prf.c =================================================================== RCS file: /cvsroot/src/sys/kern/subr_prf.c,v retrieving revision 1.196 diff -p -u -r1.196 subr_prf.c --- kern/subr_prf.c 31 Oct 2022 09:14:18 -0000 1.196 +++ kern/subr_prf.c 4 Feb 2023 06:21:58 -0000 @@ -401,6 +401,7 @@ putone(int c, int flags, struct tty *tp) { struct tty *ctp; int s; + bool do_ps = kprintf_inited; ctp = NULL; /* XXX gcc i386 -Os */ @@ -408,7 +409,8 @@ putone(int c, int flags, struct tty *tp) * Ensure whatever constty points to can't go away while we're * trying to use it. */ - s = pserialize_read_enter(); + if (__predict_true(do_ps)) + s = pserialize_read_enter(); if (panicstr) atomic_store_relaxed(&constty, NULL); @@ -429,7 +431,8 @@ putone(int c, int flags, struct tty *tp) if ((flags & TOCONS) && ctp == NULL && c != '\0') (*v_putc)(c); - pserialize_read_exit(s); + if (__predict_true(do_ps)) + pserialize_read_exit(s); } static void