Source-Changes-HG archive

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

[src/trunk]: src/sys/kern Make sure the kprintf_slock is initialized, and use...



details:   https://anonhg.NetBSD.org/src/rev/1f99d132be37
branches:  trunk
changeset: 474958:1f99d132be37
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Tue Jul 27 21:50:37 1999 +0000

description:
Make sure the kprintf_slock is initialized, and use the low-level atomic
locking primitive directly to lock it, since those will never attempt
to call printf() to display debugging information (and thus deadlock
on recursion into the kprintf_slock).

diffstat:

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

diffs (35 lines):

diff -r a3bdafeb3d59 -r 1f99d132be37 sys/kern/subr_prf.c
--- a/sys/kern/subr_prf.c       Tue Jul 27 21:45:39 1999 +0000
+++ b/sys/kern/subr_prf.c       Tue Jul 27 21:50:37 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: subr_prf.c,v 1.62 1999/02/12 00:46:11 thorpej Exp $    */
+/*     $NetBSD: subr_prf.c,v 1.63 1999/07/27 21:50:37 thorpej Exp $    */
 
 /*-
  * Copyright (c) 1986, 1988, 1991, 1993
@@ -67,17 +67,22 @@
 #endif
 
 #if defined(MULTIPROCESSOR)
-struct simplelock kprintf_slock;
+struct simplelock kprintf_slock = SIMPLELOCK_INITIALIZER;
 
+/*
+ * Use cpu_simple_lock() and cpu_simple_unlock().  These are the actual
+ * atomic locking operations, and never attempt to print debugging
+ * information.
+ */
 #define        KPRINTF_MUTEX_ENTER(s)                                          \
 do {                                                                   \
        (s) = splhigh();                                                \
-       simple_lock(&kprintf_slock);                                    \
+       cpu_simple_lock(&kprintf_slock);                                \
 } while (0)
 
 #define        KPRINTF_MUTEX_EXIT(s)                                           \
 do {                                                                   \
-       simple_unlock(&kprintf_slock);                                  \
+       cpu_simple_unlock(&kprintf_slock);                              \
        splx((s));                                                      \
 } while (0)
 #else /* ! MULTIPROCESSOR */



Home | Main Index | Thread Index | Old Index