Page MenuHomeFreeBSD

D29122.diff
No OneTemporary

D29122.diff

diff --git a/sys/kern/kern_tc.c b/sys/kern/kern_tc.c
--- a/sys/kern/kern_tc.c
+++ b/sys/kern/kern_tc.c
@@ -141,6 +141,7 @@
volatile int rtc_generation = 1;
static int tc_chosen; /* Non-zero if a specific tc was chosen via sysctl. */
+static char tc_from_tunable[16];
static void tc_windup(struct bintime *new_boottimebin);
static void cpu_tick_calibrate(int);
@@ -1215,11 +1216,17 @@
return;
if (tc->tc_quality < 0)
return;
- if (tc->tc_quality < timecounter->tc_quality)
- return;
- if (tc->tc_quality == timecounter->tc_quality &&
- tc->tc_frequency < timecounter->tc_frequency)
- return;
+ if (tc_from_tunable[0] != '\0' &&
+ strcmp(tc->tc_name, tc_from_tunable) == 0) {
+ tc_chosen = 1;
+ tc_from_tunable[0] = '\0';
+ } else {
+ if (tc->tc_quality < timecounter->tc_quality)
+ return;
+ if (tc->tc_quality == timecounter->tc_quality &&
+ tc->tc_frequency < timecounter->tc_frequency)
+ return;
+ }
(void)tc->tc_get_timecount(tc);
timecounter = tc;
}
@@ -1500,7 +1507,7 @@
}
SYSCTL_PROC(_kern_timecounter, OID_AUTO, hardware,
- CTLTYPE_STRING | CTLFLAG_RW | CTLFLAG_MPSAFE, 0, 0,
+ CTLTYPE_STRING | CTLFLAG_RWTUN | CTLFLAG_NOFETCH | CTLFLAG_MPSAFE, 0, 0,
sysctl_kern_timecounter_hardware, "A",
"Timecounter hardware selected");
@@ -1940,6 +1947,9 @@
for (i = 1, thp = &ths[0]; i < timehands_count; thp = &ths[i++])
thp->th_next = &ths[i];
thp->th_next = &ths[0];
+
+ TUNABLE_STR_FETCH("kern.timecounter.hardware", tc_from_tunable,
+ sizeof(tc_from_tunable));
}
SYSINIT(timehands, SI_SUB_TUNABLES, SI_ORDER_ANY, inittimehands, NULL);

File Metadata

Mime Type
text/plain
Expires
Fri, Nov 8, 9:54 PM (20 h, 56 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
14543741
Default Alt Text
D29122.diff (1 KB)

Event Timeline