From owner-svn-src-head@FreeBSD.ORG Sat Aug 4 08:06:37 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D6F3B106564A; Sat, 4 Aug 2012 08:06:37 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C1DFC8FC0C; Sat, 4 Aug 2012 08:06:37 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q7486bqk027751; Sat, 4 Aug 2012 08:06:37 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q7486bec027749; Sat, 4 Aug 2012 08:06:37 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201208040806.q7486bec027749@svn.freebsd.org> From: Alexander Motin Date: Sat, 4 Aug 2012 08:06:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239036 - head/sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 04 Aug 2012 08:06:38 -0000 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)