Author: mav
Date: Tue Sep 21 16:50:24 2010
New Revision: 212967
URL: http://svn.freebsd.org/changeset/base/212967
Log:
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.
Modified:
head/sys/kern/kern_clocksource.c
Modified: head/sys/kern/kern_clocksource.c
==============================================================================
--- head/sys/kern/kern_clocksource.c Tue Sep 21 16:49:02 2010
(r212966)
+++ head/sys/kern/kern_clocksource.c Tue Sep 21 16:50:24 2010
(r212967)
@@ -117,7 +117,8 @@ SYSCTL_INT(_kern_eventtimer, OID_AUTO, i
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_HAND
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_H
return (error);
ET_LOCK();
configtimer(0);
- periodic = val;
+ periodic = want_periodic = val;
configtimer(1);
ET_UNLOCK();
return (error);
_______________________________________________
[email protected] mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "[email protected]"