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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxxxxxx>
Cc: Joonas Lahtinen <joonas.lahtinen@xxxxxxxxxxxxxxx>
---
 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

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




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux