summaryrefslogtreecommitdiffstats
path: root/sys/x86
diff options
context:
space:
mode:
authorjkim <jkim@FreeBSD.org>2011-06-22 16:40:45 +0000
committerjkim <jkim@FreeBSD.org>2011-06-22 16:40:45 +0000
commit6da60ac39ebac7fcdb953979962ecb5f7658196a (patch)
tree6b94ee5ab496f2fdf62f7cc9586df69cb8a162a4 /sys/x86
parenta0627f2e3f8b11a06d848f46dcd73032ded3bf5f (diff)
downloadFreeBSD-src-6da60ac39ebac7fcdb953979962ecb5f7658196a.zip
FreeBSD-src-6da60ac39ebac7fcdb953979962ecb5f7658196a.tar.gz
Set negative quality to TSC timecounter when C3 state is enabled for Intel
processors unless the invariant TSC bit of CPUID is set. Intel processors may stop incrementing TSC when DPSLP# pin is asserted, according to Intel processor manuals, i. e., TSC timecounter is useless if the processor can enter deep sleep state (C3/C4). This problem was accidentally uncovered by r222869, which increased timecounter quality of P-state invariant TSC, e.g., for Core2 Duo T5870 (Family 6, Model f) and Atom N270 (Family 6, Model 1c). Reported by: Fabian Keil (freebsd-listen at fabiankeil dot de) Ian FREISLICH (ianf at clue dot co dot za) Tested by: Fabian Keil (freebsd-listen at fabiankeil dot de) - Core2 Duo T5870 (C3 state available/enabled) jkim - Xeon X5150 (C3 state unavailable)
Diffstat (limited to 'sys/x86')
-rw-r--r--sys/x86/x86/tsc.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/sys/x86/x86/tsc.c b/sys/x86/x86/tsc.c
index 9501eee..5f17f62 100644
--- a/sys/x86/x86/tsc.c
+++ b/sys/x86/x86/tsc.c
@@ -444,6 +444,19 @@ init_TSC_tc(void)
goto init;
}
+ /*
+ * We cannot use the TSC if it stops incrementing in deep sleep.
+ * Currently only Intel CPUs are known for this problem unless
+ * the invariant TSC bit is set.
+ */
+ if (cpu_can_deep_sleep && cpu_vendor_id == CPU_VENDOR_INTEL &&
+ (amd_pminfo & AMDPM_TSC_INVARIANT) == 0) {
+ tsc_timecounter.tc_quality = -1000;
+ if (bootverbose)
+ printf("TSC timecounter disabled: C3 enabled.\n");
+ goto init;
+ }
+
#ifdef SMP
/*
* We can not use the TSC in SMP mode unless the TSCs on all CPUs are
OpenPOWER on IntegriCloud