svn commit: r221703 - in head/sys: amd64/include i386/include x86/isa x86/x86

Jung-uk Kim jkim at FreeBSD.org
Mon May 9 17:53:03 UTC 2011


On Monday 09 May 2011 01:34 pm, Jung-uk Kim wrote:
> Author: jkim
> Date: Mon May  9 17:34:00 2011
> New Revision: 221703
> URL: http://svn.freebsd.org/changeset/base/221703
>
> Log:
>   Implement boot-time TSC synchronization test for SMP.  This test
> is executed when the user has indicated that the system has
> synchronized TSCs or it has P-state invariant TSCs.  For the former
> case, we may clear the tunable if it fails the test to prevent
> accidental foot-shooting.  For the latter case, we may set it if it
> passes the test to notify the user that it may be usable.

For now, we don't change TSC quality.  However, if it goes well, I am 
planning on committing the attached patch to change that.  If you 
experience any false detections, please report to me privately.

Please also note that we don't test TSC drifts across cores at 
run-time, so we may have to leave SMP TSC quality as is, i.e., 800.  
It is yet to be determined.  Please let me know what you think.

Thanks!

Jung-uk Kim
-------------- next part --------------
Index: sys/dev/acpica/acpi_hpet.c
===================================================================
--- sys/dev/acpica/acpi_hpet.c	(revision 221701)
+++ sys/dev/acpica/acpi_hpet.c	(working copy)
@@ -476,7 +476,7 @@ hpet_attach(device_t dev)
 		sc->tc.tc_get_timecount = hpet_get_timecount,
 		sc->tc.tc_counter_mask = ~0u,
 		sc->tc.tc_name = "HPET",
-		sc->tc.tc_quality = 900,
+		sc->tc.tc_quality = 950,
 		sc->tc.tc_frequency = sc->freq;
 		sc->tc.tc_priv = sc;
 		tc_init(&sc->tc);
Index: sys/dev/acpica/acpi_timer.c
===================================================================
--- sys/dev/acpica/acpi_timer.c	(revision 221701)
+++ sys/dev/acpica/acpi_timer.c	(working copy)
@@ -203,7 +203,7 @@ acpi_timer_probe(device_t dev)
     if (j == 10) {
 	acpi_timer_timecounter.tc_name = "ACPI-fast";
 	acpi_timer_timecounter.tc_get_timecount = acpi_timer_get_timecount;
-	acpi_timer_timecounter.tc_quality = 1000;
+	acpi_timer_timecounter.tc_quality = 900;
     } else {
 	acpi_timer_timecounter.tc_name = "ACPI-safe";
 	acpi_timer_timecounter.tc_get_timecount = acpi_timer_get_timecount_safe;
Index: sys/x86/x86/tsc.c
===================================================================
--- sys/x86/x86/tsc.c	(revision 221703)
+++ sys/x86/x86/tsc.c	(working copy)
@@ -385,7 +385,7 @@ test_smp_tsc(void)
 	if (bootverbose)
 		printf("SMP: %sed TSC synchronization test\n",
 		    smp_tsc ? "pass" : "fail");
-	return (smp_tsc ? 800 : -100);
+	return (smp_tsc ? 1000 : -100);
 }
 
 #undef N
@@ -422,9 +422,13 @@ init_TSC_tc(void)
 	 * synchronized.  If the user is sure that the system has synchronized
 	 * TSCs, set kern.timecounter.smp_tsc tunable to a non-zero value.
 	 */
-	if (smp_cpus > 1)
+	if (smp_cpus > 1) {
 		tsc_timecounter.tc_quality = test_smp_tsc();
+		goto init;
+	}
 #endif
+	if (tsc_is_invariant)
+		tsc_timecounter.tc_quality = 1000;
 init:
 	if (tsc_freq != 0) {
 		tsc_timecounter.tc_frequency = tsc_freq;


More information about the svn-src-head mailing list