summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKonstantin Belousov <kib@FreeBSD.org>2019-09-09 12:42:48 +0000
committerSebastian Huber <sebastian.huber@embedded-brains.de>2021-11-15 08:56:53 +0100
commitb825e213c374724d9a055e3f998edbb3130393aa (patch)
tree5d1ab94ff7a34f04d0cdbceb3fe54a31c5852191
parentMake timehands count selectable at boottime. (diff)
downloadrtems-b825e213c374724d9a055e3f998edbb3130393aa.tar.bz2
Initialize timehands linkage much earlier.
Reported and tested by: trasz Sponsored by: The FreeBSD Foundation MFC after: 1 week
-rw-r--r--cpukit/score/src/kern_tc.c34
1 files changed, 22 insertions, 12 deletions
diff --git a/cpukit/score/src/kern_tc.c b/cpukit/score/src/kern_tc.c
index 88680db2c3..28a936232b 100644
--- a/cpukit/score/src/kern_tc.c
+++ b/cpukit/score/src/kern_tc.c
@@ -262,7 +262,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;
@@ -2259,12 +2260,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
@@ -2291,15 +2310,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);