Source-Changes-HG archive

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

[src/trunk]: src/sys/kern Now that we know if we're shutting down, enable loc...



details:   https://anonhg.NetBSD.org/src/rev/b204c6e34663
branches:  trunk
changeset: 847711:b204c6e34663
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Wed Jan 01 23:15:24 2020 +0000

description:
Now that we know if we're shutting down, enable locking in resettodr().
In the shutting_down case, we acquire the todr_mutex as a trylock.  Under
most circumstances, this lock will be uncontended.  But if we happen to
panic while accessing the TOD clock (via clock_settime() or whatever),
then trylock will prevent us from getting stuck (and a warning will be
displayed on the console).

diffstat:

 sys/kern/kern_todr.c |  10 ++--------
 1 files changed, 2 insertions(+), 8 deletions(-)

diffs (48 lines):

diff -r 14836877d25a -r b204c6e34663 sys/kern/kern_todr.c
--- a/sys/kern/kern_todr.c      Wed Jan 01 23:07:38 2020 +0000
+++ b/sys/kern/kern_todr.c      Wed Jan 01 23:15:24 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: kern_todr.c,v 1.44 2020/01/01 21:09:11 thorpej Exp $   */
+/*     $NetBSD: kern_todr.c,v 1.45 2020/01/01 23:15:24 thorpej Exp $   */
 
 /*-
  * Copyright (c) 2020 The NetBSD Foundation, Inc.
@@ -70,7 +70,7 @@
 #include "opt_todr.h"
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_todr.c,v 1.44 2020/01/01 21:09:11 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_todr.c,v 1.45 2020/01/01 23:15:24 thorpej Exp $");
 
 #include <sys/param.h>
 #include <sys/kernel.h>
@@ -283,9 +283,7 @@
 {
        struct timeval tv;
 
-#if notyet
        KASSERT(todr_lock_owned());
-#endif
 
        /*
         * We might have been called by boot() due to a crash early
@@ -326,7 +324,6 @@
 resettodr(void)
 {
 
-#if notyet
        /*
         * If we're shutting down, we don't want to get stuck in case
         * someone was already fiddling with the TOD clock.
@@ -339,11 +336,8 @@
        } else {
                todr_lock();
        }
-#endif
        todr_save_systime();
-#if notyet
        todr_unlock();
-#endif
 }
 
 #ifdef TODR_DEBUG



Home | Main Index | Thread Index | Old Index