• Chris Wilson's avatar
    drm/i915: Fix eviction when the GGTT is idle but full · 99b169d3
    Chris Wilson authored
    In the full-ppgtt world, we can fill the GGTT full of context objects.
    These context objects are currently implicitly tracked by the requests
    that pin them i.e. they are only unpinned when the request is completed
    and retired, but we do not have the link from the vma to the request
    (anymore). In order to unpin those contexts, we have to issue another
    request and wait upon the switch to the kernel context.
    
    The bug during eviction was that we assumed that a full GGTT meant we
    would have requests on the GGTT timeline, and so we missed situations
    where those requests where merely in flight (and when even they have not
    yet been submitted to hw yet). The fix employed here is to change the
    already-is-idle test to no look at the execution timeline, but count the
    outstanding requests and then check that we have switched to the kernel
    context. Erring on the side of overkill here just means that we stall a
    little longer than may be strictly required, but we only expect to hit
    this path in extreme corner cases where returning an erroneous error is
    worse than the delay.
    
    v2: Logical inversion when swapping over branches.
    
    Fixes: 80b204bc ("drm/i915: Enable multiple timelines")
    Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
    Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
    Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
    Reviewed-by: default avatarTvrtko Ursulin <tvrtko.ursulin@intel.com>
    Link: https://patchwork.freedesktop.org/patch/msgid/20171012125726.14736-1-chris@chris-wilson.co.uk
    (cherry picked from commit 55b4f1ce)
    Signed-off-by: default avatarRodrigo Vivi <rodrigo.vivi@intel.com>
    99b169d3
i915_gem_evict.c 12.3 KB