Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 11 May 2014 16:48:36 +0000 (UTC)
From:      Mark Johnston <markj@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
Subject:   svn commit: r265882 - in stable/9/sys/cddl/dev/dtrace: amd64 i386
Message-ID:  <201405111648.s4BGmaPx071012@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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) +



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