• Dou Liyang's avatar
    x86/ioapic: Refactor the delay logic in timer_irq_works() · ca7c6076
    Dou Liyang authored
    timer_irq_works() is used to detects the timer IRQs. It calls mdelay(10) to
    delay ten ticks and check whether the timer IRQ work or not.
    
    mdelay() depends on the loops_per_jiffy which is set up in
    calibrate_delay(), but the delay calibration depends on a working timer
    interrupt, which causes a chicken and egg problem.
    
    The correct solution is to set up the interrupt mode and making sure that
    the timer interrupt is delivered correctly before invoking calibrate_delay().
    That means that mdelay() cannot be used in timer_irq_works(). 
    
    Provide helper functions to make a rough delay estimate which is good enough
    to prove that the timer interrupt is working. Either use TSC or a simple
    delay loop and assume that 4GHz is the maximum CPU frequency to base the
    delay calculation on.
    Signed-off-by: default avatarDou Liyang <douly.fnst@cn.fujitsu.com>
    Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
    Cc: yinghai@kernel.org
    Cc: bhe@redhat.com
    Link: https://lkml.kernel.org/r/1505293975-26005-9-git-send-email-douly.fnst@cn.fujitsu.com
    ca7c6076
io_apic.c 78 KB