• Jacob Keller's avatar
    ice: do not re-enable miscellaneous interrupt until thread_fn completes · 0ec38df3
    Jacob Keller authored
    The ice driver uses threaded IRQ for managing Tx timestamps via the
    devm_request_threaded_irq() interface. The ice_misc_intr() handler function
    is responsible for processing the hard interrupt context, and can wake the
    ice_misc_intr_thread_fn() by returning IRQ_WAKE_THREAD.
    
    The request_threaded_irq() function comment says:
    
      @handler is still called in hard interrupt context and has to check
      whether the interrupt originates from the device. If yes, it needs to
      disable the interrupt on the device and return IRQ_WAKE_THREAD which will
      wake up the handler thread and run the @thread_fn.
    
    We currently re-enable the Other Interrupt Cause Register (OCIR) at the end of
    ice_misc_intr(). In practice, this seems to be ok, but it can make
    communicating between the handler function and the thread function
    difficult. This is because the interrupt can trigger again while the thread
    function is still processing.
    
    Move the OICR update to the end of the thread function, leaving the other
    interrupt cause disabled in hardware until we complete one pass of the
    thread function. This prevents the miscellaneous interrupt from firing
    until after we finish the thread function.
    Signed-off-by: default avatarJacob Keller <jacob.e.keller@intel.com>
    Tested-by: Arpana Arland <arpanax.arland@intel.com> (A Contingent worker at Intel)
    Signed-off-by: default avatarTony Nguyen <anthony.l.nguyen@intel.com>
    0ec38df3
ice_main.c 243 KB