svn commit: r216312 - in head/sys: amd64/amd64 i386/i386 pc98/pc98

Jung-uk Kim jkim at FreeBSD.org
Wed Dec 8 23:40:42 UTC 2010


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);
 }


More information about the svn-src-all mailing list