Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 8 Dec 2010 23:40:41 +0000 (UTC)
From:      Jung-uk Kim <jkim@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r216312 - in head/sys: amd64/amd64 i386/i386 pc98/pc98
Message-ID:  <201012082340.oB8Nefff018113@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jkim
Date: Wed Dec  8 23:40:41 2010
New Revision: 216312
URL: http://svn.freebsd.org/changeset/base/216312

Log:
  Do not subtract 0.5% from estimated frequency if DELAY(9) is driven by TSC.
  Remove a confusing comment about converting to MHz as we never did.

Modified:
  head/sys/amd64/amd64/machdep.c
  head/sys/i386/i386/machdep.c
  head/sys/pc98/pc98/machdep.c

Modified: head/sys/amd64/amd64/machdep.c
==============================================================================
--- head/sys/amd64/amd64/machdep.c	Wed Dec  8 22:54:18 2010	(r216311)
+++ head/sys/amd64/amd64/machdep.c	Wed Dec  8 23:40:41 2010	(r216312)
@@ -563,13 +563,7 @@ cpu_est_clockrate(int cpu_id, uint64_t *
 	thread_unlock(curthread);
 #endif
 
-	/*
-	 * Calculate the difference in readings, convert to Mhz, and
-	 * subtract 0.5% of the total.  Empirical testing has shown that
-	 * overhead in DELAY() works out to approximately this value.
-	 */
-	tsc2 -= tsc1;
-	*rate = tsc2 * 1000 - tsc2 * 5;
+	*rate = (tsc2 - tsc1) * 1000;
 	return (0);
 }
 

Modified: head/sys/i386/i386/machdep.c
==============================================================================
--- head/sys/i386/i386/machdep.c	Wed Dec  8 22:54:18 2010	(r216311)
+++ head/sys/i386/i386/machdep.c	Wed Dec  8 23:40:41 2010	(r216312)
@@ -1157,12 +1157,16 @@ cpu_est_clockrate(int cpu_id, uint64_t *
 	thread_unlock(curthread);
 #endif
 
+	tsc2 -= tsc1;
+	if (tsc_freq != 0 && !tsc_is_broken) {
+		*rate = tsc2 * 1000;
+		return (0);
+	}
+
 	/*
-	 * Calculate the difference in readings, convert to Mhz, and
-	 * subtract 0.5% of the total.  Empirical testing has shown that
+	 * Subtract 0.5% of the total.  Empirical testing has shown that
 	 * overhead in DELAY() works out to approximately this value.
 	 */
-	tsc2 -= tsc1;
 	*rate = tsc2 * 1000 - tsc2 * 5;
 	return (0);
 }

Modified: head/sys/pc98/pc98/machdep.c
==============================================================================
--- head/sys/pc98/pc98/machdep.c	Wed Dec  8 22:54:18 2010	(r216311)
+++ head/sys/pc98/pc98/machdep.c	Wed Dec  8 23:40:41 2010	(r216312)
@@ -1092,12 +1092,16 @@ cpu_est_clockrate(int cpu_id, uint64_t *
 	thread_unlock(curthread);
 #endif
 
+	tsc2 -= tsc1;
+	if (tsc_freq != 0 && !tsc_is_broken) {
+		*rate = tsc2 * 1000;
+		return (0);
+	}
+
 	/*
-	 * Calculate the difference in readings, convert to Mhz, and
-	 * subtract 0.5% of the total.  Empirical testing has shown that
+	 * Subtract 0.5% of the total.  Empirical testing has shown that
 	 * overhead in DELAY() works out to approximately this value.
 	 */
-	tsc2 -= tsc1;
 	*rate = tsc2 * 1000 - tsc2 * 5;
 	return (0);
 }



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