drm/i915: Untangle execlist tracking
Subsystems (2)
cover drm/i915: Untangle execlist tracking
This patchset merges execlist queue items in to gem requests. It does this by using the reference count added by John Harrison's "Replace seqno values with request structures" patchset to ensure that the gem request is available for the whole execlist submission lifespan.
v2: merge intel_ctx_submit_request and drm_i915_gem_request, rebase changes &
add cover letter
Issue: VIZ-4274
Nick Hoath (5):
drm/i915: execlist request keeps ptr/ref to gem_request drm/i915: Removed duplicate members from submit_request drm/i915: Remove FIXME_lrc_ctx backpointer
drm/i915: Subsume intel_ctx_submit_request in to drm_i915_gem_request drm/i915: Change workaround execlist submission to use gem requests.
drivers/gpu/drm/i915/i915_debugfs.c | 4 +- drivers/gpu/drm/i915/i915_drv.h | 22 ++++++ drivers/gpu/drm/i915/i915_gem.c | 11 ++- drivers/gpu/drm/i915/intel_lrc.c | 126 +++++++++++++++++++------------- drivers/gpu/drm/i915/intel_lrc.h | 41 ++--------- drivers/gpu/drm/i915/intel_ringbuffer.h | 12 ++- 6 files changed, 119 insertions(+), 97 deletions(-)
Signature · 6 lines
2.1.1 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 1/5 drm/i915: execlist request keeps ptr/ref to gem_request
Add a reference and pointer from the execlist queue item to the associated gem request. For execlist requests that don't have a request, create one as a placeholder.
This patchset requires John Harrison's "Replace seqno values with request structures" patchset.
Issue: VIZ-4274
--- drivers/gpu/drm/i915/intel_lrc.c | 31 +++++++++++++++++++++++++------ drivers/gpu/drm/i915/intel_lrc.h | 5 ++++- 2 files changed, 29 insertions(+), 7 deletions(-)
drivers/gpu/drm/i915/intel_lrc.c +25 -6
@@ -521,6 +521,7 @@ static void execlists_free_request_task(struct work_struct *work)mutex_lock (&dev->struct_mutex);i915_gem_context_unreference (req->ctx); +i915_gem_request_unreference (req->request);mutex_unlock (&dev->struct_mutex);kfree (req);
@@ -528,7 +529,8 @@ static void execlists_free_request_task(struct work_struct *work)static int execlists_context_queue (struct intel_engine_cs *ring,struct intel_context *to, -u32 tail) +u32 tail, +struct drm_i915_gem_request *request) {struct intel_ctx_submit_request *req =NULL , *cursor;struct drm_i915_private *dev_priv = ring->dev->dev_private;
@@ -544,6 +546,22 @@ static int execlists_context_queue(struct intel_engine_cs *ring, req->tail = tail;INIT_WORK (&req->work, execlists_free_request_task); +if (!request) + { +/* +* If there isn't a request associated with this submission, +* create one as a temporary holder. +*/ +WARN (1 ,"execlist context submission without request" ); + request =kzalloc (sizeof (*request),GFP_KERNEL ); +if (request ==NULL ) +return -ENOMEM ; + request->ctx = to; + request->ring = ring; + } + req->request = request; +i915_gem_request_reference (request); +intel_runtime_pm_get (dev_priv);spin_lock_irqsave (&ring->execlist_lock, flags);
@@ -778,7 +796,8 @@ int logical_ring_flush_all_caches(struct intel_ringbuffer *ringbuf)* on a queue waiting for the ELSP to be ready to accept a new context submission. At that * point, the tail *inside* the context is updated and the ELSP written to. */ -void intel_logical_ring_advance_and_submit (struct intel_ringbuffer *ringbuf) +void intel_logical_ring_advance_and_submit (struct intel_ringbuffer *ringbuf, +struct drm_i915_gem_request *request) {struct intel_engine_cs *ring = ringbuf->ring;struct intel_context *ctx = ringbuf->FIXME_lrc_ctx;
@@ -788,7 +807,7 @@ void intel_logical_ring_advance_and_submit(struct intel_ringbuffer *ringbuf)if (intel_ring_stopped (ring))return ; -execlists_context_queue (ring, ctx, ringbuf->tail); +execlists_context_queue (ring, ctx, ringbuf->tail, request); } static int logical_ring_alloc_request(struct intel_engine_cs *ring,
@@ -876,7 +895,7 @@ static int logical_ring_wait_for_space(struct intel_ringbuffer *ringbuf,return ret;/* Force the context submission in case we have been skipping it */ -intel_logical_ring_advance_and_submit (ringbuf); +intel_logical_ring_advance_and_submit (ringbuf,NULL );/* With GEM the hangcheck timer should kick us out of the loop, * leaving it early runs the risk of corrupting GEM state (due
@@ -1221,7 +1240,7 @@ static void gen8_set_seqno(struct intel_engine_cs *ring, u32 seqno)intel_write_status_page (ring,I915_GEM_HWS_INDEX , seqno); } -static int gen8_emit_request (struct intel_ringbuffer *ringbuf) +static int gen8_emit_request (struct intel_ringbuffer *ringbuf,struct drm_i915_gem_request *request) {struct intel_engine_cs *ring = ringbuf->ring;u32 cmd;
@@ -1243,7 +1262,7 @@ static int gen8_emit_request(struct intel_ringbuffer *ringbuf) i915_gem_request_get_seqno(ring->outstanding_lazy_request));intel_logical_ring_emit (ringbuf,MI_USER_INTERRUPT );intel_logical_ring_emit (ringbuf,MI_NOOP ); -intel_logical_ring_advance_and_submit (ringbuf); +intel_logical_ring_advance_and_submit (ringbuf, request);return 0 ; }
drivers/gpu/drm/i915/intel_lrc.h +4 -1
@@ -37,7 +37,8 @@ void intel_logical_ring_cleanup(struct intel_engine_cs *ring);int intel_logical_rings_init (struct drm_device *dev);int logical_ring_flush_all_caches (struct intel_ringbuffer *ringbuf); -void intel_logical_ring_advance_and_submit (struct intel_ringbuffer *ringbuf); +void intel_logical_ring_advance_and_submit (struct intel_ringbuffer *ringbuf, +struct drm_i915_gem_request *request);/** * intel_logical_ring_advance() - advance the ringbuffer tail * @ringbuf: Ringbuffer to advance.
@@ -107,6 +108,8 @@ struct intel_ctx_submit_request {struct work_struct work;int elsp_submitted; + +struct drm_i915_gem_request *request; };void intel_execlists_handle_ctx_events (struct intel_engine_cs *ring);
Signature · 6 lines
2.1.1 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 2/5 drm/i915: Removed duplicate members from submit_request
In reply to Nick HoathWhere there were duplicate variables for the tail, context and ring (engine) in the gem request and the execlist queue item, use the one from the request and remove the duplicate from the execlist queue item.
Issue: VIZ-4274
--- drivers/gpu/drm/i915/i915_debugfs.c | 4 ++-- drivers/gpu/drm/i915/i915_gem.c | 2 +- drivers/gpu/drm/i915/intel_lrc.c | 21 +++++++++------------ drivers/gpu/drm/i915/intel_lrc.h | 4 ---- 4 files changed, 12 insertions(+), 19 deletions(-)
drivers/gpu/drm/i915/i915_debugfs.c +2 -2
@@ -1891,11 +1891,11 @@ static int i915_execlists(struct seq_file *m, void *data)if (head_req) {struct drm_i915_gem_object *ctx_obj; - ctx_obj = head_req->ctx->engine[ring_id].state; + ctx_obj = head_req->request->ctx->engine[ring_id].state;seq_printf (m,"\tHead request id: %u\n" ,intel_execlists_ctx_id (ctx_obj));seq_printf (m,"\tHead request tail: %u\n" , - head_req->tail); + head_req->request->tail); }seq_putc (m,'\n' );
drivers/gpu/drm/i915/i915_gem.c +1 -1
@@ -2704,7 +2704,7 @@ static void i915_gem_reset_ring_cleanup(struct drm_i915_private *dev_priv, execlist_link);list_del (&submit_req->execlist_link);intel_runtime_pm_put (dev_priv); -i915_gem_context_unreference (submit_req->ctx); +i915_gem_context_unreference (submit_req->request->ctx);kfree (submit_req); }
drivers/gpu/drm/i915/intel_lrc.c +9 -12
@@ -396,7 +396,7 @@ static void execlists_context_unqueue(struct intel_engine_cs *ring) execlist_link) {if (!req0) { req0 = cursor; - }else if (req0->ctx == cursor->ctx) { + }else if (req0->request->ctx == cursor->request->ctx) {/* Same ctx: ignore first request, as second request * will update tail past first request's workload */ cursor->elsp_submitted = req0->elsp_submitted;
@@ -411,9 +411,9 @@ static void execlists_context_unqueue(struct intel_engine_cs *ring)WARN_ON (req1 && req1->elsp_submitted); -execlists_submit_contexts (ring, req0->ctx, req0->tail, - req1 ? req1->ctx :NULL , - req1 ? req1->tail :0 ); +execlists_submit_contexts (ring, req0->request->ctx, req0->request->tail, + req1 ? req1->request->ctx :NULL , + req1 ? req1->request->tail :0 ); req0->elsp_submitted++;if (req1)
@@ -434,7 +434,7 @@ static bool execlists_check_remove_request(struct intel_engine_cs *ring,if (head_req !=NULL ) {struct drm_i915_gem_object *ctx_obj = - head_req->ctx->engine[ring->id].state; + head_req->request->ctx->engine[ring->id].state;if (intel_execlists_ctx_id (ctx_obj) == request_id) {WARN (head_req->elsp_submitted ==0 ,"Never submitted head request\n" );
@@ -514,13 +514,13 @@ static void execlists_free_request_task(struct work_struct *work) {struct intel_ctx_submit_request *req = container_of(work, struct intel_ctx_submit_request, work); -struct drm_device *dev = req->ring->dev; +struct drm_device *dev = req->request->ring->dev;struct drm_i915_private *dev_priv = dev->dev_private;intel_runtime_pm_put (dev_priv);mutex_lock (&dev->struct_mutex); -i915_gem_context_unreference (req->ctx); +i915_gem_context_unreference (req->request->ctx);i915_gem_request_unreference (req->request);mutex_unlock (&dev->struct_mutex);
@@ -540,10 +540,6 @@ static int execlists_context_queue(struct intel_engine_cs *ring, req =kzalloc (sizeof (*req),GFP_KERNEL );if (req ==NULL )return -ENOMEM ; - req->ctx = to; -i915_gem_context_reference (req->ctx); - req->ring = ring; - req->tail = tail;INIT_WORK (&req->work, execlists_free_request_task);if (!request)
@@ -561,6 +557,7 @@ static int execlists_context_queue(struct intel_engine_cs *ring, } req->request = request;i915_gem_request_reference (request); +i915_gem_context_reference (req->request->ctx);intel_runtime_pm_get (dev_priv);
@@ -577,7 +574,7 @@ static int execlists_context_queue(struct intel_engine_cs *ring, struct intel_ctx_submit_request, execlist_link); -if (to == tail_req->ctx) { +if (to == tail_req->request->ctx) {WARN (tail_req->elsp_submitted !=0 ,"More than 2 already-submitted reqs queued\n" );list_del (&tail_req->execlist_link);
drivers/gpu/drm/i915/intel_lrc.h +0 -4
@@ -100,10 +100,6 @@ u32 intel_execlists_ctx_id(struct drm_i915_gem_object *ctx_obj);* All accesses to the queue are mediated by a spinlock (ring->execlist_lock). */ struct intel_ctx_submit_request { -struct intel_context *ctx; -struct intel_engine_cs *ring; -u32 tail; -struct list_head execlist_link;struct work_struct work;
Signature · 6 lines
2.1.1 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 3/5 drm/i915: Remove FIXME_lrc_ctx backpointer
In reply to Nick HoathThe first pass implementation of execlists required a backpointer to the context to be held in the intel_ringbuffer. However the context pointer is available higher in the call stack. Remove the backpointer from the ring buffer structure and instead pass it down through the call stack.
v2: Integrate this changeset with the removal of duplicate request/execlist queue item members.
Issue: VIZ-4268
--- drivers/gpu/drm/i915/i915_gem.c | 7 ++-- drivers/gpu/drm/i915/intel_lrc.c | 67 +++++++++++++++++++++------------ drivers/gpu/drm/i915/intel_lrc.h | 8 +++- drivers/gpu/drm/i915/intel_ringbuffer.h | 12 +++--- 4 files changed, 56 insertions(+), 38 deletions(-)
drivers/gpu/drm/i915/i915_gem.c +3 -4
@@ -2451,8 +2451,7 @@ int __i915_add_request(struct intel_engine_cs *ring,return -ENOMEM ;if (i915.enable_execlists) { -struct intel_context *ctx = request->ctx; - ringbuf = ctx->engine[ring->id].ringbuf; + ringbuf = request->ctx->engine[ring->id].ringbuf; }else ringbuf = ring->buffer;
@@ -2465,7 +2464,7 @@ int __i915_add_request(struct intel_engine_cs *ring,* what. */ if (i915.enable_execlists) { - ret =logical_ring_flush_all_caches (ringbuf); + ret =logical_ring_flush_all_caches (ringbuf, request->ctx);if (ret)return ret; }else {
@@ -2487,7 +2486,7 @@ int __i915_add_request(struct intel_engine_cs *ring, request_ring_position =intel_ring_get_tail (ringbuf);if (i915.enable_execlists) { - ret = ring->emit_request (ringbuf, request); + ret = ring->emit_request (ringbuf, request->ctx, request);if (ret)return ret; }else {
drivers/gpu/drm/i915/intel_lrc.c +42 -25
253 lines not on this page · raw message
drivers/gpu/drm/i915/intel_lrc.h +6 -2
@@ -36,8 +36,10 @@ void intel_logical_ring_stop(struct intel_engine_cs *ring);void intel_logical_ring_cleanup (struct intel_engine_cs *ring);int intel_logical_rings_init (struct drm_device *dev); -int logical_ring_flush_all_caches (struct intel_ringbuffer *ringbuf); +int logical_ring_flush_all_caches (struct intel_ringbuffer *ringbuf, +struct intel_context *ctx);void intel_logical_ring_advance_and_submit (struct intel_ringbuffer *ringbuf, +struct intel_context *ctx,struct drm_i915_gem_request *request);/** * intel_logical_ring_advance() - advance the ringbuffer tail
@@ -60,7 +62,9 @@ static inline void intel_logical_ring_emit(struct intel_ringbuffer *ringbuf,iowrite32 (data, ringbuf->virtual_start + ringbuf->tail); ringbuf->tail +=4 ; } -int intel_logical_ring_begin (struct intel_ringbuffer *ringbuf,int num_dwords); +int intel_logical_ring_begin (struct intel_ringbuffer *ringbuf, +struct intel_context *ctx, +int num_dwords);/* Logical Ring Contexts */ int intel_lr_context_render_state_init(struct intel_engine_cs *ring,
drivers/gpu/drm/i915/intel_ringbuffer.h +5 -7
@@ -99,13 +99,6 @@ struct intel_ringbuffer {struct intel_engine_cs *ring; -/* -* FIXME: This backpointer is an artifact of the history of how the -* execlist patches came into being. It will get removed once the basic -* code has landed. -*/ -struct intel_context *FIXME_lrc_ctx; -u32 head;u32 tail;int space;
@@ -123,6 +116,8 @@ struct intel_ringbuffer {u32 last_retired_head; }; +struct intel_context ; + struct intel_engine_cs { const char *name; enum intel_ring_id {
@@ -239,11 +234,14 @@ struct intel_engine_cs {u8 next_context_status_buffer;u32 irq_keep_mask;/* bitmask for interrupts that should not be masked */ int (*emit_request)(struct intel_ringbuffer *ringbuf, +struct intel_context *ctx,struct drm_i915_gem_request *request);int (*emit_flush)(struct intel_ringbuffer *ringbuf, +struct intel_context *ctx,u32 invalidate_domains,u32 flush_domains);int (*emit_bb_start)(struct intel_ringbuffer *ringbuf, +struct intel_context *ctx,u64 offset,unsigned flags);/**
Signature · 6 lines
2.1.1 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 4/5 drm/i915: Subsume intel_ctx_submit_request in to drm_i915_gem_request
In reply to Nick HoathMove all remaining elements that were unique to execlists queue items in to the associated request.
Issue: VIZ-4274
--- drivers/gpu/drm/i915/i915_debugfs.c | 8 +++---- drivers/gpu/drm/i915/i915_drv.h | 22 +++++++++++++++++ drivers/gpu/drm/i915/i915_gem.c | 6 ++--- drivers/gpu/drm/i915/intel_lrc.c | 47 +++++++++++++++++-------------------- drivers/gpu/drm/i915/intel_lrc.h | 28 ---------------------- 5 files changed, 50 insertions(+), 61 deletions(-)
drivers/gpu/drm/i915/i915_debugfs.c +4 -4
@@ -1851,7 +1851,7 @@ static int i915_execlists(struct seq_file *m, void *data)intel_runtime_pm_get (dev_priv);for_each_ring (ring, dev_priv, ring_id) { -struct intel_ctx_submit_request *head_req =NULL ; +struct drm_i915_gem_request *head_req =NULL ;int count =0 ;unsigned long flags;
@@ -1884,18 +1884,18 @@ static int i915_execlists(struct seq_file *m, void *data)list_for_each (cursor, &ring->execlist_queue) count++; head_req =list_first_entry_or_null (&ring->execlist_queue, - struct intel_ctx_submit_request, execlist_link); + struct drm_i915_gem_request, execlist_link);spin_unlock_irqrestore (&ring->execlist_lock, flags);seq_printf (m,"\t%d requests in queue\n" , count);if (head_req) {struct drm_i915_gem_object *ctx_obj; - ctx_obj = head_req->request->ctx->engine[ring_id].state; + ctx_obj = head_req->ctx->engine[ring_id].state;seq_printf (m,"\tHead request id: %u\n" ,intel_execlists_ctx_id (ctx_obj));seq_printf (m,"\tHead request tail: %u\n" , - head_req->request->tail); + head_req->tail); }seq_putc (m,'\n' );
drivers/gpu/drm/i915/i915_drv.h +22 -0
@@ -2027,6 +2027,28 @@ struct drm_i915_gem_request {struct list_head free_list;uint32_t uniq; + +/** +* The ELSP only accepts two elements at a time, so we queue context/tail +* pairs on a given queue (ring->execlist_queue) until the hardware is +* available. The queue serves a double purpose: we also use it to keep track +* of the up to 2 contexts currently in the hardware (usually one in execution +* and the other queued up by the GPU): We only remove elements from the head +* of the queue when the hardware informs us that an element has been +* completed. +* +* All accesses to the queue are mediated by a spinlock (ring->execlist_lock). +*/ + +/** Execlist link in the submission queue.*/ +struct list_head execlist_link; + +/** Execlists workqueue for processing this request in a bottom half */ +struct work_struct work; + +/** Execlists no. of times this request has been sent to the ELSP */ +int elsp_submitted; + };void i915_gem_request_free (struct kref *req_ref);
drivers/gpu/drm/i915/i915_gem.c +3 -3
@@ -2696,14 +2696,14 @@ static void i915_gem_reset_ring_cleanup(struct drm_i915_private *dev_priv, }while (!list_empty (&ring->execlist_queue)) { -struct intel_ctx_submit_request *submit_req; +struct drm_i915_gem_request *submit_req; submit_req =list_first_entry (&ring->execlist_queue, - struct intel_ctx_submit_request, + struct drm_i915_gem_request, execlist_link);list_del (&submit_req->execlist_link);intel_runtime_pm_put (dev_priv); -i915_gem_context_unreference (submit_req->request->ctx); +i915_gem_context_unreference (submit_req->ctx);kfree (submit_req); }
drivers/gpu/drm/i915/intel_lrc.c +21 -26
123 lines not on this page · raw message
drivers/gpu/drm/i915/intel_lrc.h +0 -28
@@ -84,34 +84,6 @@ int intel_execlists_submission(struct drm_device *dev, struct drm_file *file, u64 exec_start, u32 flags);u32 intel_execlists_ctx_id (struct drm_i915_gem_object *ctx_obj); -/** -* struct intel_ctx_submit_request - queued context submission request -* @ctx: Context to submit to the ELSP. -* @ring: Engine to submit it to. -* @tail: how far in the context's ringbuffer this request goes to. -* @execlist_link: link in the submission queue. -* @work: workqueue for processing this request in a bottom half. -* @elsp_submitted: no. of times this request has been sent to the ELSP. -* -* The ELSP only accepts two elements at a time, so we queue context/tail -* pairs on a given queue (ring->execlist_queue) until the hardware is -* available. The queue serves a double purpose: we also use it to keep track -* of the up to 2 contexts currently in the hardware (usually one in execution -* and the other queued up by the GPU): We only remove elements from the head -* of the queue when the hardware informs us that an element has been -* completed. -* -* All accesses to the queue are mediated by a spinlock (ring->execlist_lock). -*/ -struct intel_ctx_submit_request { -struct list_head execlist_link; -struct work_struct work; - -int elsp_submitted; - -struct drm_i915_gem_request *request; -}; -void intel_execlists_handle_ctx_events (struct intel_engine_cs *ring);#endif /* _INTEL_LRC_H_ */
Signature · 6 lines
2.1.1 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 4/5] drm/i915: Subsume intel_ctx_submit_request in to drm_i915_gem_request
On Wed, Nov 12, 2014 at 10:53:26AM +0000, Nick Hoath wrote:
seq_putc(m, '\n');
Quoted 13 lines
drivers/gpu/drm/i915/i915_drv.h +5
-0@@ -2027,6 +2027,28 @@ struct drm_i915_gem_request {struct list_head free_list;uint32_t uniq; + +/** +* The ELSP only accepts two elements at a time, so we queue context/tail +* pairs on a given queue (ring->execlist_queue) until the hardware is +* available. The queue serves a double purpose: we also use it to keep track
drivers/gpu/drm/i915/i915_drv.h struct drm_i915_gem_request { · line 2044
Quoted 10 lines
drivers/gpu/drm/i915/i915_drv.h +10
-0+* of the up to 2 contexts currently in the hardware (usually one in execution +* and the other queued up by the GPU): We only remove elements from the head +* of the queue when the hardware informs us that an element has been +* completed. +* +* All accesses to the queue are mediated by a spinlock (ring->execlist_lock). +*/ + +/** Execlist link in the submission queue.*/ +struct list_head execlist_link;
This is redundant. The request should only be one of the pending or active lists at any time.
drivers/gpu/drm/i915/i915_drv.h struct drm_i915_gem_request { · line 2047
Quoted 2 lines
drivers/gpu/drm/i915/i915_drv.h +2
-0+/** Execlists workqueue for processing this request in a bottom half */ +struct work_struct work;
For what purpose? This is not needed.
drivers/gpu/drm/i915/i915_drv.h struct drm_i915_gem_request { · line 2050
Quoted 2 lines
drivers/gpu/drm/i915/i915_drv.h +2
-0+/** Execlists no. of times this request has been sent to the ELSP */ +int elsp_submitted;
A request can only be submitted exactly once at any time. This bookkeeping is not part of the request.
Still not detangled I am afraid.
-Chris
Signature · 5 lines
Chris Wilson, Intel Open Source Technology Centre _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 4/5] drm/i915: Subsume intel_ctx_submit_request in to drm_i915_gem_request
Quoted 20 lines · Chris Wilson
On Wed, Nov 12, 2014 at 10:53:26AM +0000, Nick Hoath wrote:
seq_putc(m, '\n');Quoted 18 lines
drivers/gpu/drm/i915/i915_drv.h +10
-0@@ -2027,6 +2027,28 @@ struct drm_i915_gem_request {struct list_head free_list;uint32_t uniq; + +/** +* The ELSP only accepts two elements at a time, so we queue context/tail +* pairs on a given queue (ring->execlist_queue) until the hardware is +* available. The queue serves a double purpose: we also use it to keep track +* of the up to 2 contexts currently in the hardware (usually one in execution +* and the other queued up by the GPU): We only remove elements from the head +* of the queue when the hardware informs us that an element has been +* completed. +*
Quoted 9 lines
drivers/gpu/drm/i915/i915_drv.h struct drm_i915_gem_request { · line 2044
Quoted 5 lines
drivers/gpu/drm/i915/i915_drv.h +5
-0+* All accesses to the queue are mediated by a spinlock (ring->execlist_lock). +*/ + +/** Execlist link in the submission queue.*/ +struct list_head execlist_link;This is redundant. The request should only be one of the pending or active lists at any time.
This is used by the pending execlist requests list owned by the intel_engine_cs. The request isn't in both the active and pending execlist engine lists.
Quoted 4 lines
drivers/gpu/drm/i915/i915_drv.h struct drm_i915_gem_request { · line 2047
Quoted 2 lines
drivers/gpu/drm/i915/i915_drv.h +2
-0+/** Execlists workqueue for processing this request in a bottom half */ +struct work_struct work;For what purpose? This is not needed.
This worker is currently used to free up execlist requests. This goes away when Thomas Daniel's patchset is merged. I have spotted a bug in the cleanup handler with the merged requests/execlists cleanup though.
Quoted 6 lines
drivers/gpu/drm/i915/i915_drv.h struct drm_i915_gem_request { · line 2050
Quoted 3 lines
drivers/gpu/drm/i915/i915_drv.h +2
-0+/** Execlists no. of times this request has been sent to the ELSP */ +int elsp_submitted;A request can only be submitted exactly once at any time. This bookkeeping is not part of the request.
This is a refcount to preserve the request if it has been resubmitted due to preemption or TDR, due to a race condition between the HW finishing with the item and the cleanup/resubmission. Have a look at e1fee72c2ea2e9c0c6e6743d32a6832f21337d6c which contains a much better
description of why this exists.
Quoted 4 lines
Still not detangled I am afraid.
-Chris
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 4/5] drm/i915: Subsume intel_ctx_submit_request in to drm_i915_gem_request
Quoted 30 lines · Nick Hoath
Quoted 20 lines · Chris Wilson
On Wed, Nov 12, 2014 at 10:53:26AM +0000, Nick Hoath wrote:
seq_putc(m, '\n');Quoted 18 lines
drivers/gpu/drm/i915/i915_drv.h +10
-0@@ -2027,6 +2027,28 @@ struct drm_i915_gem_request {struct list_head free_list;uint32_t uniq; + +/** +* The ELSP only accepts two elements at a time, so we queue context/tail +* pairs on a given queue (ring->execlist_queue) until the hardware is +* available. The queue serves a double purpose: we also use it to keep track +* of the up to 2 contexts currently in the hardware (usually one in execution +* and the other queued up by the GPU): We only remove elements from the head +* of the queue when the hardware informs us that an element has been +* completed. +* Quoted 9 lines
drivers/gpu/drm/i915/i915_drv.h struct drm_i915_gem_request { · line 2044
Quoted 5 lines
drivers/gpu/drm/i915/i915_drv.h +5
-0+* All accesses to the queue are mediated by a spinlock (ring->execlist_lock). +*/ + +/** Execlist link in the submission queue.*/ +struct list_head execlist_link;This is redundant. The request should only be one of the pending or active lists at any time.
Quoted 3 lines
This is used by the pending execlist requests list owned by the
intel_engine_cs. The request isn't in both the active and pending execlist engine lists.
I guess we'll eventually need to subsume this into the scheduler's list of ctxs. Or reuse it there. Imo ok for now, might just need a rename longterm.
Quoted 8 lines
Quoted 4 lines
drivers/gpu/drm/i915/i915_drv.h struct drm_i915_gem_request { · line 2047
Quoted 2 lines
drivers/gpu/drm/i915/i915_drv.h +2
-0+/** Execlists workqueue for processing this request in a bottom half */ +struct work_struct work;For what purpose? This is not needed.
This worker is currently used to free up execlist requests. This goes away when Thomas Daniel's patchset is merged.
I have spotted a bug in the cleanup handler with the merged requests/execlists cleanup though.
I guess this will drop out on a rebase now that everything has landed?
Quoted 10 lines
Quoted 5 lines
drivers/gpu/drm/i915/i915_drv.h struct drm_i915_gem_request { · line 2050
Quoted 2 lines
drivers/gpu/drm/i915/i915_drv.h +2
-0+/** Execlists no. of times this request has been sent to the ELSP */ +int elsp_submitted;A request can only be submitted exactly once at any time. This bookkeeping is not part of the request.
This is a refcount to preserve the request if it has been resubmitted due to preemption or TDR, due to a race condition between the HW finishing with the item and the cleanup/resubmission. Have a look at
e1fee72c2ea2e9c0c6e6743d32a6832f21337d6cwhich contains a much better description of why this exists.
Yeah this one is still a bit crazy but guess that's just how it is ;-) -Daniel
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 5/5 drm/i915: Change workaround execlist submission to use gem requests.
In reply to Nick HoathIssue: VIZ-4274
--- drivers/gpu/drm/i915/intel_lrc.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/intel_lrc.c +3 -3
@@ -1030,11 +1030,11 @@ static int intel_logical_ring_workarounds_emit(struct intel_engine_cs *ring,return 0 ; ring->gpu_caches_dirty = true; - ret =logical_ring_flush_all_caches (ringbuf); + ret =logical_ring_flush_all_caches (ringbuf, ctx);if (ret)return ret; - ret =intel_logical_ring_begin (ringbuf, w->count *2 +2 ); + ret =intel_logical_ring_begin (ringbuf, ctx, w->count *2 +2 );if (ret)return ret;
@@ -1048,7 +1048,7 @@ static int intel_logical_ring_workarounds_emit(struct intel_engine_cs *ring,intel_logical_ring_advance (ringbuf); ring->gpu_caches_dirty = true; - ret =logical_ring_flush_all_caches (ringbuf); + ret =logical_ring_flush_all_caches (ringbuf, ctx);if (ret)return ret;
Signature · 6 lines
2.1.1 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 8 lines · Nick Hoath
This patchset merges execlist queue items in to gem requests. It does this by using the reference count added by John Harrison's "Replace seqno values with request structures" patchset to ensure that the gem request is available for the whole execlist submission lifespan.
v2: merge
intel_ctx_submit_requestanddrm_i915_gem_request, rebase changes &
add cover letter
Ok, sorry for the long delay - I got a bit distracted and also thought it would be better to get John's and Thomas' patches in first since this is based upon them.
But that's now out of the way and I think this is definitely a good step into the right direction. So can you please rebase and resend so that we can do the review&merge dance?
Thanks, Daniel
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx