From owner-svn-src-all@FreeBSD.ORG Sat Dec 11 22:33:33 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E1CF0106566C; Sat, 11 Dec 2010 22:33:33 +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 D078E8FC16; Sat, 11 Dec 2010 22:33:33 +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 oBBMXXiW020069; Sat, 11 Dec 2010 22:33:33 GMT (envelope-from cperciva@svn.freebsd.org) Received: (from cperciva@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oBBMXX3W020067; Sat, 11 Dec 2010 22:33:33 GMT (envelope-from cperciva@svn.freebsd.org) Message-Id: <201012112233.oBBMXX3W020067@svn.freebsd.org> From: Colin Percival Date: Sat, 11 Dec 2010 22:33:33 +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: r216385 - head/sys/i386/xen X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 11 Dec 2010 22:33:34 -0000 Author: cperciva Date: Sat Dec 11 22:33:33 2010 New Revision: 216385 URL: http://svn.freebsd.org/changeset/base/216385 Log: Reduce the Xen timecounter from 1GHz to 2^-9 GHz, thereby increasing the timecounter period from 2^32 ns (~4.3s) to 2^41 ns (~36m39s). Some time sharing systems can skip clock interrupts for a few seconds when under load (e.g., if we've recently used more than our fair share of CPU and someone else wants a burst of CPU) and we were losing time in quanta of 2^32 ns due to timecounter wrapping. Increasing the timecounter period up to 2^41 ns is definitely overkill, but we still have microsecond timecounter precision, and anyone using paravirtualized hardware when they need submicrosecond timing is crazy. Modified: head/sys/i386/xen/clock.c Modified: head/sys/i386/xen/clock.c ============================================================================== --- head/sys/i386/xen/clock.c Sat Dec 11 22:13:29 2010 (r216384) +++ head/sys/i386/xen/clock.c Sat Dec 11 22:33:33 2010 (r216385) @@ -523,7 +523,8 @@ startrtclock() set_cyc2ns_scale(cpu_khz/1000); tsc_freq = cpu_khz * 1000; - timer_freq = xen_timecounter.tc_frequency = 1000000000LL; + timer_freq = 1000000000LL; + xen_timecounter.tc_frequency = timer_freq >> 9; tc_init(&xen_timecounter); rdtscll(alarm); @@ -830,7 +831,7 @@ xen_get_timecount(struct timecounter *tc clk = shadow->system_timestamp + get_nsec_offset(shadow); - return (uint32_t)(clk); + return (uint32_t)(clk >> 9); }