[PATCH 03/22] drm/i915/gem: Check that the context wasn't closed during setup

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

 



As setup takes a long time, the user may close the context during the
construction of the execbuf. In order to make sure we correctly track
all outstanding work with non-persistent contexts, we need to serialise
the submission with the context closure and mop up any leaks.

Signed-off-by: Chris Wilson <chris@xxxxxxxxxxxxxxxxxx>
Reviewed-by: Matthew Auld <matthew.auld@xxxxxxxxx>
---
 drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c b/drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c
index ac0e5fc5675e..b2a3653b9d5d 100644
--- a/drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c
+++ b/drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c
@@ -2775,9 +2775,18 @@ i915_gem_do_execbuffer(struct drm_device *dev,
 
 	trace_i915_request_queue(eb.request, eb.batch_flags);
 	err = eb_submit(&eb);
+
+	/* Check that the context wasn't destroyed before submission */
+	if (!rcu_access_pointer(eb.context->gem_context)) {
+		err = -ENOENT; /* serious error, supercede any earlier ones */
+		goto err_request;
+	}
+
 err_request:
 	add_to_client(eb.request, file);
 	i915_request_get(eb.request);
+	if (err)
+		i915_request_skip(eb.request, err);
 	i915_request_add(eb.request);
 
 	if (fences)
-- 
2.25.1

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



[Index of Archives]     [AMD Graphics]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux