drm/i915: Remove misleading comment in request_alloc
Subsystems (2)
PATCH v2 1/6 drm/i915: Remove misleading comment in request_alloc
Passing NULL ctx to request_alloc would lead to null-ptr-deref.
v2: Let's not replace the comment with a BUG_ON
--- drivers/gpu/drm/i915/i915_gem_request.c | 3 --- 1 file changed, 3 deletions(-)
drivers/gpu/drm/i915/i915_gem_request.c +0 -3
@@ -538,9 +538,6 @@ submit_notify(struct i915_sw_fence *fence, enum i915_sw_fence_notify state)* * @engine: engine that we wish to issue the request on. * @ctx: context that the request will be associated with. -* This can be NULL if the request is not directly related to -* any specific user context, in which case this function will -* choose an appropriate context to use. * * Returns a pointer to the allocated request if successful, * or an error code if not.
Signature · 6 lines
2.9.4 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v2 2/6 drm/i915/guc: Submit GuC workitems containing coalesced requests
To create an upper bound on number of GuC workitems, we need to change the way that requests are being submitted. Rather than submitting each request as an individual workitem, we can do coalescing in a similar way we're handlig execlist submission ports. We also need to stop pretending that we're doing "lite-restore" in GuC submission (we would create a workitem each time we hit this condition).
v2: Also coalesce when replaying on reset (Daniele)
--- drivers/gpu/drm/i915/i915_guc_submission.c | 68 ++++++++++++++++-------------- 1 file changed, 36 insertions(+), 32 deletions(-)
drivers/gpu/drm/i915/i915_guc_submission.c +36 -32
@@ -580,7 +580,7 @@ static int guc_ring_doorbell(struct i915_guc_client *client) }/** -* __i915_guc_submit() - Submit commands through GuC +* i915_guc_submit() - Submit commands through GuC * @rq: request associated with the commands * * The caller must have already called i915_guc_wq_reserve() above with
@@ -594,7 +594,7 @@ static int guc_ring_doorbell(struct i915_guc_client *client)* The only error here arises if the doorbell hardware isn't functioning * as expected, which really shouln't happen. */ -static void __i915_guc_submit (struct drm_i915_gem_request *rq) +static void i915_guc_submit (struct drm_i915_gem_request *rq) {struct drm_i915_private *dev_priv = rq->i915;struct intel_engine_cs *engine = rq->engine;
@@ -624,12 +624,6 @@ static void __i915_guc_submit(struct drm_i915_gem_request *rq)spin_unlock_irqrestore (&client->wq_lock, flags); } -static void i915_guc_submit (struct drm_i915_gem_request *rq) -{ -__i915_gem_request_submit (rq); -__i915_guc_submit (rq); -} -static void nested_enable_signaling (struct drm_i915_gem_request *rq) {/* If we use dma_fence_enable_sw_signaling() directly, lockdep
@@ -665,12 +659,15 @@ static void port_assign(struct execlist_port *port,nested_enable_signaling (rq); } -static bool i915_guc_dequeue (struct intel_engine_cs *engine) +static void i915_guc_dequeue (struct intel_engine_cs *engine) {struct execlist_port *port = engine->execlist_port; -struct drm_i915_gem_request *last =port_request (port); -struct rb_node *rb; +struct drm_i915_gem_request *last =NULL ;bool submit = false; +struct rb_node *rb; + +if (port_request (port)) + port++;spin_lock_irq (&engine->timeline->lock); rb = engine->execlist_first;
@@ -689,12 +686,16 @@ static bool i915_guc_dequeue(struct intel_engine_cs *engine)port_assign (port, last); port++; +if (submit) { +i915_guc_submit (last); + submit = false; + } }INIT_LIST_HEAD (&rq->priotree.link); rq->priotree.priority =INT_MAX ; -i915_guc_submit (rq); +__i915_gem_request_submit (rq);trace_i915_gem_request_in (rq,port_index (port, engine)); last = rq; submit = true;
@@ -708,11 +709,11 @@ static bool i915_guc_dequeue(struct intel_engine_cs *engine) } done: engine->execlist_first = rb; -if (submit) +if (submit) {port_assign (port, last); +i915_guc_submit (last); + }spin_unlock_irq (&engine->timeline->lock); - -return submit; }static void i915_guc_irq_handler (unsigned long data)
@@ -720,24 +721,20 @@ static void i915_guc_irq_handler(unsigned long data)struct intel_engine_cs *engine = (struct intel_engine_cs *)data;struct execlist_port *port = engine->execlist_port;struct drm_i915_gem_request *rq; -bool submit; -do { - rq =port_request (&port[0 ]); -while (rq &&i915_gem_request_completed (rq)) { -trace_i915_gem_request_out (rq); -i915_gem_request_put (rq); + rq =port_request (&port[0 ]); +while (rq &&i915_gem_request_completed (rq)) { +trace_i915_gem_request_out (rq); +i915_gem_request_put (rq); - port[0 ] = port[1 ]; -memset (&port[1 ],0 ,sizeof (port[1 ])); + port[0 ] = port[1 ]; +memset (&port[1 ],0 ,sizeof (port[1 ])); - rq =port_request (&port[0 ]); - } + rq =port_request (&port[0 ]); + } - submit = false; -if (!port_count (&port[1 ])) - submit =i915_guc_dequeue (engine); - }while (submit); +if (!port_isset (&port[1 ])) +i915_guc_dequeue (engine); }/*
@@ -1255,6 +1252,8 @@ int i915_guc_submission_enable(struct drm_i915_private *dev_priv)for_each_engine (engine, dev_priv, id) {const int wqi_size =sizeof (struct guc_wq_item );struct drm_i915_gem_request *rq; +struct execlist_port *port = engine->execlist_port; +int n;/* The tasklet was initialised by execlists, and may be in * a state of flux (across a reset) and so we just want to
@@ -1266,11 +1265,16 @@ int i915_guc_submission_enable(struct drm_i915_private *dev_priv)/* Replay the current set of previously submitted requests */ spin_lock_irq (&engine->timeline->lock); -list_for_each_entry (rq, &engine->timeline->requests, link) { +list_for_each_entry (rq, &engine->timeline->requests, link)guc_client_update_wq_rsvd (client, wqi_size); -__i915_guc_submit (rq); - }spin_unlock_irq (&engine->timeline->lock); + +for (n =0 ; n <ARRAY_SIZE (engine->execlist_port); n++) { +if (!port_isset (&port[n])) +break ; + +i915_guc_submit (port_request (&port[n])); + } }return 0 ;
Signature · 6 lines
2.9.4 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH v2 2/6] drm/i915/guc: Submit GuC workitems containing coalesced requests
Quoted 91 lines · Michał Winiarski
To create an upper bound on number of GuC workitems, we need to change the way that requests are being submitted. Rather than submitting each request as an individual workitem, we can do coalescing in a similar way we're handlig execlist submission ports. We also need to stop pretending that we're doing "lite-restore" in GuC submission (we would create a workitem each time we hit this condition).
v2: Also coalesce when replaying on reset (Daniele)
Cc Chris Wilson <[email protected]>Cc Daniele Ceraolo Spurio <[email protected]>Cc Michal Wajdeczko <[email protected]>Cc Oscar Mateo <[email protected]>Signed-off-by Michał Winiarski <[email protected]>--- drivers/gpu/drm/i915/i915_guc_submission.c | 68 ++++++++++++++++-------------- 1 file changed, 36 insertions(+), 32 deletions(-)drivers/gpu/drm/i915/i915_guc_submission.c +13
-12@@ -580,7 +580,7 @@ static int guc_ring_doorbell(struct i915_guc_client *client) }/** -* __i915_guc_submit() - Submit commands through GuC +* i915_guc_submit() - Submit commands through GuC * @rq: request associated with the commands * * The caller must have already called i915_guc_wq_reserve() above with @@ -594,7 +594,7 @@ static int guc_ring_doorbell(struct i915_guc_client *client)* The only error here arises if the doorbell hardware isn't functioning * as expected, which really shouln't happen. */ -static void __i915_guc_submit (struct drm_i915_gem_request *rq) +static void i915_guc_submit (struct drm_i915_gem_request *rq) {struct drm_i915_private *dev_priv = rq->i915;struct intel_engine_cs *engine = rq->engine;@@ -624,12 +624,6 @@ static void __i915_guc_submit(struct drm_i915_gem_request *rq)spin_unlock_irqrestore (&client->wq_lock, flags); } -static void i915_guc_submit (struct drm_i915_gem_request *rq) -{ -__i915_gem_request_submit (rq); -__i915_guc_submit (rq); -} -static void nested_enable_signaling (struct drm_i915_gem_request *rq) {/* If we use dma_fence_enable_sw_signaling() directly, lockdep @@ -665,12 +659,15 @@ static void port_assign(struct execlist_port *port,nested_enable_signaling (rq); } -static bool i915_guc_dequeue (struct intel_engine_cs *engine) +static void i915_guc_dequeue (struct intel_engine_cs *engine) {struct execlist_port *port = engine->execlist_port; -struct drm_i915_gem_request *last =port_request (port); -struct rb_node *rb; +struct drm_i915_gem_request *last =NULL ;bool submit = false; +struct rb_node *rb; + +if (port_request (port)) + port++;spin_lock_irq (&engine->timeline->lock); rb = engine->execlist_first;@@ -689,12 +686,16 @@ static bool i915_guc_dequeue(struct intel_engine_cs *engine)port_assign (port, last); port++; +if (submit) { +i915_guc_submit (last); + submit = false; + } }INIT_LIST_HEAD (&rq->priotree.link); rq->priotree.priority =INT_MAX ; -i915_guc_submit (rq); +__i915_gem_request_submit (rq);trace_i915_gem_request_in (rq,port_index (port, engine)); last = rq; submit = true;
drivers/gpu/drm/i915/i915_guc_submission.c static bool i915_guc_dequeue(struct intel_engine_cs *engine) · line 715
Quoted 8 lines
drivers/gpu/drm/i915/i915_guc_submission.c +3
-1@@ -708,11 +709,11 @@ static bool i915_guc_dequeue(struct intel_engine_cs *engine) } done: engine->execlist_first = rb; -if (submit) +if (submit) {port_assign (port, last); +i915_guc_submit (last); + }
Since now we only call both port_assign and i915_guc_submit once per port, can we move both usages in the loop, before the break, and remove it from here? i.e.:
if (last && rq->ctx != last->ctx) {
if (submit) {
port_assign(port, last);
i915_guc_submit(last);
}
if (port != engine->execlist_port) {
__list_del_many(&p->requests,
&rq->priotree.link);
goto done;
}
port++;
}Or do we have issues with the ordering of operations?
Quoted 51 lines
drivers/gpu/drm/i915/i915_guc_submission.c +12
-16spin_unlock_irq (&engine->timeline->lock); - -return submit; }static void i915_guc_irq_handler (unsigned long data)@@ -720,24 +721,20 @@ static void i915_guc_irq_handler(unsigned long data)struct intel_engine_cs *engine = (struct intel_engine_cs *)data;struct execlist_port *port = engine->execlist_port;struct drm_i915_gem_request *rq; -bool submit; -do { - rq =port_request (&port[0 ]); -while (rq &&i915_gem_request_completed (rq)) { -trace_i915_gem_request_out (rq); -i915_gem_request_put (rq); + rq =port_request (&port[0 ]); +while (rq &&i915_gem_request_completed (rq)) { +trace_i915_gem_request_out (rq); +i915_gem_request_put (rq); - port[0 ] = port[1 ]; -memset (&port[1 ],0 ,sizeof (port[1 ])); + port[0 ] = port[1 ]; +memset (&port[1 ],0 ,sizeof (port[1 ])); - rq =port_request (&port[0 ]); - } + rq =port_request (&port[0 ]); + } - submit = false; -if (!port_count (&port[1 ])) - submit =i915_guc_dequeue (engine); - }while (submit); +if (!port_isset (&port[1 ])) +i915_guc_dequeue (engine); }/* @@ -1255,6 +1252,8 @@ int i915_guc_submission_enable(struct drm_i915_private *dev_priv)for_each_engine (engine, dev_priv, id) {const int wqi_size =sizeof (struct guc_wq_item );struct drm_i915_gem_request *rq; +struct execlist_port *port = engine->execlist_port; +int n;/* The tasklet was initialised by execlists, and may be in * a state of flux (across a reset) and so we just want to
drivers/gpu/drm/i915/i915_guc_submission.c int i915_guc_submission_enable(struct drm_i915_private *dev_priv) · line 1269
Quoted 6 lines
drivers/gpu/drm/i915/i915_guc_submission.c +1
-1@@ -1266,11 +1265,16 @@ int i915_guc_submission_enable(struct drm_i915_private *dev_priv)/* Replay the current set of previously submitted requests */ spin_lock_irq (&engine->timeline->lock); -list_for_each_entry (rq, &engine->timeline->requests, link) { +list_for_each_entry (rq, &engine->timeline->requests, link)guc_client_update_wq_rsvd (client, wqi_size);
Should we move the reservation to just above i915_guc_submit()? we use 1 wq item per port and not per request starting this patch. Code is going away in the next patch anyway so I'm happy if you skip this change to keep things simple.
Thanks,
Daniele
Quoted 4 lines
drivers/gpu/drm/i915/i915_guc_submission.c +0
-2-__i915_guc_submit (rq); - }spin_unlock_irq (&engine->timeline->lock);
drivers/gpu/drm/i915/i915_guc_submission.c int i915_guc_submission_enable(struct drm_i915_private *dev_priv) · line 1280
Quoted 10 lines
drivers/gpu/drm/i915/i915_guc_submission.c +7
-0+ +for (n =0 ; n <ARRAY_SIZE (engine->execlist_port); n++) { +if (!port_isset (&port[n])) +break ; + +i915_guc_submit (port_request (&port[n])); + } }return 0 ;
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH v2 2/6] drm/i915/guc: Submit GuC workitems containing coalesced requests
Quoted 21 lines · Daniele Ceraolo Spurio
Quoted 18 lines · Michał Winiarski
To create an upper bound on number of GuC workitems, we need to change the way that requests are being submitted. Rather than submitting each request as an individual workitem, we can do coalescing in a similar way we're handlig execlist submission ports. We also need to stop pretending that we're doing "lite-restore" in GuC submission (we would create a workitem each time we hit this condition).
v2: Also coalesce when replaying on reset (Daniele)
Cc Chris Wilson <[email protected]>Cc Daniele Ceraolo Spurio <[email protected]>Cc Michal Wajdeczko <[email protected]>Cc Oscar Mateo <[email protected]>Signed-off-by Michał Winiarski <[email protected]>--- drivers/gpu/drm/i915/i915_guc_submission.c | 68 ++++++++++++++++-------------- 1 file changed, 36 insertions(+), 32 deletions(-)
[SNIP]
Quoted 46 lines
Quoted 19 lines
drivers/gpu/drm/i915/i915_guc_submission.c +5
-1@@ -689,12 +686,16 @@ static bool i915_guc_dequeue(struct intel_engine_cs *engine)port_assign (port, last); port++; +if (submit) { +i915_guc_submit (last); + submit = false; + } }INIT_LIST_HEAD (&rq->priotree.link); rq->priotree.priority =INT_MAX ; -i915_guc_submit (rq); +__i915_gem_request_submit (rq);trace_i915_gem_request_in (rq,port_index (port, engine)); last = rq; submit = true;drivers/gpu/drm/i915/i915_guc_submission.c static bool i915_guc_dequeue(struct intel_engine_cs *engine) · line 715
Quoted 8 lines
drivers/gpu/drm/i915/i915_guc_submission.c +3
-1@@ -708,11 +709,11 @@ static bool i915_guc_dequeue(struct intel_engine_cs *engine) } done: engine->execlist_first = rb; -if (submit) +if (submit) {port_assign (port, last); +i915_guc_submit (last); + }Since now we only call both
port_assignandi915_guc_submitonce per port, can we move both usages in the loop, before the break, and remove it from here? i.e.:if (last && rq->ctx != last->ctx) { if (submit) { port_assign(port, last); i915_guc_submit(last); } if (port != engine->execlist_port) { __list_del_many(&p->requests, &rq->priotree.link); goto done; } port++; }
Quoted 1 line
Or do we have issues with the ordering of operations?
No, not with the ordering, it's just that we won't handle the case where we've ran out of request (we're done iterating through the list, but we still have to submit "last" request). Still, I think moving port_assign and port++ under submit conditional makes the code a bit easier on the reader - I'll do that in next version.
Quoted 54 lines
Quoted 54 lines
drivers/gpu/drm/i915/i915_guc_submission.c +12
-16spin_unlock_irq (&engine->timeline->lock); - -return submit; }static void i915_guc_irq_handler (unsigned long data)@@ -720,24 +721,20 @@ static void i915_guc_irq_handler(unsigned long data)struct intel_engine_cs *engine = (struct intel_engine_cs *)data;struct execlist_port *port = engine->execlist_port;struct drm_i915_gem_request *rq; -bool submit; -do { - rq =port_request (&port[0 ]); -while (rq &&i915_gem_request_completed (rq)) { -trace_i915_gem_request_out (rq); -i915_gem_request_put (rq); + rq =port_request (&port[0 ]); +while (rq &&i915_gem_request_completed (rq)) { +trace_i915_gem_request_out (rq); +i915_gem_request_put (rq); - port[0 ] = port[1 ]; -memset (&port[1 ],0 ,sizeof (port[1 ])); + port[0 ] = port[1 ]; +memset (&port[1 ],0 ,sizeof (port[1 ])); - rq =port_request (&port[0 ]); - } + rq =port_request (&port[0 ]); + } - submit = false; -if (!port_count (&port[1 ])) - submit =i915_guc_dequeue (engine); - }while (submit); +if (!port_isset (&port[1 ])) +i915_guc_dequeue (engine); }/* @@ -1255,6 +1252,8 @@ int i915_guc_submission_enable(struct drm_i915_private *dev_priv)for_each_engine (engine, dev_priv, id) {const int wqi_size =sizeof (struct guc_wq_item );struct drm_i915_gem_request *rq; +struct execlist_port *port = engine->execlist_port; +int n;/* The tasklet was initialised by execlists, and may be in * a state of flux (across a reset) and so we just want to @@ -1266,11 +1265,16 @@ int i915_guc_submission_enable(struct drm_i915_private *dev_priv)
Quoted 10 lines
drivers/gpu/drm/i915/i915_guc_submission.c int i915_guc_submission_enable(struct drm_i915_private *dev_priv) · line 1269
Quoted 5 lines
drivers/gpu/drm/i915/i915_guc_submission.c +1
-1/* Replay the current set of previously submitted requests */ spin_lock_irq (&engine->timeline->lock); -list_for_each_entry (rq, &engine->timeline->requests, link) { +list_for_each_entry (rq, &engine->timeline->requests, link)guc_client_update_wq_rsvd (client, wqi_size);Should we move the reservation to just above
i915_guc_submit()? we use 1 wq item per port and not per request starting this patch. Code is going away in the next patch anyway so I'm happy if you skip this change to keep things simple.
Yeah, actually, wq_resv is broken in this version. We're reserving per-request, but we're unreserving per-workitem basis, which will eventually lead to wq_resv going full. I still need to fix it for bisectability.
-Michał
Quoted 15 lines
Thanks,
DanieleQuoted 12 lines
drivers/gpu/drm/i915/i915_guc_submission.c +7
-2-__i915_guc_submit (rq); - }spin_unlock_irq (&engine->timeline->lock); + +for (n =0 ; n <ARRAY_SIZE (engine->execlist_port); n++) { +if (!port_isset (&port[n])) +break ; + +i915_guc_submit (port_request (&port[n])); + } }
Quoted 2 lines
drivers/gpu/drm/i915/i915_guc_submission.c int i915_guc_submission_enable(struct drm_i915_private *dev_priv) · line 1280
Quoted 2 lines
drivers/gpu/drm/i915/i915_guc_submission.c +0
-0return 0 ;
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v2 3/6 drm/i915/guc: Remove GuC wq reservation
In reply to Michał WiniarskiNow that we have an upper bound on the number of work items being sent to GuC, we can remove the reservation.
v2: Multiply by number of engines in compile time assert (Daniele)
--- drivers/gpu/drm/i915/i915_debugfs.c | 1 - drivers/gpu/drm/i915/i915_guc_submission.c | 81 ++---------------------------- drivers/gpu/drm/i915/intel_lrc.c | 25 ++------- drivers/gpu/drm/i915/intel_uc.h | 8 --- 4 files changed, 8 insertions(+), 107 deletions(-)
drivers/gpu/drm/i915/i915_debugfs.c +0 -1
@@ -2481,7 +2481,6 @@ static void i915_guc_client_info(struct seq_file *m,seq_printf (m,"\tWQ size %d, offset: 0x%x, tail %d\n" , client->wq_size, client->wq_offset, client->wq_tail); -seq_printf (m,"\tWork queue full: %u\n" , client->no_wq_space);seq_printf (m,"\tFailed doorbell: %u\n" , client->b_fail);seq_printf (m,"\tLast submission result: %d\n" , client->retcode);
drivers/gpu/drm/i915/i915_guc_submission.c +5 -76
129 lines not on this page · raw message
drivers/gpu/drm/i915/intel_lrc.c +3 -22
@@ -913,27 +913,14 @@ static int execlists_request_alloc(struct drm_i915_gem_request *request)*/ request->reserved_space +=EXECLISTS_REQUEST_SIZE ; -if (i915.enable_guc_submission) { -/* -* Check that the GuC has space for the request before -* going any further, as the i915_add_request() call -* later on mustn't fail ... -*/ - ret =i915_guc_wq_reserve (request); -if (ret) - goto err; - } - cs =intel_ring_begin (request,0 ); -if (IS_ERR (cs)) { - ret =PTR_ERR (cs); - goto err_unreserve; - } +if (IS_ERR (cs)) +return PTR_ERR (cs);if (!ce->initialised) { ret = engine->init_context (request);if (ret) - goto err_unreserve; +return ret; ce->initialised = true; }
@@ -947,12 +934,6 @@ static int execlists_request_alloc(struct drm_i915_gem_request *request) request->reserved_space -=EXECLISTS_REQUEST_SIZE ;return 0 ; - -err_unreserve: -if (i915.enable_guc_submission) -i915_guc_wq_unreserve (request); -err: -return ret; }/*
drivers/gpu/drm/i915/intel_uc.h +0 -8
@@ -55,10 +55,6 @@ struct drm_i915_gem_request;* * We also keep a few statistics on failures. Ideally, these should all * be zero! -* no_wq_space: times that the submission pre-check found no space was -* available in the work queue (note, the queue is shared, -* not per-engine). It is OK for this to be nonzero, but -* it should not be huge! * q_fail: failed to enqueue a work item. This should never happen, * because we check for space beforehand. * b_fail: failed to ring the doorbell. This should never happen, unless
@@ -85,8 +81,6 @@ struct i915_guc_client {uint32_t wq_offset;uint32_t wq_size;uint32_t wq_tail; -uint32_t wq_rsvd; -uint32_t no_wq_space;uint32_t b_fail;int retcode;
@@ -260,8 +254,6 @@ u32 intel_guc_wopcm_size(struct drm_i915_private *dev_priv);/* i915_guc_submission.c */ int i915_guc_submission_init (struct drm_i915_private *dev_priv);int i915_guc_submission_enable (struct drm_i915_private *dev_priv); -int i915_guc_wq_reserve (struct drm_i915_gem_request *rq); -void i915_guc_wq_unreserve (struct drm_i915_gem_request *request);void i915_guc_submission_disable (struct drm_i915_private *dev_priv);void i915_guc_submission_fini (struct drm_i915_private *dev_priv);struct i915_vma *intel_guc_allocate_vma (struct intel_guc *guc,u32 size);
Signature · 6 lines
2.9.4 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v2 4/6 drm/i915/scheduler: Remember request priority throughout its lifetime
In reply to Michał WiniarskiSince request can be unsubmitted, we need to avoid overriding its priority during submission. Otherwise we won't be able to resubmit it with correct priority.
v2: Limit DFS by excluding completed requests (Chris)
--- drivers/gpu/drm/i915/i915_guc_submission.c | 1 - drivers/gpu/drm/i915/intel_lrc.c | 13 ++++++++++--- 2 files changed, 10 insertions(+), 4 deletions(-)
drivers/gpu/drm/i915/i915_guc_submission.c +0 -1
@@ -626,7 +626,6 @@ static void i915_guc_dequeue(struct intel_engine_cs *engine) }INIT_LIST_HEAD (&rq->priotree.link); - rq->priotree.priority =INT_MAX ;__i915_gem_request_submit (rq);trace_i915_gem_request_in (rq,port_index (port, engine));
drivers/gpu/drm/i915/intel_lrc.c +10 -3
@@ -487,7 +487,6 @@ static void execlists_dequeue(struct intel_engine_cs *engine) }INIT_LIST_HEAD (&rq->priotree.link); - rq->priotree.priority =INT_MAX ;__i915_gem_request_submit (rq);trace_i915_gem_request_in (rq,port_index (port, engine));
@@ -771,9 +770,17 @@ static void execlists_schedule(struct drm_i915_gem_request *request, int prio)* engines. */ list_for_each_entry (p, &pt->signalers_list, signal_link) { +struct drm_i915_gem_request *s = +container_of (p->signaler,typeof (*s), priotree); +GEM_BUG_ON (p->signaler->priority < pt->priority); -if (prio >READ_ONCE (p->signaler->priority)) -list_move_tail (&p->dfs_link, &dfs); +if (prio <=READ_ONCE (p->signaler->priority)) +continue ; + +if (i915_gem_request_completed (s)) +continue ; + +list_move_tail (&p->dfs_link, &dfs); }list_safe_reset_next (dep, p, dfs_link);
Signature · 6 lines
2.9.4 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v2 5/6 drm/i915/scheduler: Split insert_request
In reply to Michał WiniarskiWe'd like to reuse the priolist lookup in request resubmission path, let's split insert_request to make that happen.
v2: Handle allocation error in lookup rather than in caller (Chris)
--- drivers/gpu/drm/i915/intel_lrc.c | 41 ++++++++++++++++++++++++---------------- 1 file changed, 25 insertions(+), 16 deletions(-)
drivers/gpu/drm/i915/intel_lrc.c +25 -16
@@ -627,20 +627,16 @@ static void intel_lrc_irq_handler(unsigned long data)intel_uncore_forcewake_put (dev_priv, engine->fw_domains); } -static bool -insert_request (struct intel_engine_cs *engine, -struct i915_priotree *pt, -int prio) +static struct i915_priolist * +priolist_lookup (struct intel_engine_cs *engine,int prio,bool *first) {struct i915_priolist *p;struct rb_node **parent, *rb; -bool first = true; +find_priolist:if (unlikely (engine->no_priolist)) prio =I915_PRIORITY_NORMAL ; - -find_priolist: -/* most positive priority is scheduled first, equal priorities fifo */ + *first = true; rb =NULL ; parent = &engine->execlist_queue.rb_node;while (*parent) {
@@ -650,10 +646,10 @@ insert_request(struct intel_engine_cs *engine, parent = &rb->rb_left; }else if (prio < p->priority) { parent = &rb->rb_right; - first = false; + *first = false; }else { -list_add_tail (&pt->link, &p->requests); -return false; + *first = false; +return p; } }
@@ -661,10 +657,8 @@ insert_request(struct intel_engine_cs *engine, p = &engine->default_priolist; }else { p =kmem_cache_alloc (engine->i915->priorities,GFP_ATOMIC ); -/* Convert an allocation failure to a priority bump */ -if (unlikely (!p)) { - prio =I915_PRIORITY_NORMAL ;/* recurses just once */ +if (unlikely (!p)) {/* To maintain ordering with all rendering, after an * allocation failure we have to disable all scheduling. * Requests will then be executed in fifo, and schedule
@@ -683,11 +677,26 @@ insert_request(struct intel_engine_cs *engine,rb_insert_color (&p->node, &engine->execlist_queue);INIT_LIST_HEAD (&p->requests); -list_add_tail (&pt->link, &p->requests); -if (first) +if (*first) engine->execlist_first = &p->node; +return p; +} + +static bool +insert_request (struct intel_engine_cs *engine, +struct i915_priotree *pt, +int prio) +{ +struct i915_priolist *p; +bool first = false; + + p =priolist_lookup (engine, prio, &first); + +/* most positive priority is scheduled first, equal priorities fifo */ +list_add_tail (&pt->link, &p->requests); +return first; }
Signature · 6 lines
2.9.4 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v3 6/6 drm/i915/scheduler: Use priorities when resubmitting after reset
In reply to Michał WiniarskiNow that we're able to unsubmit requests, we can take advantage of it during reset. Rather than resubmitting the previous workload directly to GuC/ELSP, we can simply move the requests back to priority queue, submitting from the tasklet instead.
v2: Move the tasklet schedule out for legacy ringbuffer submission
v3: Handle allocation error in lookup rather than in caller (Chris)
--- drivers/gpu/drm/i915/i915_gem.c | 6 +- drivers/gpu/drm/i915/i915_guc_submission.c | 15 +-- drivers/gpu/drm/i915/intel_lrc.c | 141 +++++++++++++++++------------ drivers/gpu/drm/i915/intel_lrc.h | 1 + 4 files changed, 89 insertions(+), 74 deletions(-)
drivers/gpu/drm/i915/i915_gem.c +1 -5
@@ -3019,15 +3019,11 @@ static void engine_set_wedged(struct intel_engine_cs *engine)*/ if (i915.enable_execlists) { -struct execlist_port *port = engine->execlist_port;unsigned long flags; -unsigned int n;spin_lock_irqsave (&engine->timeline->lock, flags); -for (n =0 ; n <ARRAY_SIZE (engine->execlist_port); n++) -i915_gem_request_put (port_request (&port[n])); -memset (engine->execlist_port,0 ,sizeof (engine->execlist_port)); +intel_lr_clear_execlist_ports (engine); engine->execlist_queue =RB_ROOT ; engine->execlist_first =NULL ;
drivers/gpu/drm/i915/i915_guc_submission.c +2 -13
@@ -534,14 +534,13 @@ static void i915_guc_submit(struct drm_i915_gem_request *rq)unsigned int engine_id = engine->id;struct intel_guc *guc = &rq->i915->guc;struct i915_guc_client *client = guc->execbuf_client; -unsigned long flags;int b_ret;/* WA to flush out the pending GMADR writes to ring buffer. */ if (i915_vma_is_map_and_fenceable (rq->ring->vma))POSTING_READ_FW (GUC_STATUS ); -spin_lock_irqsave (&client->wq_lock, flags); +spin_lock (&client->wq_lock);guc_wq_item_append (client, rq); b_ret =guc_ring_doorbell (client);
@@ -554,7 +553,7 @@ static void i915_guc_submit(struct drm_i915_gem_request *rq) guc->submissions[engine_id] +=1 ; guc->last_seqno[engine_id] = rq->global_seqno; -spin_unlock_irqrestore (&client->wq_lock, flags); +spin_unlock (&client->wq_lock); }static void nested_enable_signaling (struct drm_i915_gem_request *rq)
@@ -1186,9 +1185,6 @@ int i915_guc_submission_enable(struct drm_i915_private *dev_priv)guc_interrupts_capture (dev_priv);for_each_engine (engine, dev_priv, id) { -struct execlist_port *port = engine->execlist_port; -int n; -/* The tasklet was initialised by execlists, and may be in * a state of flux (across a reset) and so we just want to * take over the callback without changing any other state
@@ -1196,13 +1192,6 @@ int i915_guc_submission_enable(struct drm_i915_private *dev_priv)*/ engine->irq_tasklet.func = i915_guc_irq_handler;clear_bit (ENGINE_IRQ_EXECLIST , &engine->irq_posted); - -for (n =0 ; n <ARRAY_SIZE (engine->execlist_port); n++) { -if (!port_isset (&port[n])) -break ; - -i915_guc_submit (port_request (&port[n])); - } }return 0 ;
drivers/gpu/drm/i915/intel_lrc.c +85 -56
184 lines not on this page · raw message
drivers/gpu/drm/i915/intel_lrc.h +1 -0
@@ -83,6 +83,7 @@ uint64_t intel_lr_context_descriptor(struct i915_gem_context *ctx, struct intel_engine_cs *engine);/* Execlists */ +void intel_lr_clear_execlist_ports (struct intel_engine_cs *engine);int intel_sanitize_enable_execlists (struct drm_i915_private *dev_priv,int enable_execlists);
Signature · 6 lines
2.9.4 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Patchwork
CI✓ Fi.CI.BAT: success for series starting with [v2,1/6] drm/i915: Remove misleading comment in request_alloc
In reply to Michał Winiarski== Series Details ==
== Series Details ==
Series: series starting with [v2,1/6] drm/i915: Remove misleading comment in request_alloc
URL : https://patchwork.freedesktop.org/series/24696/
State : success
== Summary ==
Series 24696v1 Series without cover letter
https://patchwork.freedesktop.org/api/1.0/series/24696/revisions/1/mbox/
fi-bdw-5557u total:278 pass:267 dwarn:0 dfail:0 fail:0 skip:11 time:445s fi-bdw-gvtdvm total:278 pass:256 dwarn:8 dfail:0 fail:0 skip:14 time:436s fi-bsw-n3050 total:278 pass:242 dwarn:0 dfail:0 fail:0 skip:36 time:588s fi-bxt-j4205 total:278 pass:259 dwarn:0 dfail:0 fail:0 skip:19 time:517s fi-byt-j1900 total:278 pass:254 dwarn:0 dfail:0 fail:0 skip:24 time:495s fi-byt-n2820 total:278 pass:250 dwarn:0 dfail:0 fail:0 skip:28 time:488s fi-hsw-4770 total:278 pass:262 dwarn:0 dfail:0 fail:0 skip:16 time:421s fi-hsw-4770r total:278 pass:262 dwarn:0 dfail:0 fail:0 skip:16 time:416s fi-ilk-650 total:278 pass:228 dwarn:0 dfail:0 fail:0 skip:50 time:421s fi-ivb-3520m total:278 pass:260 dwarn:0 dfail:0 fail:0 skip:18 time:497s fi-ivb-3770 total:278 pass:260 dwarn:0 dfail:0 fail:0 skip:18 time:467s fi-kbl-7500u total:278 pass:255 dwarn:5 dfail:0 fail:0 skip:18 time:464s fi-skl-6260u total:278 pass:268 dwarn:0 dfail:0 fail:0 skip:10 time:465s fi-skl-6700hq total:278 pass:261 dwarn:0 dfail:0 fail:0 skip:17 time:571s fi-skl-6700k total:278 pass:256 dwarn:4 dfail:0 fail:0 skip:18 time:470s fi-skl-6770hq total:278 pass:268 dwarn:0 dfail:0 fail:0 skip:10 time:502s fi-skl-gvtdvm total:278 pass:265 dwarn:0 dfail:0 fail:0 skip:13 time:440s fi-snb-2520m total:278 pass:250 dwarn:0 dfail:0 fail:0 skip:28 time:538s fi-snb-2600 total:278 pass:249 dwarn:0 dfail:0 fail:0 skip:29 time:410s
d95291370df5d49f10f8027377b3b349d69388f0 drm-tip: 2017y-05m-19d-11h-10m-37s UTC integration manifest 2588add drm/i915/guc: Submit GuC workitems containing coalesced requests
23649e4 drm/i915: Remove misleading comment in request_alloc
== Logs ==
For more details see: https://intel-gfx-ci.01.org/CI/Patchwork_4755/
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx