summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/i915/gt/selftest_context.c
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2019-08-15 21:57:09 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2019-08-15 23:21:13 +0100
commite5dadff4b09376e8ed92ecc0c12f1b9b3b1fbd19 (patch)
treebb2098ef60623b470e47149960684ad9e8f7a73b /drivers/gpu/drm/i915/gt/selftest_context.c
parentccb23d2dcc300d3fa176de654610ea82f635915d (diff)
drm/i915: Protect request retirement with timeline->mutex
Forgo the struct_mutex requirement for request retirement as we have been transitioning over to only using the timeline->mutex for controlling the lifetime of a request on that timeline. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Reviewed-by: Matthew Auld <matthew.auld@intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/20190815205709.24285-4-chris@chris-wilson.co.uk
Diffstat (limited to 'drivers/gpu/drm/i915/gt/selftest_context.c')
-rw-r--r--drivers/gpu/drm/i915/gt/selftest_context.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/drivers/gpu/drm/i915/gt/selftest_context.c b/drivers/gpu/drm/i915/gt/selftest_context.c
index da9c49e2adaf..6fbc72bc290e 100644
--- a/drivers/gpu/drm/i915/gt/selftest_context.c
+++ b/drivers/gpu/drm/i915/gt/selftest_context.c
@@ -20,10 +20,13 @@ static int request_sync(struct i915_request *rq)
i915_request_add(rq);
timeout = i915_request_wait(rq, 0, HZ / 10);
- if (timeout < 0)
+ if (timeout < 0) {
err = timeout;
- else
+ } else {
+ mutex_lock(&rq->timeline->mutex);
i915_request_retire_upto(rq);
+ mutex_unlock(&rq->timeline->mutex);
+ }
i915_request_put(rq);
@@ -35,6 +38,7 @@ static int context_sync(struct intel_context *ce)
struct intel_timeline *tl = ce->timeline;
int err = 0;
+ mutex_lock(&tl->mutex);
do {
struct i915_request *rq;
long timeout;
@@ -55,6 +59,7 @@ static int context_sync(struct intel_context *ce)
i915_request_put(rq);
} while (!err);
+ mutex_unlock(&tl->mutex);
return err;
}