From owner-svn-src-head@FreeBSD.ORG Wed Jul 25 07:20:06 2012 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 268E9106566B; Wed, 25 Jul 2012 07:20:06 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from citadel.icyb.net.ua (citadel.icyb.net.ua [212.40.38.140]) by mx1.freebsd.org (Postfix) with ESMTP id 9ED228FC08; Wed, 25 Jul 2012 07:20:04 +0000 (UTC) Received: from porto.starpoint.kiev.ua (porto-e.starpoint.kiev.ua [212.40.38.100]) by citadel.icyb.net.ua (8.8.8p3/ICyb-2.3exp) with ESMTP id KAA13077; Wed, 25 Jul 2012 10:20:03 +0300 (EEST) (envelope-from avg@FreeBSD.org) Received: from localhost ([127.0.0.1]) by porto.starpoint.kiev.ua with esmtp (Exim 4.34 (FreeBSD)) id 1Stvt5-0008B5-2u; Wed, 25 Jul 2012 10:20:03 +0300 Message-ID: <500F9E22.4080608@FreeBSD.org> Date: Wed, 25 Jul 2012 10:20:02 +0300 From: Andriy Gapon User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:13.0) Gecko/20120620 Thunderbird/13.0.1 MIME-Version: 1.0 To: Jim Harris References: <201207242210.q6OMACqV079603@svn.freebsd.org> In-Reply-To: <201207242210.q6OMACqV079603@svn.freebsd.org> X-Enigmail-Version: 1.4.2 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r238755 - head/sys/x86/x86 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: Wed, 25 Jul 2012 07:20:06 -0000 on 25/07/2012 01:10 Jim Harris said the following: > Author: jimharris > Date: Tue Jul 24 22:10:11 2012 > New Revision: 238755 > URL: http://svn.freebsd.org/changeset/base/238755 > > Log: > Add rmb() to tsc_read_##x to enforce serialization of rdtsc captures. > > Intel Architecture Manual specifies that rdtsc instruction is not serialized, > so without this change, TSC synchronization test would periodically fail, > resulting in use of HPET timecounter instead of TSC-low. This caused > severe performance degradation (40-50%) when running high IO/s workloads due to > HPET MMIO reads and GEOM stat collection. > > Tests on Xeon E5-2600 (Sandy Bridge) 8C systems were seeing TSC synchronization > fail approximately 20% of the time. Should rather the synchronization test be fixed if it's the culprit? Or is this change universally good for the real uses of TSC? > Sponsored by: Intel > Reviewed by: kib > MFC after: 3 days > > Modified: > head/sys/x86/x86/tsc.c > > Modified: head/sys/x86/x86/tsc.c > ============================================================================== > --- head/sys/x86/x86/tsc.c Tue Jul 24 20:15:41 2012 (r238754) > +++ head/sys/x86/x86/tsc.c Tue Jul 24 22:10:11 2012 (r238755) > @@ -328,6 +328,7 @@ init_TSC(void) > > #ifdef SMP > > +/* rmb is required here because rdtsc is not a serializing instruction. */ > #define TSC_READ(x) \ > static void \ > tsc_read_##x(void *arg) \ > @@ -335,6 +336,7 @@ tsc_read_##x(void *arg) \ > uint32_t *tsc = arg; \ > u_int cpu = PCPU_GET(cpuid); \ > \ > + rmb(); \ > tsc[cpu * 3 + x] = rdtsc32(); \ > } > TSC_READ(0) > -- Andriy Gapon