When reprioritising a request, we build a list of its dependencies in
topological order. This should leave our origin request as the first
element in our list, if it moves we have a dependency cycle and severe
breakage. Assert that it doesn't move.

Complete, but expensive checking is done by swfence, this assert is more
about documenting the topologically ordered list.

Signed-off-by: Chris Wilson <ch...@chris-wilson.co.uk>
Cc: Michał Winiarski <michal.winiar...@intel.com>
---
 drivers/gpu/drm/i915/intel_lrc.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/gpu/drm/i915/intel_lrc.c b/drivers/gpu/drm/i915/intel_lrc.c
index 4e150b095a11..42705e3875cd 100644
--- a/drivers/gpu/drm/i915/intel_lrc.c
+++ b/drivers/gpu/drm/i915/intel_lrc.c
@@ -1050,6 +1050,13 @@ static void execlists_schedule(struct 
drm_i915_gem_request *request, int prio)
                }
        }
 
+       /*
+        * We should never have a dep cycle back to ourselves, leaving
+        * the original request as the origin of our topologically sorted
+        * list.
+        */
+       GEM_BUG_ON(list_first_entry(&dfs, typeof(stack), dfs_link) != &stack);
+
        /*
         * If we didn't need to bump any existing priorities, and we haven't
         * yet submitted this request (i.e. there is no potential race with
-- 
2.15.1

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

Reply via email to