svn commit: r239036 - head/sys/kern

Alexander Motin mav at FreeBSD.org
Sat Aug 4 08:06:38 UTC 2012


Author: mav
Date: Sat Aug  4 08:06:37 2012
New Revision: 239036
URL: http://svn.freebsd.org/changeset/base/239036

Log:
  Particlly MFcalloutng r238425 (by davide):
  Fix an issue related to old periodic timers. The code in kern_clocksource.c
  uses interrupt to keep track of time, and this time may not match with
  binuptime(). In order to address such incoherency, switch periodic timers
  to binuptime().
  
  Except further calloutng it is needed for already present cyclic subsystem.

Modified:
  head/sys/kern/kern_clocksource.c

Modified: head/sys/kern/kern_clocksource.c
==============================================================================
--- head/sys/kern/kern_clocksource.c	Sat Aug  4 08:03:30 2012	(r239035)
+++ head/sys/kern/kern_clocksource.c	Sat Aug  4 08:06:37 2012	(r239036)
@@ -356,13 +356,12 @@ timercb(struct eventtimer *et, void *arg
 		next = &state->nexttick;
 	} else
 		next = &nexttick;
-	if (periodic) {
-		now = *next;	/* Ex-next tick time becomes present time. */
+	binuptime(&now); 
+	if (periodic) { 
+		*next = now;
 		bintime_addx(next, timerperiod.frac); /* Next tick in 1 period. */
-	} else {
-		binuptime(&now);	/* Get present time from hardware. */
-		next->sec = -1;		/* Next tick is not scheduled yet. */
-	}
+	} else
+		next->sec = -1;	/* Next tick is not scheduled yet. */
 	state->now = now;
 	CTR4(KTR_SPARE2, "intr at %d:    now  %d.%08x%08x",
 	    curcpu, (int)(now.sec), (u_int)(now.frac >> 32),
@@ -714,11 +713,7 @@ cpu_initclocks_ap(void)
 	state = DPCPU_PTR(timerstate);
 	binuptime(&now);
 	ET_HW_LOCK(state);
-	if ((timer->et_flags & ET_FLAGS_PERCPU) == 0 && periodic) {
-		state->now = nexttick;
-		bintime_sub(&state->now, &timerperiod);
-	} else
-		state->now = now;
+	state->now = now;
 	hardclock_sync(curcpu);
 	handleevents(&state->now, 2);
 	if (timer->et_flags & ET_FLAGS_PERCPU)


More information about the svn-src-all mailing list