Skip to content

Commit 90a79a9

Browse files
tursulindanvet
authored andcommitted
drm/i915: Handle async cancellation in sentinel assert
With the watchdog cancelling requests asynchronously to preempt-to-busy we need to relax one assert making it apply only to requests not in error. v2: * Check against the correct request! v3: * Simplify the check to avoid the question of when to sample the fence error vs sentinel bit. Signed-off-by: Tvrtko Ursulin <[email protected]> Reviewed-by: Matthew Auld <[email protected]> Signed-off-by: Daniel Vetter <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
1 parent 8f922e4 commit 90a79a9

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

drivers/gpu/drm/i915/gt/intel_execlists_submission.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -757,9 +757,8 @@ assert_pending_valid(const struct intel_engine_execlists *execlists,
757757
{
758758
struct intel_engine_cs *engine =
759759
container_of(execlists, typeof(*engine), execlists);
760-
struct i915_request * const *port, *rq;
760+
struct i915_request * const *port, *rq, *prev = NULL;
761761
struct intel_context *ce = NULL;
762-
bool sentinel = false;
763762
u32 ccid = -1;
764763

765764
trace_ports(execlists, msg, execlists->pending);
@@ -809,15 +808,20 @@ assert_pending_valid(const struct intel_engine_execlists *execlists,
809808
* Sentinels are supposed to be the last request so they flush
810809
* the current execution off the HW. Check that they are the only
811810
* request in the pending submission.
811+
*
812+
* NB: Due to the async nature of preempt-to-busy and request
813+
* cancellation we need to handle the case where request
814+
* becomes a sentinel in parallel to CSB processing.
812815
*/
813-
if (sentinel) {
816+
if (prev && i915_request_has_sentinel(prev) &&
817+
!READ_ONCE(prev->fence.error)) {
814818
GEM_TRACE_ERR("%s: context:%llx after sentinel in pending[%zd]\n",
815819
engine->name,
816820
ce->timeline->fence_context,
817821
port - execlists->pending);
818822
return false;
819823
}
820-
sentinel = i915_request_has_sentinel(rq);
824+
prev = rq;
821825

822826
/*
823827
* We want virtual requests to only be in the first slot so

0 commit comments

Comments
 (0)