diff --git a/sys/kern/kern_clocksource.c b/sys/kern/kern_clocksource.c index eb20a4068503..455564b61979 100644 --- a/sys/kern/kern_clocksource.c +++ b/sys/kern/kern_clocksource.c @@ -117,7 +117,8 @@ SYSCTL_INT(_kern_eventtimer, OID_AUTO, idletick, CTLFLAG_RW, &idletick, 0, "Run periodic events when idle"); static int periodic = 0; /* Periodic or one-shot mode. */ -TUNABLE_INT("kern.eventtimer.periodic", &periodic); +static int want_periodic = 0; /* What mode to prefer. */ +TUNABLE_INT("kern.eventtimer.periodic", &want_periodic); struct pcpu_state { struct mtx et_hw_mtx; /* Per-CPU timer mutex. */ @@ -587,6 +588,7 @@ cpu_initclocks_bsp(void) #ifdef SMP callout_new_inserted = cpu_new_callout; #endif + periodic = want_periodic; /* Grab requested timer or the best of present. */ if (timername[0]) timer = et_find(timername, 0, 0); @@ -841,6 +843,7 @@ sysctl_kern_eventtimer_timer(SYSCTL_HANDLER_ARGS) cpu_disable_deep_sleep++; if (timer->et_flags & ET_FLAGS_C3STOP) cpu_disable_deep_sleep--; + periodic = want_periodic; timer = et; et_init(timer, timercb, NULL, NULL); configtimer(1); @@ -865,7 +868,7 @@ sysctl_kern_eventtimer_periodic(SYSCTL_HANDLER_ARGS) return (error); ET_LOCK(); configtimer(0); - periodic = val; + periodic = want_periodic = val; configtimer(1); ET_UNLOCK(); return (error);