Module Name: src
Committed By: thorpej
Date: Wed Jan 1 23:15:24 UTC 2020
Modified Files:
src/sys/kern: kern_todr.c
Log Message:
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).
To generate a diff of this commit:
cvs rdiff -u -r1.44 -r1.45 src/sys/kern/kern_todr.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/kern/kern_todr.c
diff -u src/sys/kern/kern_todr.c:1.44 src/sys/kern/kern_todr.c:1.45
--- src/sys/kern/kern_todr.c:1.44 Wed Jan 1 21:09:11 2020
+++ src/sys/kern/kern_todr.c Wed Jan 1 23:15:24 2020
@@ -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 @@ todr_save_systime(void)
{
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 @@ void
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 @@ resettodr(void)
} else {
todr_lock();
}
-#endif
todr_save_systime();
-#if notyet
todr_unlock();
-#endif
}
#ifdef TODR_DEBUG