Author: markj
Date: Sun May 11 16:48:36 2014
New Revision: 265882
URL: http://svnweb.freebsd.org/changeset/base/265882

Log:
  MFC r236566 (by zml):
  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.

Modified:
  stable/9/sys/cddl/dev/dtrace/amd64/dtrace_subr.c
  stable/9/sys/cddl/dev/dtrace/i386/dtrace_subr.c
Directory Properties:
  stable/9/sys/   (props changed)

Modified: stable/9/sys/cddl/dev/dtrace/amd64/dtrace_subr.c
==============================================================================
--- stable/9/sys/cddl/dev/dtrace/amd64/dtrace_subr.c    Sun May 11 16:34:17 
2014        (r265881)
+++ stable/9/sys/cddl/dev/dtrace/amd64/dtrace_subr.c    Sun May 11 16:48:36 
2014        (r265882)
@@ -445,7 +445,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: stable/9/sys/cddl/dev/dtrace/i386/dtrace_subr.c
==============================================================================
--- stable/9/sys/cddl/dev/dtrace/i386/dtrace_subr.c     Sun May 11 16:34:17 
2014        (r265881)
+++ stable/9/sys/cddl/dev/dtrace/i386/dtrace_subr.c     Sun May 11 16:48:36 
2014        (r265882)
@@ -454,7 +454,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-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to