From owner-svn-src-all@FreeBSD.ORG Wed Jan 30 12:43:11 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 5A8AB46E; Wed, 30 Jan 2013 12:43:11 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 42CC6754; Wed, 30 Jan 2013 12:43:11 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r0UChA4o033315; Wed, 30 Jan 2013 12:43:10 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r0UChAbJ033314; Wed, 30 Jan 2013 12:43:10 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201301301243.r0UChAbJ033314@svn.freebsd.org> From: Konstantin Belousov Date: Wed, 30 Jan 2013 12:43:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r246116 - head/sys/x86/x86 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 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: Wed, 30 Jan 2013 12:43:11 -0000 Author: kib Date: Wed Jan 30 12:43:10 2013 New Revision: 246116 URL: http://svnweb.freebsd.org/changeset/base/246116 Log: Reduce default shift used to calculate the max frequency for the TSC timecounter to 1, and correspondingly increase the precision of the gettimeofday(2) and related functions in the default configuration. The motivation for the TSC-low timecounter, as described in the r222866, seems to provide a workaround for the non-serializing behaviour of the RDTSC on some Intel hardware. Tests demonstrate that even with the pre-shift of 8, the cross-core non-monotonicity of the RDTSC is still observed reliably, e.g. on the Nehalems. The r238755 and r238973 implemented the proper fix for the issue. The pre-shift of 1 is applied to keep TSC not overflowing for the frequency of hardclock down to 2 sec/intr. The pre-shift is made a tunable to allow the easy debugging of the issues users could see with the shift being too low. Reviewed by: bde MFC after: 2 weeks Modified: head/sys/x86/x86/tsc.c Modified: head/sys/x86/x86/tsc.c ============================================================================== --- head/sys/x86/x86/tsc.c Wed Jan 30 10:59:42 2013 (r246115) +++ head/sys/x86/x86/tsc.c Wed Jan 30 12:43:10 2013 (r246116) @@ -65,6 +65,12 @@ static int smp_tsc; SYSCTL_INT(_kern_timecounter, OID_AUTO, smp_tsc, CTLFLAG_RDTUN, &smp_tsc, 0, "Indicates whether the TSC is safe to use in SMP mode"); TUNABLE_INT("kern.timecounter.smp_tsc", &smp_tsc); + +static int smp_tsc_shift = 1; +SYSCTL_INT(_kern_timecounter, OID_AUTO, smp_tsc_shift, CTLFLAG_RDTUN, + &smp_tsc_shift, 0, + "Shift to pre-apply for the maximum TSC frequency in SMP mode"); +TUNABLE_INT("kern.timecounter.smp_tsc_shift", &smp_tsc_shift); #endif static int tsc_disabled; @@ -506,7 +512,7 @@ init_TSC_tc(void) tsc_timecounter.tc_quality = -100; } else { tsc_timecounter.tc_quality = test_smp_tsc(); - max_freq >>= 8; + max_freq >>= smp_tsc_shift; } } else #endif