Remember last kern.eventtimer.periodic value, explicitly set by user.
If timer capabilities forcing us to change periodicity mode, try to restore it back later, as soon as new choosen timer capable to do it. Without this, timer change like HPET->RTC->HPET always results in enabling periodic mode.
This commit is contained in:
parent
6adc52306a
commit
afe41f2da7
@ -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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user