Module Name: src Committed By: riastradh Date: Sat Jun 30 22:47:51 UTC 2018
Modified Files: src/sys/kern: kern_ntptime.c kern_tc.c Log Message: 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. To generate a diff of this commit: cvs rdiff -u -r1.57 -r1.58 src/sys/kern/kern_ntptime.c cvs rdiff -u -r1.49 -r1.50 src/sys/kern/kern_tc.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_ntptime.c diff -u src/sys/kern/kern_ntptime.c:1.57 src/sys/kern/kern_ntptime.c:1.58 --- src/sys/kern/kern_ntptime.c:1.57 Mon Nov 23 23:45:44 2015 +++ src/sys/kern/kern_ntptime.c Sat Jun 30 22:47:51 2018 @@ -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 @@ ntp_update_second(int64_t *adjustment, t int tickrate; l_fp ftemp; /* 32/64-bit temporary */ - KASSERT(mutex_owned(&timecounter_lock)); + KASSERT(__predict_false(cold) || mutex_owned(&timecounter_lock)); #ifdef NTP Index: src/sys/kern/kern_tc.c diff -u src/sys/kern/kern_tc.c:1.49 src/sys/kern/kern_tc.c:1.50 --- src/sys/kern/kern_tc.c:1.49 Tue Feb 13 09:26:17 2018 +++ src/sys/kern/kern_tc.c Sat Jun 30 22:47:51 2018 @@ -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 @@ tc_pick(void) { 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 @@ tc_windup(void) 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 @@ tc_ticktock(void) 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_ticktock(void) } } tc_windup(); - mutex_spin_exit(&timecounter_lock); + if (__predict_true(!cold)) + mutex_spin_exit(&timecounter_lock); } void