• Daniel Vetter's avatar
    drm/i915: protect force_wake_(get|put) with the gt_lock · 69ac25cd
    Daniel Vetter authored
    commit 9f1f46a4 upstream.
    
    The problem this patch solves is that the forcewake accounting
    necessary for register reads is protected by dev->struct_mutex. But the
    hangcheck and error_capture code need to access registers without
    grabbing this mutex because we hold it while waiting for the gpu.
    So a new lock is required. Because currently the error_state capture
    is called from the error irq handler and the hangcheck code runs from
    a timer, it needs to be an irqsafe spinlock (note that the registers
    used by the irq handler (neglecting the error handling part) only uses
    registers that don't need the forcewake dance).
    
    We could tune this down to a normal spinlock when we rework the
    error_state capture and hangcheck code to run from a workqueue.  But
    we don't have any read in a fastpath that needs forcewake, so I've
    decided to not care much about overhead.
    
    This prevents tests/gem_hangcheck_forcewake from i-g-t from killing my
    snb on recent kernels - something must have slightly changed the
    timings. On previous kernels it only trigger a WARN about the broken
    locking.
    
    v2: Drop the previous patch for the register writes.
    
    v3: Improve the commit message per Chris Wilson's suggestions.
    Signed-Off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
    Reviewed-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
    Reviewed-by: default avatarEugeni Dodonov <eugeni.dodonov@intel.com>
    Signed-off-by: default avatarKeith Packard <keithp@keithp.com>
    Signed-off-by: default avatarEugeni Dodonov <eugeni.dodonov@intel.com>
    Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
    69ac25cd
i915_dma.c 58 KB