• Ville Syrjälä's avatar
    drm/i915: Don't call intel_prepare_page_flip() multiple times on gen2-4 · 9ebb9b7a
    Ville Syrjälä authored
    commit 7d47559e upstream.
    
    The flip stall detector kicks in when pending>=INTEL_FLIP_COMPLETE. That
    means if we first call intel_prepare_page_flip() but don't call
    intel_finish_page_flip(), the next stall check will erroneosly think
    the page flip was somehow stuck.
    
    With enough debug spew emitted from the interrupt handler my 830 hangs
    when this happens. My theory is that the previous vblank interrupt gets
    sufficiently delayed that the handler will see the pending bit set in
    IIR, but ISR still has the bit set as well (ie. the flip was processed
    by CS but didn't complete yet). In this case the handler will proceed
    to call intel_check_page_flip() immediately after
    intel_prepare_page_flip(). It then tries to print a backtrace for the
    stuck flip WARN, which apparetly results in way too much debug spew
    delaying interrupt processing further. That then seems to cause an
    endless loop in the interrupt handler, and the machine is dead until
    the watchdog kicks in and reboots. At least limiting the number of
    iterations of the loop in the interrupt handler also prevented the
    hang.
    
    So it seems better to not call intel_prepare_page_flip() without
    immediately calling intel_finish_page_flip(). The IIR/ISR trickery
    avoids races here so this is a perfectly safe thing to do.
    
    v2: Fix typo in commit message (checkpatch)
    
    Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=88381
    Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=85888Reviewed-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
    Signed-off-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
    Signed-off-by: default avatarJani Nikula <jani.nikula@intel.com>
    Signed-off-by: default avatarLuis Henriques <luis.henriques@canonical.com>
    9ebb9b7a
i915_irq.c 126 KB