• David Mosberger's avatar
    ia64: fix spurious "timer tick before it's due" problem · 7c323b14
    David Mosberger authored
    Patch Bjorn Helgaas: Fix the "timer tick before it's due" complaint
    from timer_interrupt().  The problem was that smp_callin() turned
    on the periodic timer tick before syncing the ITC with the BP.
    
    Syncing the ITC happens with interrupts disabled, and if you're
    unlucky enough to (1) pend a timer interrupt, and (2) set the ITC
    back before the ITM value that caused the timer interrupt, you
    can get stuck for several iterations in the following cycle
    (assume 100 clocks per tick):
    
        ITC     ITM
        ---	    ---
                        ia64_init_itm()
        100	    200	        schedule first tick at 200
                        ia64_sync_itc()
                            disable interrupts
        200     200         ITC == ITM; pend IT interrupt
        150                 set ITC to sync with BP
                            enable interrupts
                            recognize pending IT interrupt
                            disable IT interrupts
                        timer_interrupt()
        160     200         notice that 160 < 200,
                                printk "timer tick before it's due")
        200     200         ITC == ITM; pend IT interrupt
    	    300         set ITM for next tick
                            re-enable IT interrupt
                            recognize pending IT interrupt
                            disable IT interrupts
                        timer_interrupt()
        260     300         notice that 260 < 300,
                                printk "timer tick before it's due")
    
        ...	            repeat until you're tired or timer_interrupt()
                        takes long enough that the ITC lands after the
                        ITM
    
    This patch syncs the ITC with the BP before starting up the
    periodic tick, so the above scenario should never happen.
    
    This doesn't change how the timer tick on the BP is started;
    that happens quite early (and must be early because things
    like calibrate_delay() depend on jiffies updates).
    7c323b14
delay.h 1.85 KB