svn commit: r236566 - in head/sys/cddl/dev/dtrace: amd64 i386

Zachary Loafman zml at FreeBSD.org
Mon Jun 4 16:04:02 UTC 2012


Author: zml
Date: Mon Jun  4 16:04:01 2012
New Revision: 236566
URL: http://svn.freebsd.org/changeset/base/236566

Log:
  Fix DTrace TSC skew calculation:
  
  The skew calculation here is exactly backwards. We were able to repro
  it on a multi-package ESX server running a FreeBSD VM, where the TSCs
  can be pretty evil.
  
  MFC after: 1 week
  
  Submitted by: Jeff Ford <jeffrey.ford2 at isilon.com>
  Reviewed by: avg, gnn

Modified:
  head/sys/cddl/dev/dtrace/amd64/dtrace_subr.c
  head/sys/cddl/dev/dtrace/i386/dtrace_subr.c

Modified: head/sys/cddl/dev/dtrace/amd64/dtrace_subr.c
==============================================================================
--- head/sys/cddl/dev/dtrace/amd64/dtrace_subr.c	Mon Jun  4 15:21:13 2012	(r236565)
+++ head/sys/cddl/dev/dtrace/amd64/dtrace_subr.c	Mon Jun  4 16:04:01 2012	(r236566)
@@ -446,7 +446,7 @@ dtrace_gethrtime()
 	 * (see nsec_scale calculations) taking into account 32-bit shift of
 	 * the higher half and finally add.
 	 */
-	tsc = rdtsc() + tsc_skew[curcpu];
+	tsc = rdtsc() - tsc_skew[curcpu];
 	lo = tsc;
 	hi = tsc >> 32;
 	return (((lo * nsec_scale) >> SCALE_SHIFT) +

Modified: head/sys/cddl/dev/dtrace/i386/dtrace_subr.c
==============================================================================
--- head/sys/cddl/dev/dtrace/i386/dtrace_subr.c	Mon Jun  4 15:21:13 2012	(r236565)
+++ head/sys/cddl/dev/dtrace/i386/dtrace_subr.c	Mon Jun  4 16:04:01 2012	(r236566)
@@ -447,7 +447,7 @@ dtrace_gethrtime()
 	 * (see nsec_scale calculations) taking into account 32-bit shift of
 	 * the higher half and finally add.
 	 */
-	tsc = rdtsc() + tsc_skew[curcpu];
+	tsc = rdtsc() - tsc_skew[curcpu];
 	lo = tsc;
 	hi = tsc >> 32;
 	return (((lo * nsec_scale) >> SCALE_SHIFT) +


More information about the svn-src-head mailing list