]> git.baikalelectronics.ru Git - kernel.git/commitdiff
drm/i915: Allow interrupts when taking the timeline->mutex
authorChris Wilson <chris@chris-wilson.co.uk>
Mon, 10 Jun 2019 10:36:10 +0000 (11:36 +0100)
committerChris Wilson <chris@chris-wilson.co.uk>
Mon, 10 Jun 2019 16:31:47 +0000 (17:31 +0100)
Before we commit ourselves to writing commands into the
ringbuffer and submitting the request, allow signals to interrupt
acquisition of the timeline mutex. We allow ourselves to be interrupted
at any time later if we need to block for space in the ring, anyway.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20190610103610.19883-1-chris@chris-wilson.co.uk
drivers/gpu/drm/i915/gt/intel_context.h
drivers/gpu/drm/i915/i915_request.c

index 63392c88cd98625eecc8f189ae5d1115f140e660..6d5453ba2c1e006a0991ddcf7c6ed172886ce68c 100644 (file)
@@ -113,10 +113,11 @@ static inline void intel_context_put(struct intel_context *ce)
        kref_put(&ce->ref, ce->ops->destroy);
 }
 
-static inline void intel_context_timeline_lock(struct intel_context *ce)
+static inline int __must_check
+intel_context_timeline_lock(struct intel_context *ce)
        __acquires(&ce->ring->timeline->mutex)
 {
-       mutex_lock(&ce->ring->timeline->mutex);
+       return mutex_lock_interruptible(&ce->ring->timeline->mutex);
 }
 
 static inline void intel_context_timeline_unlock(struct intel_context *ce)
index da1e6984a8ccbeed5533664660e7c9d21ceb2208..e9b59eea4f1046ae65f1fcfcd75c596e1453af51 100644 (file)
@@ -784,8 +784,11 @@ struct i915_request *
 i915_request_create(struct intel_context *ce)
 {
        struct i915_request *rq;
+       int err;
 
-       intel_context_timeline_lock(ce);
+       err = intel_context_timeline_lock(ce);
+       if (err)
+               return ERR_PTR(err);
 
        /* Move our oldest request to the slab-cache (if not in use!) */
        rq = list_first_entry(&ce->ring->request_list, typeof(*rq), ring_link);