Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/sparc/sparc fix hang at 4B microseconds (1h12 or so...



details:   https://anonhg.NetBSD.org/src/rev/986f78da64b2
branches:  trunk
changeset: 828961:986f78da64b2
user:      mrg <mrg%NetBSD.org@localhost>
date:      Fri Jan 12 09:47:44 2018 +0000

description:
fix hang at 4B microseconds (1h12 or so), and simplify part of the previous

diffstat:

 sys/arch/sparc/sparc/timer.c |  18 ++++++------------
 1 files changed, 6 insertions(+), 12 deletions(-)

diffs (40 lines):

diff -r 26b8ff54af0c -r 986f78da64b2 sys/arch/sparc/sparc/timer.c
--- a/sys/arch/sparc/sparc/timer.c      Fri Jan 12 09:12:01 2018 +0000
+++ b/sys/arch/sparc/sparc/timer.c      Fri Jan 12 09:47:44 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: timer.c,v 1.33 2018/01/12 06:01:33 mrg Exp $ */
+/*     $NetBSD: timer.c,v 1.34 2018/01/12 09:47:44 mrg Exp $ */
 
 /*
  * Copyright (c) 1992, 1993
@@ -60,7 +60,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: timer.c,v 1.33 2018/01/12 06:01:33 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: timer.c,v 1.34 2018/01/12 09:47:44 mrg Exp $");
 
 #include <sys/param.h>
 #include <sys/kernel.h>
@@ -162,17 +162,11 @@
 
        /*
         * This handles early-boot cases where the counter resets twice
-        * before the offset is updated.
+        * before the offset is updated, and we have a stupid check to
+        * ensure overflow hasn't happened.
         */
-       if (res < cntr.lastres) {
-               if (fixup == 0)
-                       fixup = cntr.limit;
-               while (res < cntr.lastres) {
-                       if (res > UINT_MAX - fixup)
-                               break;
-                       res += fixup;
-               }
-       }
+       if (res < cntr.lastres && res > (TMR_MASK+1) << 3)
+               res = cntr.lastres + 1;
 
        cntr.lastres = res;
 



Home | Main Index | Thread Index | Old Index