summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authorkensmith <kensmith@FreeBSD.org>2004-09-30 14:38:59 +0000
committerkensmith <kensmith@FreeBSD.org>2004-09-30 14:38:59 +0000
commitf4c1d5275dd61eabd8c17493871acfab71b620e0 (patch)
tree464a58de31473bc52f231e8c831d804b07f7e5b7 /sys
parentc445431dd64a4925befe57d5160b18c9b5c72c68 (diff)
downloadFreeBSD-src-f4c1d5275dd61eabd8c17493871acfab71b620e0.zip
FreeBSD-src-f4c1d5275dd61eabd8c17493871acfab71b620e0.tar.gz
This along with v1.6 of counter.c fixes some timecounter issues on
MP machines (hopefully). CPU timers are OK on UP machines but we don't keep the timers in sync on MP machines so if the CPU's timer is chosen as the primary timecounter it's possible for time to not be monotonically increasing because different CPU's counters may be used at different times. But the CPU's counters are otherwise one of the higher quality counters available. So, on UP machines we'll use a relatively high quality value but on MP machines we'll use a quality that should prevent the CPU's counters from being chosen. Requested by: green (who did the first version of the patch) Reviewed by: marius, green MFC after: 1 week
Diffstat (limited to 'sys')
-rw-r--r--sys/sparc64/sparc64/machdep.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/sys/sparc64/sparc64/machdep.c b/sys/sparc64/sparc64/machdep.c
index 582930d..f7f08c4 100644
--- a/sys/sparc64/sparc64/machdep.c
+++ b/sys/sparc64/sparc64/machdep.c
@@ -132,6 +132,16 @@ struct kva_md_info kmi;
u_long ofw_vec;
u_long ofw_tba;
+/*
+ * Note: timer quality for CPU's is set low to try and prevent them from
+ * being chosen as the primary timecounter. The CPU counters are not
+ * synchronized among the CPU's so in MP machines this causes problems
+ * when calculating the time. With this value the CPU's should only be
+ * chosen as the primary timecounter as a last resort.
+ */
+
+#define UP_TICK_QUALITY 1000
+#define MP_TICK_QUALITY -100
static struct timecounter tick_tc;
char sparc64_model[32];
@@ -174,6 +184,15 @@ cpu_startup(void *arg)
tick_tc.tc_counter_mask = ~0u;
tick_tc.tc_frequency = tick_freq;
tick_tc.tc_name = "tick";
+ tick_tc.tc_quality = UP_TICK_QUALITY;
+#ifdef SMP
+ /*
+ * We do not know if each CPU's tick counter is synchronized.
+ */
+ if (cpu_mp_probe())
+ tick_tc.tc_quality = MP_TICK_QUALITY;
+#endif
+
tc_init(&tick_tc);
physsz = 0;
OpenPOWER on IntegriCloud