tickless: fix dumb bug propogated across multiple platforms
authorAlan Cox <alan@linux.intel.com>
Sun, 16 Sep 2018 12:21:39 +0000 (13:21 +0100)
committerAlan Cox <alan@linux.intel.com>
Sun, 16 Sep 2018 12:21:39 +0000 (13:21 +0100)
This makes things work far better than before.

Kernel/platform-rc2014-tiny/main.c
Kernel/platform-rc2014/main.c
Kernel/platform-sbcv2/main.c
Kernel/platform-sc108/main.c

index 143c20e..c3a2119 100644 (file)
@@ -105,8 +105,8 @@ void sync_clock(void)
                                        timer_interrupt();
                                }
                        }
-                       re_enter--;
                }
+               re_enter--;
                irqrestore(irq);
        }
 }
index 2b3636e..ea81b6f 100644 (file)
@@ -115,8 +115,8 @@ void sync_clock(void)
                                /* FIXME: need to cover ACIA option.. */
                                tty_pollirq_sio();
                        }
-                       re_enter--;
                }
+               re_enter--;
                irqrestore(irq);
        }
 }
index 53ceb44..3e5d510 100644 (file)
@@ -134,8 +134,8 @@ void sync_clock(void)
                                /* Poll the PropIOv2 */
                                platform_interrupt();
                        }
-                       re_enter--;
                } 
+               re_enter--;
                irqrestore(irq);
        }
 }
index a27ea78..6492518 100644 (file)
@@ -9,7 +9,6 @@
 
 extern unsigned char irqvector;
 struct blkbuf *bufpool_end = bufpool + NBUFS;  /* minimal for boot -- expanded after we're done with _DISCARD */
-uint8_t timermsr = 0;
 uint16_t swap_dev = 0xFFFF;
 uint16_t ramtop = 0xF000;
 uint8_t need_resched = 0;
@@ -35,7 +34,7 @@ void platform_idle(void)
        /* Check the clock. We try and reduce the impact of the clock on
           latency by not doing it so often. 256 may be too small a divide
           need t see what 1/10th sec looks like in poll loops */
-       if (!idlect++)
+       if (!++idlect)
                sync_clock();
 }
 
@@ -94,24 +93,24 @@ static void sync_clock_read(void)
  */
 void sync_clock(void)
 {
-       if (!timermsr) {
-               irqflags_t irq = di();
-               int16_t tmp;
-               if (!re_enter++) {
-                       sync_clock_read();
-                       if (oldticks != 0xFF) {
-                               tmp = newticks - oldticks;
-                               if (tmp < 0)
-                                       tmp += 60;
-                               tmp *= 10;
-                               while(tmp--) {
-                                       timer_interrupt();
-                               }
+       irqflags_t irq = di();
+       int16_t tmp;
+       if (!re_enter++) {
+               sync_clock_read();
+               if (oldticks != 0xFF) {
+                       tmp = newticks - oldticks;
+                       if (tmp < 0)
+                               tmp += 60;
+                       tmp *= 10;
+                       while(tmp--) {
+                               timer_interrupt();
                        }
-                       re_enter--;
                }
-               irqrestore(irq);
        }
+       re_enter--;
+       if (re_enter > 1)
+               kputs("oops");
+       irqrestore(irq);
 }
 
 /*