• Chris Wilson's avatar
    drm/i915: Advance ring->head fully when idle · cbb60b4b
    Chris Wilson authored
    When we retire the last request on the ring, before we ever access that
    ring again we know it will be completely idle and so we can advance the
    ring->head fully to the end (i.e. ring->tail) and not just to the start
    of the breadcrumb. This allows us to skip re-emitting the breadcrumb
    after resetting the GPU if the ring was entirely idle. This prevents us
    from overwriting a seqno wraparound by re-executing a stale breadcrumb,
    i.e.
    	submit_request(1)
    	intel_engine_init_global_seqno(0)
    	i915_reset()
    would then leave 1 in the HWS, but the next request to execute would
    also be with seqno 1. The sanity checks upon submission detect this as a
    timewarp and explode. By setting the ring as empty, upon reset the HWS
    is left as 0, leaving it consistent with the timeline.
    
    v2: Fix check for deleting last element of list. We know that this
    request is always the first element of the ring, so only if next
    points back to the start will this be the only request in flight.
    v3: Remove opencoding of list_is_last()
    v4: Move the block to its own function for some clarity.
    
    Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=100144
    Testcase: igt/gem_exec_whisper/hang-*
    Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
    Cc: Mika Kuoppala <mika.kuoppala@intel.com>
    Link: http://patchwork.freedesktop.org/patch/msgid/20170406170028.26871-1-chris@chris-wilson.co.ukReviewed-by: default avatarJoonas Lahtinen <joonas.lahtinen@linux.intel.com>
    cbb60b4b
i915_gem_request.c 35.6 KB