Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/kern Sprinkle cold conditionals to make tc_ticktock befo...
details: https://anonhg.NetBSD.org/src/rev/8a4f332c43a6
branches: trunk
changeset: 323790:8a4f332c43a6
user: riastradh <riastradh%NetBSD.org@localhost>
date: Sat Jun 30 22:47:51 2018 +0000
description:
Sprinkle cold conditionals to make tc_ticktock before inittimecounter.
Enables Xen to boot again.
XXX Maybe we should have a tc_ticktock_cold instead or something so we
don't have to reach this far into the call graph.
diffstat:
sys/kern/kern_ntptime.c | 6 +++---
sys/kern/kern_tc.c | 14 ++++++++------
2 files changed, 11 insertions(+), 9 deletions(-)
diffs (83 lines):
diff -r f2d7a3e67ddb -r 8a4f332c43a6 sys/kern/kern_ntptime.c
--- a/sys/kern/kern_ntptime.c Sat Jun 30 20:53:30 2018 +0000
+++ b/sys/kern/kern_ntptime.c Sat Jun 30 22:47:51 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: kern_ntptime.c,v 1.57 2015/11/23 23:45:44 joerg Exp $ */
+/* $NetBSD: kern_ntptime.c,v 1.58 2018/06/30 22:47:51 riastradh Exp $ */
/*-
* Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -60,7 +60,7 @@
#include <sys/cdefs.h>
/* __FBSDID("$FreeBSD: src/sys/kern/kern_ntptime.c,v 1.59 2005/05/28 14:34:41 rwatson Exp $"); */
-__KERNEL_RCSID(0, "$NetBSD: kern_ntptime.c,v 1.57 2015/11/23 23:45:44 joerg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_ntptime.c,v 1.58 2018/06/30 22:47:51 riastradh Exp $");
#ifdef _KERNEL_OPT
#include "opt_ntp.h"
@@ -418,7 +418,7 @@
int tickrate;
l_fp ftemp; /* 32/64-bit temporary */
- KASSERT(mutex_owned(&timecounter_lock));
+ KASSERT(__predict_false(cold) || mutex_owned(&timecounter_lock));
#ifdef NTP
diff -r f2d7a3e67ddb -r 8a4f332c43a6 sys/kern/kern_tc.c
--- a/sys/kern/kern_tc.c Sat Jun 30 20:53:30 2018 +0000
+++ b/sys/kern/kern_tc.c Sat Jun 30 22:47:51 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: kern_tc.c,v 1.49 2018/02/13 09:26:17 maxv Exp $ */
+/* $NetBSD: kern_tc.c,v 1.50 2018/06/30 22:47:51 riastradh Exp $ */
/*-
* Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -40,7 +40,7 @@
#include <sys/cdefs.h>
/* __FBSDID("$FreeBSD: src/sys/kern/kern_tc.c,v 1.166 2005/09/19 22:16:31 andre Exp $"); */
-__KERNEL_RCSID(0, "$NetBSD: kern_tc.c,v 1.49 2018/02/13 09:26:17 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_tc.c,v 1.50 2018/06/30 22:47:51 riastradh Exp $");
#ifdef _KERNEL_OPT
#include "opt_ntp.h"
@@ -572,7 +572,7 @@
{
struct timecounter *best, *tc;
- KASSERT(mutex_owned(&timecounter_lock));
+ KASSERT(__predict_false(cold) || mutex_owned(&timecounter_lock));
for (best = tc = timecounters; tc != NULL; tc = tc->tc_next) {
if (tc->tc_quality > best->tc_quality)
@@ -731,7 +731,7 @@
int i, s_update;
time_t t;
- KASSERT(mutex_owned(&timecounter_lock));
+ KASSERT(__predict_false(cold) || mutex_owned(&timecounter_lock));
s_update = 0;
@@ -1308,7 +1308,8 @@
if (++count < tc_tick)
return;
count = 0;
- mutex_spin_enter(&timecounter_lock);
+ if (__predict_true(!cold))
+ mutex_spin_enter(&timecounter_lock);
if (timecounter_bad != 0) {
/* An existing timecounter has gone bad, pick a new one. */
(void)atomic_swap_uint(&timecounter_bad, 0);
@@ -1317,7 +1318,8 @@
}
}
tc_windup();
- mutex_spin_exit(&timecounter_lock);
+ if (__predict_true(!cold))
+ mutex_spin_exit(&timecounter_lock);
}
void
Home |
Main Index |
Thread Index |
Old Index