Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 7 Aug 2012 23:16:12 +0000 (UTC)
From:      Jim Harris <jimharris@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r239133 - head/sys/x86/x86
Message-ID:  <201208072316.q77NGC2s016536@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jimharris
Date: Tue Aug  7 23:16:11 2012
New Revision: 239133
URL: http://svn.freebsd.org/changeset/base/239133

Log:
  During TSC synchronization test, use rdtsc() rather than rdtsc32(), to
  protect against 32-bit TSC overflow while the sync test is running.
  
  On dual-socket Xeon E5-2600 (SNB) systems with up to 32 threads, there
  is non-trivial chance (2-3%) that TSC synchronization test fails due to
  32-bit TSC overflow while the synchronization test is running.
  
  Sponsored by: Intel
  Reviewed by: jkim
  Discussed with: jkim, kib

Modified:
  head/sys/x86/x86/tsc.c

Modified: head/sys/x86/x86/tsc.c
==============================================================================
--- head/sys/x86/x86/tsc.c	Tue Aug  7 20:16:10 2012	(r239132)
+++ head/sys/x86/x86/tsc.c	Tue Aug  7 23:16:11 2012	(r239133)
@@ -363,11 +363,11 @@ init_TSC(void)
 static void								\
 tsc_read_##x(void *arg)							\
 {									\
-	uint32_t *tsc = arg;						\
+	uint64_t *tsc = arg;						\
 	u_int cpu = PCPU_GET(cpuid);					\
 									\
 	__asm __volatile("cpuid" : : : "eax", "ebx", "ecx", "edx");	\
-	tsc[cpu * 3 + x] = rdtsc32();					\
+	tsc[cpu * 3 + x] = rdtsc();					\
 }
 TSC_READ(0)
 TSC_READ(1)
@@ -379,8 +379,8 @@ TSC_READ(2)
 static void
 comp_smp_tsc(void *arg)
 {
-	uint32_t *tsc;
-	int32_t d1, d2;
+	uint64_t *tsc;
+	int64_t d1, d2;
 	u_int cpu = PCPU_GET(cpuid);
 	u_int i, j, size;
 
@@ -401,7 +401,7 @@ comp_smp_tsc(void *arg)
 static int
 test_smp_tsc(void)
 {
-	uint32_t *data, *tsc;
+	uint64_t *data, *tsc;
 	u_int i, size;
 
 	if (!smp_tsc && !tsc_is_invariant)



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