[Intel-gfx] [PATCH] drm/i915: Finish i915_gem_wait_for_idle() on the global execution timeline

Chris Wilson chris at chris-wilson.co.uk
Mon Dec 11 21:42:22 UTC 2017


In order to be sure that we catch the most recent request to be
executed, we need to finish on the global execution timeline. This
prevents a race where the request is being transferred between timelines
behind our back, jumping it ahead in the list onto the global execution
timeline that we have already processed causing us not to wait on that
request. Document this requirement with an assertion to protect
ourselves against future changes.

References: 73cb97010d4f ("drm/i915: Combine seqno + tracking into a global timeline struct")
Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
Cc: Joonas Lahtinen <joonas.lahtinen at linux.intel.com>
---
 drivers/gpu/drm/i915/i915_gem.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index 9e957b213fdb..40db2258eb07 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -3566,6 +3566,10 @@ int i915_gem_wait_for_idle(struct drm_i915_private *i915, unsigned int flags)
 
 		lockdep_assert_held(&i915->drm.struct_mutex);
 
+		/* Must finish by waiting on the global execution_timeline */
+		GEM_BUG_ON(list_last_entry(&i915->gt.timelines,
+					   typeof(*tl), link) !=
+			   &i915->gt.global_timeline);
 		list_for_each_entry(tl, &i915->gt.timelines, link) {
 			ret = wait_for_timeline(tl, flags);
 			if (ret)
-- 
2.15.1



More information about the Intel-gfx mailing list