Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 30 Jul 2012 15:30:42 +0000 (UTC)
From:      Jim Harris <jimharris@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
Subject:   svn commit: r238910 - stable/9/sys/x86/x86
Message-ID:  <201207301530.q6UFUgkb007346@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jimharris
Date: Mon Jul 30 15:30:42 2012
New Revision: 238910
URL: http://svn.freebsd.org/changeset/base/238910

Log:
  MFC r238755:
  
  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.
  
  Sponsored by: Intel
  Approved by: re (kib)

Modified:
  stable/9/sys/x86/x86/tsc.c
Directory Properties:
  stable/9/sys/   (props changed)

Modified: stable/9/sys/x86/x86/tsc.c
==============================================================================
--- stable/9/sys/x86/x86/tsc.c	Mon Jul 30 14:47:35 2012	(r238909)
+++ stable/9/sys/x86/x86/tsc.c	Mon Jul 30 15:30:42 2012	(r238910)
@@ -326,6 +326,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)			\
@@ -333,6 +334,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)



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201207301530.q6UFUgkb007346>