From owner-svn-src-stable-8@FreeBSD.ORG Sun Nov 28 18:59:53 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 81459106564A; Sun, 28 Nov 2010 18:59:53 +0000 (UTC) (envelope-from cperciva@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6E27E8FC12; Sun, 28 Nov 2010 18:59:53 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oASIxrs4039263; Sun, 28 Nov 2010 18:59:53 GMT (envelope-from cperciva@svn.freebsd.org) Received: (from cperciva@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oASIxrgv039261; Sun, 28 Nov 2010 18:59:53 GMT (envelope-from cperciva@svn.freebsd.org) Message-Id: <201011281859.oASIxrgv039261@svn.freebsd.org> From: Colin Percival Date: Sun, 28 Nov 2010 18:59:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r216015 - stable/8/sys/kern X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 28 Nov 2010 18:59:53 -0000 Author: cperciva Date: Sun Nov 28 18:59:52 2010 New Revision: 216015 URL: http://svn.freebsd.org/changeset/base/216015 Log: MFC r215665,r215732: Don't lose seconds to integer overflow if we go more than one second between calls to tc_windup. Modified: stable/8/sys/kern/kern_tc.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/kern/kern_tc.c ============================================================================== --- stable/8/sys/kern/kern_tc.c Sun Nov 28 18:53:57 2010 (r216014) +++ stable/8/sys/kern/kern_tc.c Sun Nov 28 18:59:52 2010 (r216015) @@ -440,6 +440,16 @@ tc_windup(void) ncount = 0; th->th_offset_count += delta; th->th_offset_count &= th->th_counter->tc_counter_mask; + while (delta > th->th_counter->tc_frequency) { + /* Eat complete unadjusted seconds. */ + delta -= th->th_counter->tc_frequency; + th->th_offset.sec++; + } + if ((delta > th->th_counter->tc_frequency / 2) && + (th->th_scale * delta < ((uint64_t)1 << 63))) { + /* The product th_scale * delta just barely overflows. */ + th->th_offset.sec++; + } bintime_addx(&th->th_offset, th->th_scale * delta); /*