1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-10-19 02:29:40 +00:00

Initialize timehands linkage much earlier.

Reported and tested by:	trasz
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
This commit is contained in:
Konstantin Belousov 2019-09-09 12:42:48 +00:00
parent 4b23dec4c2
commit 6c46ce7ea3
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=352060

View File

@ -113,7 +113,8 @@ SYSCTL_INT(_kern_timecounter, OID_AUTO, stepwarnings, CTLFLAG_RW,
&timestepwarnings, 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 @@ sysctl_kern_timecounter_adjprecision(SYSCTL_HANDLER_ARGS)
return (0);
}
/* Set up the requested number of timehands. */
static void
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)
{
struct timehands *thp;
u_int p;
int i, tick_rate;
int tick_rate;
/*
* Set the initial timeout to
@ -1990,15 +2009,6 @@ inittimecounter(void *dummy)
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);
(void)timecounter->tc_get_timecount(timecounter);