[Midnightbsd-cvs] src [7857] trunk/sys/x86/x86/tsc.c: Add rmb() to tsc_read_##x to enforce serialization of rdtsc captures.
laffer1 at midnightbsd.org
laffer1 at midnightbsd.org
Wed Sep 14 12:05:04 EDT 2016
Revision: 7857
http://svnweb.midnightbsd.org/src/?rev=7857
Author: laffer1
Date: 2016-09-14 12:05:04 -0400 (Wed, 14 Sep 2016)
Log Message:
-----------
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.
Obtained from: FreeBSD 9 stable svn rev 283910
Revision Links:
--------------
http://svnweb.midnightbsd.org/src/?rev=283910
Modified Paths:
--------------
trunk/sys/x86/x86/tsc.c
Modified: trunk/sys/x86/x86/tsc.c
===================================================================
--- trunk/sys/x86/x86/tsc.c 2016-09-14 16:02:26 UTC (rev 7856)
+++ trunk/sys/x86/x86/tsc.c 2016-09-14 16:05:04 UTC (rev 7857)
@@ -326,6 +326,7 @@
#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 @@
uint32_t *tsc = arg; \
u_int cpu = PCPU_GET(cpuid); \
\
+ rmb(); \
tsc[cpu * 3 + x] = rdtsc32(); \
}
TSC_READ(0)
More information about the Midnightbsd-cvs
mailing list