Date: Mon, 9 Sep 2019 12:42:48 +0000 (UTC) From: Konstantin Belousov <kib@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r352060 - head/sys/kern Message-ID: <201909091242.x89CgmJr008986@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: kib Date: Mon Sep 9 12:42:48 2019 New Revision: 352060 URL: https://svnweb.freebsd.org/changeset/base/352060 Log: Initialize timehands linkage much earlier. Reported and tested by: trasz Sponsored by: The FreeBSD Foundation MFC after: 1 week Modified: head/sys/kern/kern_tc.c Modified: head/sys/kern/kern_tc.c ============================================================================== --- head/sys/kern/kern_tc.c Mon Sep 9 11:29:58 2019 (r352059) +++ head/sys/kern/kern_tc.c Mon Sep 9 12:42:48 2019 (r352060) @@ -113,7 +113,8 @@ SYSCTL_INT(_kern_timecounter, OID_AUTO, stepwarnings, ×tepwarnings, 0, "Log time steps"); static int timehands_count = 2; -SYSCTL_INT(_kern_timecounter, OID_AUTO, timehands_count, CTLFLAG_RDTUN, +SYSCTL_INT(_kern_timecounter, OID_AUTO, timehands_count, + CTLFLAG_RDTUN | CTLFLAG_NOFETCH, &timehands_count, 0, "Count of timehands in rotation"); struct bintime bt_timethreshold; @@ -1958,12 +1959,30 @@ done: return (0); } +/* Set up the requested number of timehands. */ static void -inittimecounter(void *dummy) +inittimehands(void *dummy) { struct timehands *thp; + int i; + + TUNABLE_INT_FETCH("kern.timecounter.timehands_count", + &timehands_count); + if (timehands_count < 1) + timehands_count = 1; + if (timehands_count > nitems(ths)) + timehands_count = nitems(ths); + for (i = 1, thp = &ths[0]; i < timehands_count; thp = &ths[i++]) + thp->th_next = &ths[i]; + thp->th_next = &ths[0]; +} +SYSINIT(timehands, SI_SUB_TUNABLES, SI_ORDER_ANY, inittimehands, NULL); + +static void +inittimecounter(void *dummy) +{ u_int p; - int i, tick_rate; + int tick_rate; /* * Set the initial timeout to @@ -1989,15 +2008,6 @@ inittimecounter(void *dummy) #ifdef FFCLOCK ffclock_init(); #endif - - /* Set up the requested number of timehands. */ - if (timehands_count < 1) - timehands_count = 1; - if (timehands_count > nitems(ths)) - timehands_count = nitems(ths); - for (i = 1, thp = &ths[0]; i < timehands_count; thp = &ths[i++]) - thp->th_next = &ths[i]; - thp->th_next = &ths[0]; /* warm up new timecounter (again) and get rolling. */ (void)timecounter->tc_get_timecount(timecounter);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201909091242.x89CgmJr008986>