Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 4 Aug 2012 08:06:37 +0000 (UTC)
From:      Alexander Motin <mav@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r239036 - head/sys/kern
Message-ID:  <201208040806.q7486bec027749@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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)



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201208040806.q7486bec027749>