• Nick Hoath's avatar
    drm/i915: Extend LRC pinning to cover GPU context writeback · 6d65ba94
    Nick Hoath authored
    Use the first retired request on a new context to unpin
    the old context. This ensures that the hw context remains
    bound until it has been written back to by the GPU.
    Now that the context is pinned until later in the request/context
    lifecycle, it no longer needs to be pinned from context_queue to
    retire_requests.
    This fixes an issue with GuC submission where the GPU might not
    have finished writing back the context before it is unpinned. This
    results in a GPU hang.
    
    v2: Moved the new pin to cover GuC submission (Alex Dai)
        Moved the new unpin to request_retire to fix coverage leak
    v3: Added switch to default context if freeing a still pinned
        context just in case the hw was actually still using it
    v4: Unwrapped context unpin to allow calling without a request
    v5: Only create a switch to idle context if the ring doesn't
        already have a request pending on it (Alex Dai)
        Rename unsaved to dirty to avoid double negatives (Dave Gordon)
        Changed _no_req postfix to __ prefix for consistency (Dave Gordon)
        Split out per engine cleanup from context_free as it
        was getting unwieldy
        Corrected locking (Dave Gordon)
    v6: Removed some bikeshedding (Mika Kuoppala)
        Added explanation of the GuC hang that this fixes (Daniel Vetter)
    v7: Removed extra per request pinning from ring reset code (Alex Dai)
        Added forced ring unpin/clean in error case in context free (Alex Dai)
    Signed-off-by: default avatarNick Hoath <nicholas.hoath@intel.com>
    Issue: VIZ-4277
    Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
    Cc: David Gordon <david.s.gordon@intel.com>
    Cc: Chris Wilson <chris@chris-wilson.co.uk>
    Cc: Alex Dai <yu.dai@intel.com>
    Cc: Mika Kuoppala <mika.kuoppala@linux.intel.com>
    Reviewed-by: default avatarAlex Dai <yu.dai@intel.com>
    Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
    6d65ba94
i915_drv.h 107 KB