summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authorjake <jake@FreeBSD.org>2001-11-18 03:47:30 +0000
committerjake <jake@FreeBSD.org>2001-11-18 03:47:30 +0000
commit124cb8d90c0bf782723d75bef136e22f77ecc32d (patch)
treed22b2a6ae9f0a5b857f0b6824a8d5f6e514362d7 /sys
parent9d9f6eaeacd959c2636e0bf98a4e7163fc74a8e5 (diff)
downloadFreeBSD-src-124cb8d90c0bf782723d75bef136e22f77ecc32d.zip
FreeBSD-src-124cb8d90c0bf782723d75bef136e22f77ecc32d.tar.gz
Avoid missing ticks and hardclock stopping.
Submitted by: tmm
Diffstat (limited to 'sys')
-rw-r--r--sys/sparc64/sparc64/tick.c28
1 files changed, 27 insertions, 1 deletions
diff --git a/sys/sparc64/sparc64/tick.c b/sys/sparc64/sparc64/tick.c
index 19463ae..cd023ee 100644
--- a/sys/sparc64/sparc64/tick.c
+++ b/sys/sparc64/sparc64/tick.c
@@ -41,11 +41,37 @@ extern u_long tick_increment;
extern u_long tick_freq;
extern u_long tick_MHz;
+int tick_missed; /* statistics */
+
+#define TICK_GRACE 1000
+
void
tick_hardclock(struct clockframe *cf)
{
+ critical_t c;
+ int missed;
+ u_long next;
+
hardclock(cf);
- wr(asr23, rd(asr23) + tick_increment, 0);
+ /*
+ * Avoid stopping of hardclock in case we missed one tick period by
+ * ensuring that the the value of the next tick is at least TICK_GRACE
+ * ticks in the future.
+ * Missed ticks need to be accounted for by repeatedly calling
+ * hardclock.
+ */
+ missed = 0;
+ next = rd(asr23) + tick_increment;
+ c = critical_enter();
+ while (next < rd(tick) + TICK_GRACE) {
+ next += tick_increment;
+ missed++;
+ }
+ atomic_add_int(&tick_missed, missed);
+ wr(asr23, next, 0);
+ critical_exit(c);
+ for (; missed > 0; missed--)
+ hardclock(cf);
}
void
OpenPOWER on IntegriCloud