Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/arm/cortex - fix sc_ev_missing_ticks over-counting.
details: https://anonhg.NetBSD.org/src/rev/ec78d900dfb8
branches: trunk
changeset: 339471:ec78d900dfb8
user: ryo <ryo%NetBSD.org@localhost>
date: Fri Jul 24 05:19:13 2015 +0000
description:
- fix sc_ev_missing_ticks over-counting.
- don't use 64bit division, because it has expensive cost on gcc/arm
whether it is a constant or not.
'delta' is usually taken a value around sc_autoinc depending on timing
of read. therefore 'delta / sc->sc_autoinc' would be count too much.
diffstat:
sys/arch/arm/cortex/a9tmr.c | 32 +++++++++++++++++---------------
1 files changed, 17 insertions(+), 15 deletions(-)
diffs (62 lines):
diff -r a2c4b9990d77 -r ec78d900dfb8 sys/arch/arm/cortex/a9tmr.c
--- a/sys/arch/arm/cortex/a9tmr.c Fri Jul 24 04:33:50 2015 +0000
+++ b/sys/arch/arm/cortex/a9tmr.c Fri Jul 24 05:19:13 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: a9tmr.c,v 1.12 2015/03/04 23:18:21 jmcneill Exp $ */
+/* $NetBSD: a9tmr.c,v 1.13 2015/07/24 05:19:13 ryo Exp $ */
/*-
* Copyright (c) 2012 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: a9tmr.c,v 1.12 2015/03/04 23:18:21 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: a9tmr.c,v 1.13 2015/07/24 05:19:13 ryo Exp $");
#include <sys/param.h>
#include <sys/bus.h>
@@ -329,7 +329,7 @@
printf("%s(%p): %s: now %#"PRIx64" delta %"PRIu64"\n",
__func__, cf, ci->ci_data.cpu_name, now, delta);
#endif
- KASSERTMSG(delta > sc->sc_autoinc / 100,
+ KASSERTMSG(delta > sc->sc_autoinc / 64,
"%s: interrupting too quickly (delta=%"PRIu64")",
ci->ci_data.cpu_name, delta);
@@ -337,20 +337,22 @@
hardclock(cf);
+ if (delta > sc->sc_autoinc) {
+ u_int ticks = hz;
+ for (delta -= sc->sc_autoinc;
+ delta >= sc->sc_autoinc && ticks > 0;
+ delta -= sc->sc_autoinc, ticks--) {
#if 0
- /*
- * Try to make up up to a seconds amount of missed clock interrupts
- */
- u_int ticks = hz;
- for (delta -= sc->sc_autoinc;
- ticks > 0 && delta >= sc->sc_autoinc;
- delta -= sc->sc_autoinc, ticks--) {
- hardclock(cf);
+ /*
+ * Try to make up up to a seconds amount of
+ * missed clock interrupts
+ */
+ hardclock(cf);
+#else
+ sc->sc_ev_missing_ticks.ev_count++;
+#endif
+ }
}
-#else
- if (delta > sc->sc_autoinc)
- sc->sc_ev_missing_ticks.ev_count += delta / sc->sc_autoinc;
-#endif
return 1;
}
Home |
Main Index |
Thread Index |
Old Index