Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-10]: src/sys/kern Pull up following revision(s) (requested by mrg...



details:   https://anonhg.NetBSD.org/src/rev/cd071802c2a2
branches:  netbsd-10
changeset: 373425:cd071802c2a2
user:      martin <martin%NetBSD.org@localhost>
date:      Wed Feb 08 18:24:52 2023 +0000

description:
Pull up following revision(s) (requested by mrg in ticket #75):

        sys/kern/subr_prf.c: revision 1.197
        sys/kern/subr_prf.c: revision 1.198

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.
simply use "cold" to determine whether to skip these pserialize
calls or not.

ok riastradh
XXX: pullup-10

fix logic-reversing tpyo in putone()

diffstat:

 sys/kern/subr_prf.c |  11 +++++++----
 1 files changed, 7 insertions(+), 4 deletions(-)

diffs (46 lines):

diff -r 3aba1b553ed3 -r cd071802c2a2 sys/kern/subr_prf.c
--- a/sys/kern/subr_prf.c       Wed Feb 08 17:25:56 2023 +0000
+++ b/sys/kern/subr_prf.c       Wed Feb 08 18:24:52 2023 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: subr_prf.c,v 1.196 2022/10/31 09:14:18 simonb Exp $    */
+/*     $NetBSD: subr_prf.c,v 1.196.2.1 2023/02/08 18:24:52 martin Exp $        */
 
 /*-
  * Copyright (c) 1986, 1988, 1991, 1993
@@ -37,7 +37,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: subr_prf.c,v 1.196 2022/10/31 09:14:18 simonb Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_prf.c,v 1.196.2.1 2023/02/08 18:24:52 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ddb.h"
@@ -401,6 +401,7 @@
 {
        struct tty *ctp;
        int s;
+       bool do_ps = !cold;
 
        ctp = NULL;     /* XXX gcc i386 -Os */
 
@@ -408,7 +409,8 @@
         * 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 @@
        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



Home | Main Index | Thread Index | Old Index