diff mbox series

[RFC,089/162] drm/i915/dg1: Fix occasional migration error

Message ID 20201127120718.454037-90-matthew.auld@intel.com (mailing list archive)
State New, archived
Headers show
Series DG1 + LMEM enabling | expand

Commit Message

Matthew Auld Nov. 27, 2020, 12:06 p.m. UTC
From: CQ Tang <cq.tang@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@intel.com>
Cc: Matthew Auld <matthew.auld@intel.com>
Cc: Sudeep Dutt <sudeep.dutt@intel.com>
Cc: Ramalingam C <ramalingam.c@intel.com>
---
 drivers/gpu/drm/i915/gem/i915_gem_object.c | 11 +++++++++++
 1 file changed, 11 insertions(+)
diff mbox series

Patch

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);