• Chris Wilson's avatar
    drm/i915: Remove i915_request.lock requirement for execution callbacks · 2e4c6c1a
    Chris Wilson authored
    To implement preempt-to-busy (and so efficient timeslicing and best utilization
    of the hardware submission ports) we let the GPU run asynchronously in respect
    to the ELSP submission queue. This created challenges in keeping and accessing
    the driver state mirroring the asynchronous GPU execution.
    
    Previous fix 1d9221e9 ("drm/i915: Skip signaling a signaled request")
    however did not correctly serialize request retirement with the execution
    callbacks.
    
    We were using the i915_request.lock to serialise adding an execution callback
    with __i915_request_submit. However, if we use an atomic llist_add to serialise
    multiple waiters and then check to see if the request is already executing, we
    can remove the irq-spinlock and fix serialization between retirement and
    execution callbacks in one go.
    
    v2: Avoid using the irq_work when outside of the irq-spinlocks, where we
    can execute the callbacks immediately.
    v3: Pay close attention to the order of setting ACTIVE on retirement, we
    need to ensure the request is signaled and breadcrumbs detached before
    we finish removing the request from the engine.
    v4: Expanded commit message.
    
    Fixes: 1d9221e9 ("drm/i915: Skip signaling a signaled request")
    Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
    Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
    Reviewed-by: default avatarTvrtko Ursulin <tvrtko.ursulin@intel.com>
    Link: https://patchwork.freedesktop.org/patch/msgid/20200716142207.13003-2-chris@chris-wilson.co.ukSigned-off-by: default avatarRodrigo Vivi <rodrigo.vivi@intel.com>
    [Joonas: Rebased and reordered into drm-intel-gt-next branch]
    [Joonas: Added expanded commit message from Tvrtko and Chris]
    Signed-off-by: default avatarJoonas Lahtinen <joonas.lahtinen@linux.intel.com>
    2e4c6c1a
i915_request.c 56.1 KB