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 Disable diagnostic assertions around tim...



details:   https://anonhg.NetBSD.org/src/rev/71ead5557ddf
branches:  trunk
changeset: 445473:71ead5557ddf
user:      jmcneill <jmcneill%NetBSD.org@localhost>
date:      Tue Oct 30 10:38:11 2018 +0000

description:
Disable diagnostic assertions around timer jitter on Allwinner A64. It
seems the instability of CNTVCT can cause issues with the compare value,
and rather than applying a heavy workaround just skip the panics.

diffstat:

 sys/arch/arm/cortex/gtmr.c |  25 +++++++++++++++----------
 1 files changed, 15 insertions(+), 10 deletions(-)

diffs (53 lines):

diff -r 18f870c98926 -r 71ead5557ddf sys/arch/arm/cortex/gtmr.c
--- a/sys/arch/arm/cortex/gtmr.c        Tue Oct 30 09:06:07 2018 +0000
+++ b/sys/arch/arm/cortex/gtmr.c        Tue Oct 30 10:38:11 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: gtmr.c,v 1.36 2018/09/30 10:34:38 skrll Exp $  */
+/*     $NetBSD: gtmr.c,v 1.37 2018/10/30 10:38:11 jmcneill Exp $       */
 
 /*-
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: gtmr.c,v 1.36 2018/09/30 10:34:38 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: gtmr.c,v 1.37 2018/10/30 10:38:11 jmcneill Exp $");
 
 #include <sys/param.h>
 #include <sys/bus.h>
@@ -272,11 +272,14 @@
        uint64_t delta = now - ci->ci_lastintr;
 
 #ifdef DIAGNOSTIC
-       const uint64_t then = gtmr_cntv_cval_read();
-       struct gtmr_percpu * const pc = percpu_getref(sc->sc_percpu);
-       KASSERTMSG(then <= now, "%"PRId64, now - then);
-       KASSERTMSG(then + pc->pc_delta >= ci->ci_lastintr + sc->sc_autoinc,
-           "%"PRId64, then + pc->pc_delta - ci->ci_lastintr - sc->sc_autoinc);
+       struct gtmr_percpu *pc = NULL;
+       if (!ISSET(sc->sc_flags, GTMR_FLAG_SUN50I_A64_UNSTABLE_TIMER)) {
+               const uint64_t then = gtmr_cntv_cval_read();
+               pc = percpu_getref(sc->sc_percpu);
+               KASSERTMSG(then <= now, "%"PRId64, now - then);
+               KASSERTMSG(then + pc->pc_delta >= ci->ci_lastintr + sc->sc_autoinc,
+                   "%"PRId64, then + pc->pc_delta - ci->ci_lastintr - sc->sc_autoinc);
+       }
 #endif
 
        KASSERTMSG(delta > sc->sc_autoinc / 100,
@@ -298,9 +301,11 @@
        ci->ci_lastintr = now;
 
 #ifdef DIAGNOSTIC
-       KASSERT(delta == (uint32_t) delta);
-       pc->pc_delta = delta;
-       percpu_putref(sc->sc_percpu);
+       if (!ISSET(sc->sc_flags, GTMR_FLAG_SUN50I_A64_UNSTABLE_TIMER)) {
+               KASSERT(delta == (uint32_t) delta);
+               pc->pc_delta = delta;
+               percpu_putref(sc->sc_percpu);
+       }
 #endif
 
        hardclock(cf);



Home | Main Index | Thread Index | Old Index