[Intel-gfx] [RFC PATCH 089/162] drm/i915/dg1: Fix occasional migration error

Matthew Auld matthew.auld at intel.com
Fri Nov 27 12:06:05 UTC 2020


From: CQ Tang <cq.tang at intel.com>

We posted blitter copying operation. Then we call
i915_gem_object_set_to_cpu_domain(), inside this function, we
call i915_gem_object_wait() with interruptible flag. Sometimes
this wait call gets interrupted by the blitter copying complete
interrupt. This will make migration operation to fail.
So before calling i915_gem_object_set_to_cpu_domain(), we call
i915_gem_object_wait() with non-interruptible flag to wait for
the blitter operation to finish.

Signed-off-by: CQ Tang <cq.tang at intel.com>
Cc: Matthew Auld <matthew.auld at intel.com>
Cc: Sudeep Dutt <sudeep.dutt at intel.com>
Cc: Ramalingam C <ramalingam.c at intel.com>
---
 drivers/gpu/drm/i915/gem/i915_gem_object.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/drivers/gpu/drm/i915/gem/i915_gem_object.c b/drivers/gpu/drm/i915/gem/i915_gem_object.c
index 7ff430503497..49935245a4a8 100644
--- a/drivers/gpu/drm/i915/gem/i915_gem_object.c
+++ b/drivers/gpu/drm/i915/gem/i915_gem_object.c
@@ -381,6 +381,17 @@ int i915_gem_object_migrate(struct drm_i915_gem_object *obj,
 		err = i915_gem_object_ww_copy_blt(obj, donor, ww, ce);
 		if (err)
 			goto unlock_donor;
+
+		/*
+		 * Occasionally i915_gem_object_wait() called inside
+		 * i915_gem_object_set_to_cpu_domain() get interrupted
+		 * and return -ERESTARTSYS, this will make migration
+		 * operation fail. So adding a non-interruptible wait
+		 * before changing the object domain.
+		 */
+		err = i915_gem_object_wait(donor, 0, MAX_SCHEDULE_TIMEOUT);
+		if (err)
+			goto unlock_donor;
 	}
 
 	err = i915_gem_object_set_to_cpu_domain(donor, false);
-- 
2.26.2



More information about the Intel-gfx mailing list