[PATCH 11/11] rq
Chris Wilson
chris at chris-wilson.co.uk
Sun Feb 10 14:56:39 UTC 2019
---
drivers/gpu/drm/i915/i915_request.c | 7 ++++++-
drivers/gpu/drm/i915/i915_request.h | 11 +++++++++++
2 files changed, 17 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/i915/i915_request.c b/drivers/gpu/drm/i915/i915_request.c
index 3dd1d8cbacc9..b8eb537d0889 100644
--- a/drivers/gpu/drm/i915/i915_request.c
+++ b/drivers/gpu/drm/i915/i915_request.c
@@ -722,6 +722,7 @@ i915_request_alloc(struct intel_engine_cs *engine, struct i915_gem_context *ctx)
rq->timeline = tl;
GEM_BUG_ON(rq->timeline == &engine->timeline);
rq->hwsp_seqno = tl->hwsp_seqno;
+ rq->hwsp_cacheline = tl->hwsp_cacheline;
rq->rcustate = get_state_synchronize_rcu(); /* acts as smp_mb() */
spin_lock_init(&rq->lock);
@@ -808,7 +809,11 @@ emit_semaphore_wait(struct i915_request *to,
GEM_BUG_ON(INTEL_GEN(to->i915) < 8);
/* We need to pin the signaler's HWSP until we are finished reading. */
- err = i915_timeline_read_lock(from->timeline, to);
+ mutex_lock_nested(&from->timeline->mutex, SINGLE_DEPTH_NESTING);
+ err = i915_request_completed(from);
+ if (!err)
+ err = i915_timeline_read_lock(from->hwsp_cacheline, to);
+ mutex_unlock(&from->timeline->mutex);
if (err)
return err;
diff --git a/drivers/gpu/drm/i915/i915_request.h b/drivers/gpu/drm/i915/i915_request.h
index df52776b26cf..63f60386ddb4 100644
--- a/drivers/gpu/drm/i915/i915_request.h
+++ b/drivers/gpu/drm/i915/i915_request.h
@@ -38,6 +38,7 @@ struct drm_file;
struct drm_i915_gem_object;
struct i915_request;
struct i915_timeline;
+struct i915_timeline_cacheline;
struct i915_capture_list {
struct i915_capture_list *next;
@@ -149,6 +150,16 @@ struct i915_request {
*/
const u32 *hwsp_seqno;
+ /*
+ * If we need to access the timeline's seqno for this request in
+ * another request, we need to keep a read reference to this associated
+ * cacheline, so that we do not free and recycle it before the foriegn
+ * observers have completed. Hence, we keep a pointer to the cacheline
+ * inside the timeline's HWSP vma, but it is only valid while this
+ * request has not completed and guarded by the timeline mutex.
+ */
+ struct i915_timeline_cacheline *hwsp_cacheline;
+
/**
* GEM sequence number associated with this request on the
* global execution timeline. It is zero when the request is not
--
2.20.1
More information about the Intel-gfx-trybot
mailing list