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.fo...@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) +
_______________________________________________
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to