Skip to content

Commit 309663a

Browse files
committed
drm/i915: Check against the signaled bit for fences/requests
When dma_fence_signal() is called, it sets a flag to indicate the fence is complete. Before the dma_fence is signaled, the seqno check will first be passed. During an unlocked check (such as inside a waiter), it is possible for the fence to be signaled even though the seqno has been reset (by engine wraparound). In this case the waiter will be kicked, but for an extra layer of protection we can check the persistent signaled bit from the fence. Signed-off-by: Chris Wilson <[email protected]> Cc: Tvrtko Ursulin <[email protected]> Reviewed-by: Tvrtko Ursulin <[email protected]> Link: http://patchwork.freedesktop.org/patch/msgid/[email protected]
1 parent a5570fe commit 309663a

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

drivers/gpu/drm/i915/i915_drv.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4013,6 +4013,15 @@ __i915_request_irq_complete(struct drm_i915_gem_request *req)
40134013
{
40144014
struct intel_engine_cs *engine = req->engine;
40154015

4016+
/* Note that the engine may have wrapped around the seqno, and
4017+
* so our request->global_seqno will be ahead of the hardware,
4018+
* even though it completed the request before wrapping. We catch
4019+
* this by kicking all the waiters before resetting the seqno
4020+
* in hardware, and also signal the fence.
4021+
*/
4022+
if (test_bit(DMA_FENCE_FLAG_SIGNALED_BIT, &req->fence.flags))
4023+
return true;
4024+
40164025
/* Before we do the heavier coherent read of the seqno,
40174026
* check the value (hopefully) in the CPU cacheline.
40184027
*/

0 commit comments

Comments
 (0)