drm/i915: Introduce execlist_port_* accessors
Subsystems (2)
PATCH 1/3 drm/i915: Introduce execlist_port_* accessors
Instead of trusting that first available port is at index 0, use accessor to hide this. This is a preparation for a following patches where head can be at arbitrary location in the port array.
v2: improved commit message, elsp_ready readability (Chris)
v3: s/execlist_port_index/execlist_port (Chris)
v4: rebase to new naming
--- drivers/gpu/drm/i915/i915_debugfs.c | 16 ++++++---- drivers/gpu/drm/i915/i915_gpu_error.c | 6 ++-- drivers/gpu/drm/i915/i915_guc_submission.c | 17 +++++------ drivers/gpu/drm/i915/i915_irq.c | 2 +- drivers/gpu/drm/i915/intel_engine_cs.c | 2 +- drivers/gpu/drm/i915/intel_lrc.c | 47 ++++++++++++++++------------- drivers/gpu/drm/i915/intel_ringbuffer.h | 48 ++++++++++++++++++++++++++---- 7 files changed, 92 insertions(+), 46 deletions(-)
drivers/gpu/drm/i915/i915_debugfs.c +10 -6
@@ -3348,16 +3348,20 @@ static int i915_engine_info(struct seq_file *m, void *unused)rcu_read_lock ();for (idx =0 ; idx <execlists_num_ports (execlists); idx++) { -unsigned int count; +const struct execlist_port *port; +unsigned int count, n; - rq =port_unpack (&execlists->port[idx], &count); + port =execlists_port (execlists, idx); + n =port_index (port, execlists); + + rq =port_unpack (port, &count);if (rq) { -seq_printf (m,"\t\tELSP[%d] count=%d, " , - idx, count); +seq_printf (m,"\t\tELSP[%d:%d] count=%d, " , + idx, n, count);print_request (m, rq,"rq: " ); }else { -seq_printf (m,"\t\tELSP[%d] idle\n" , - idx); +seq_printf (m,"\t\tELSP[%d:%d] idle\n" , + idx, n); } }rcu_read_unlock ();
drivers/gpu/drm/i915/i915_gpu_error.c +4 -2
@@ -1332,11 +1332,13 @@ static void engine_record_requests(struct intel_engine_cs *engine,static void error_record_engine_execlists (struct intel_engine_cs *engine,struct drm_i915_error_engine *ee) { -const struct intel_engine_execlists *const execlists = &engine->execlists; +struct intel_engine_execlists *const execlists = &engine->execlists;unsigned int n;for (n =0 ; n <execlists_num_ports (execlists); n++) { -struct drm_i915_gem_request *rq =port_request (&execlists->port[n]); +struct drm_i915_gem_request *rq; + + rq =port_request (execlists_port (execlists, n));if (!rq)break ;
drivers/gpu/drm/i915/i915_guc_submission.c +8 -9
@@ -562,8 +562,7 @@ static void i915_guc_dequeue(struct intel_engine_cs *engine)struct intel_engine_execlists *const execlists = &engine->execlists;struct execlist_port *port = execlists->port;struct drm_i915_gem_request *last =NULL ; -const struct execlist_port *const last_port = - &execlists->port[execlists->port_mask]; +const struct execlist_port *const last_port =execlists_port_tail (execlists);bool submit = false;struct rb_node *rb;
@@ -587,7 +586,8 @@ static void i915_guc_dequeue(struct intel_engine_cs *engine)if (submit)port_assign (port, last); - port++; + + port =execlists_port_next (execlists, port); }INIT_LIST_HEAD (&rq->priotree.link);
@@ -618,19 +618,18 @@ static void i915_guc_irq_handler(unsigned long data) {struct intel_engine_cs *const engine = (struct intel_engine_cs *)data;struct intel_engine_execlists *const execlists = &engine->execlists; -struct execlist_port *port = execlists->port; -const struct execlist_port *const last_port = - &execlists->port[execlists->port_mask]; +struct execlist_port *port =execlists_port_head (execlists); +const struct execlist_port *const last_port =execlists_port_tail (execlists);struct drm_i915_gem_request *rq; - rq =port_request (&port[0 ]); + rq =port_request (port);while (rq &&i915_gem_request_completed (rq)) {trace_i915_gem_request_out (rq);i915_gem_request_put (rq); -execlists_port_complete (execlists, port); + port =execlists_port_complete (execlists, port); - rq =port_request (&port[0 ]); + rq =port_request (port); }if (!port_isset (last_port))
drivers/gpu/drm/i915/i915_irq.c +1 -1
@@ -1382,7 +1382,7 @@ gen8_cs_irq_handler(struct intel_engine_cs *engine, u32 iir, int test_shift)bool tasklet = false;if (iir & (GT_CONTEXT_SWITCH_INTERRUPT << test_shift)) { -if (port_count (&execlists->port[0 ])) { +if (port_count (execlists_port_head (execlists))) {__set_bit (ENGINE_IRQ_EXECLIST , &engine->irq_posted); tasklet = true; }
drivers/gpu/drm/i915/intel_engine_cs.c +1 -1
@@ -1505,7 +1505,7 @@ bool intel_engine_is_idle(struct intel_engine_cs *engine)return false;/* Both ports drained, no more ELSP submission? */ -if (port_request (&engine->execlists.port[0 ])) +if (port_request (execlists_port_head (&engine->execlists)))return false;/* ELSP is empty, but there are ready requests? */
drivers/gpu/drm/i915/intel_lrc.c +26 -21
142 lines not on this page · raw message
drivers/gpu/drm/i915/intel_ringbuffer.h +42 -6
64 lines not on this page · raw message
Signature · 6 lines
2.11.0 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 2/3 drm/i915: Keep track of reserved execlist ports
To further enchance port processing, keep track of reserved ports. This way we can iterate only the used subset of port space. Note that we lift the responsibility of execlists_submit_request() to inspect hw availability and always do dequeuing. This is to ensure that only the irq handler will be responsible for keeping track of available ports.
v2: rebase, comment fix, READ_ONCE only outside of irq handler (Chris)
v3: rebase to new naming
--- drivers/gpu/drm/i915/i915_guc_submission.c | 52 ++++++++------ drivers/gpu/drm/i915/i915_irq.c | 2 +- drivers/gpu/drm/i915/intel_engine_cs.c | 7 +- drivers/gpu/drm/i915/intel_lrc.c | 112 ++++++++++++++++++----------- drivers/gpu/drm/i915/intel_ringbuffer.h | 45 +++++++++--- 5 files changed, 141 insertions(+), 77 deletions(-)
drivers/gpu/drm/i915/i915_guc_submission.c +29 -23
@@ -487,7 +487,7 @@ static void guc_ring_doorbell(struct i915_guc_client *client)* @engine: engine associated with the commands * * The only error here arises if the doorbell hardware isn't functioning -* as expected, which really shouln't happen. +* as expected, which really shouldn't happen. */ static void i915_guc_submit (struct intel_engine_cs *engine) {
@@ -495,17 +495,19 @@ static void i915_guc_submit(struct intel_engine_cs *engine)struct intel_guc *guc = &dev_priv->guc;struct i915_guc_client *client = guc->execbuf_client;struct intel_engine_execlists *const execlists = &engine->execlists; -struct execlist_port *port = execlists->port;const unsigned int engine_id = engine->id;unsigned int n; -for (n =0 ; n <ARRAY_SIZE (execlists->port); n++) { +for (n =0 ; n <execlists_active_ports (execlists); n++) { +struct execlist_port *port;struct drm_i915_gem_request *rq;unsigned int count; - rq =port_unpack (&port[n], &count); + port =execlists_port (execlists, n); + rq =port_unpack (port, &count); +if (rq && count ==0 ) { -port_set (&port[n],port_pack (rq, ++count)); +port_set (port,port_pack (rq, ++count));if (i915_vma_is_map_and_fenceable (rq->ring->vma))POSTING_READ_FW (GUC_STATUS );
@@ -559,26 +561,29 @@ static void port_assign(struct execlist_port *port,static void i915_guc_dequeue (struct intel_engine_cs *engine) { +struct intel_engine_execlists *const execlists = &engine->execlists; -struct execlist_port *port = execlists->port; +struct execlist_port *port;struct drm_i915_gem_request *last =NULL ; -const struct execlist_port *const last_port =execlists_port_tail (execlists);bool submit = false;struct rb_node *rb; -if (port_isset (port)) - port++; -spin_lock_irq (&engine->timeline->lock); rb = execlists->first;GEM_BUG_ON (rb_first (&execlists->queue) != rb); -while (rb) { + +if (unlikely (!rb)) + goto done; + + port =execlists_request_port (execlists); + + do { struct i915_priolist *p = rb_entry(rb, typeof(*p), node); struct drm_i915_gem_request *rq, *rn; list_for_each_entry_safe(rq, rn, &p->requests, priotree.link) { if (last && rq->ctx != last->ctx) { -if (port == last_port) { + if (!execlists_inactive_ports(execlists)) { __list_del_many(&p->requests, &rq->priotree.link); goto done;
@@ -587,7 +592,8 @@ static void i915_guc_dequeue(struct intel_engine_cs *engine)if (submit)port_assign (port, last); - port =execlists_port_next (execlists, port); + port =execlists_request_port (execlists); +GEM_BUG_ON (port_isset (port)); }INIT_LIST_HEAD (&rq->priotree.link);
@@ -604,7 +610,7 @@ static void i915_guc_dequeue(struct intel_engine_cs *engine)INIT_LIST_HEAD (&p->requests);if (p->priority !=I915_PRIORITY_NORMAL )kmem_cache_free (engine->i915->priorities, p); - } + }while (rb); done: execlists->first = rb;if (submit) {
@@ -618,21 +624,21 @@ static void i915_guc_irq_handler(unsigned long data) {struct intel_engine_cs *const engine = (struct intel_engine_cs *)data;struct intel_engine_execlists *const execlists = &engine->execlists; -struct execlist_port *port =execlists_port_head (execlists); -const struct execlist_port *const last_port =execlists_port_tail (execlists); -struct drm_i915_gem_request *rq; - rq =port_request (port); -while (rq &&i915_gem_request_completed (rq)) { +while (execlists_active_ports (execlists)) { +struct execlist_port *port =execlists_port_head (execlists); +struct drm_i915_gem_request *rq =port_request (port); + +if (!i915_gem_request_completed (rq)) +break ; +trace_i915_gem_request_out (rq);i915_gem_request_put (rq); - port =execlists_port_complete (execlists, port); - - rq =port_request (port); +execlists_release_port (execlists, port); } -if (!port_isset (last_port)) +if (execlists_inactive_ports (execlists))i915_guc_dequeue (engine); }
drivers/gpu/drm/i915/i915_irq.c +1 -1
@@ -1382,7 +1382,7 @@ gen8_cs_irq_handler(struct intel_engine_cs *engine, u32 iir, int test_shift)bool tasklet = false;if (iir & (GT_CONTEXT_SWITCH_INTERRUPT << test_shift)) { -if (port_count (execlists_port_head (execlists))) { +if (READ_ONCE (execlists->port_count)) {__set_bit (ENGINE_IRQ_EXECLIST , &engine->irq_posted); tasklet = true; }
drivers/gpu/drm/i915/intel_engine_cs.c +5 -2
@@ -409,6 +409,9 @@ static void intel_engine_init_execlist(struct intel_engine_cs *engine)BUILD_BUG_ON_NOT_POWER_OF_2 (execlists_num_ports (execlists));GEM_BUG_ON (execlists_num_ports (execlists) >EXECLIST_MAX_PORTS ); + execlists->port_head =0 ; + execlists->port_count =0 ; + execlists->queue =RB_ROOT ; execlists->first =NULL ; }
@@ -1504,8 +1507,8 @@ bool intel_engine_is_idle(struct intel_engine_cs *engine)if (test_bit (ENGINE_IRQ_EXECLIST , &engine->irq_posted))return false; -/* Both ports drained, no more ELSP submission? */ -if (port_request (execlists_port_head (&engine->execlists))) +/* All ports drained, no more ELSP submission? */ +if (execlists_active_ports (&engine->execlists))return false;/* ELSP is empty, but there are ready requests? */
drivers/gpu/drm/i915/intel_lrc.c +70 -42
228 lines not on this page · raw message
drivers/gpu/drm/i915/intel_ringbuffer.h +36 -9
81 lines not on this page · raw message
Signature · 6 lines
2.11.0 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 3/3 drm/i915: Improve GuC request coalescing
In reply to Mika KuoppalaNow that we can keep track of what ports we have dequeued, submit only those ports instead of iterating through all ports.
v2: s/coalesce/submit (Michał)
v3: rebase to new naming
--- drivers/gpu/drm/i915/i915_guc_submission.c | 31 +++++++++++++++++------------- drivers/gpu/drm/i915/intel_ringbuffer.h | 9 +++++++++ 2 files changed, 27 insertions(+), 13 deletions(-)
drivers/gpu/drm/i915/i915_guc_submission.c +18 -13
@@ -485,11 +485,13 @@ static void guc_ring_doorbell(struct i915_guc_client *client)/** * i915_guc_submit() - Submit commands through GuC * @engine: engine associated with the commands +* @first: index of first execlist port to start coalescing from * * The only error here arises if the doorbell hardware isn't functioning * as expected, which really shouldn't happen. */ -static void i915_guc_submit (struct intel_engine_cs *engine) +static void i915_guc_submit (struct intel_engine_cs *engine, +const unsigned int first) {struct drm_i915_private *dev_priv = engine->i915;struct intel_guc *guc = &dev_priv->guc;
@@ -498,7 +500,7 @@ static void i915_guc_submit(struct intel_engine_cs *engine)const unsigned int engine_id = engine->id;unsigned int n; -for (n =0 ; n <execlists_active_ports (execlists); n++) { +for (n = first; n <execlists_active_ports (execlists); n++) {struct execlist_port *port;struct drm_i915_gem_request *rq;unsigned int count;
@@ -506,21 +508,22 @@ static void i915_guc_submit(struct intel_engine_cs *engine) port =execlists_port (execlists, n); rq =port_unpack (port, &count); -if (rq && count ==0 ) { -port_set (port,port_pack (rq, ++count)); +GEM_BUG_ON (!rq); +GEM_BUG_ON (count); -if (i915_vma_is_map_and_fenceable (rq->ring->vma)) -POSTING_READ_FW (GUC_STATUS ); +port_set (port,port_pack (rq, ++count)); -spin_lock (&client->wq_lock); +if (i915_vma_is_map_and_fenceable (rq->ring->vma)) +POSTING_READ_FW (GUC_STATUS ); -guc_wq_item_append (client, rq); -guc_ring_doorbell (client); +spin_lock (&client->wq_lock); - client->submissions[engine_id] +=1 ; +guc_wq_item_append (client, rq); +guc_ring_doorbell (client); -spin_unlock (&client->wq_lock); - } + client->submissions[engine_id] +=1 ; + +spin_unlock (&client->wq_lock); } }
@@ -567,6 +570,7 @@ static void i915_guc_dequeue(struct intel_engine_cs *engine)struct drm_i915_gem_request *last =NULL ;bool submit = false;struct rb_node *rb; +unsigned int first_idx;spin_lock_irq (&engine->timeline->lock); rb = execlists->first;
@@ -576,6 +580,7 @@ static void i915_guc_dequeue(struct intel_engine_cs *engine) goto done; port =execlists_request_port (execlists); + first_idx =execlists_port_index (execlists, port); do { struct i915_priolist *p = rb_entry(rb, typeof(*p), node);
@@ -615,7 +620,7 @@ static void i915_guc_dequeue(struct intel_engine_cs *engine) execlists->first = rb;if (submit) {port_assign (port, last); -i915_guc_submit (engine); +i915_guc_submit (engine, first_idx); }spin_unlock_irq (&engine->timeline->lock); }
drivers/gpu/drm/i915/intel_ringbuffer.h +9 -0
@@ -557,6 +557,15 @@ execlists_port(struct intel_engine_execlists * const execlists,return &execlists->port[port_n (execlists, n)]; } +static inline unsigned int +execlists_port_index (const struct intel_engine_execlists *const execlists, +const struct execlist_port *const port) +{ +const unsigned int n =port_index (port, execlists); + +return __port_n (n, -execlists->port_head, execlists->port_mask); +} +static inline struct execlist_port *execlists_port_head (struct intel_engine_execlists *const execlists) {
Signature · 6 lines
2.11.0 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Patchwork
CI✓ Fi.CI.BAT: success for series starting with [1/3] drm/i915: Introduce execlist_port_* accessors
In reply to Mika Kuoppala== Series Details ==
== Series Details ==
Series: series starting with [1/3] drm/i915: Introduce execlist_port_* accessors
URL : https://patchwork.freedesktop.org/series/31175/
State : success
== Summary ==
Series 31175v1 series starting with [1/3] drm/i915: Introduce execlist_port_* accessors
https://patchwork.freedesktop.org/api/1.0/series/31175/revisions/1/mbox/
Test chamelium:
Subgroup dp-edid-read:
pass -> FAIL (fi-kbl-7500u) fdo#102672
Subgroup hdmi-crc-fast:
dmesg-warn -> PASS (fi-skl-6700k) fdo#103019
Test kms_busy:
Subgroup basic-flip-c:
incomplete -> PASS (fi-bxt-j4205) fdo#102035
Test drv_module_reload:
Subgroup basic-reload:
pass -> DMESG-WARN (fi-glk-1) fdo#102777 +1fdo#102672 https://bugs.freedesktop.org/show_bug.cgi?id=102672
fdo#103019 https://bugs.freedesktop.org/show_bug.cgi?id=103019
fdo#102035 https://bugs.freedesktop.org/show_bug.cgi?id=102035
fdo#102777 https://bugs.freedesktop.org/show_bug.cgi?id=102777
fi-bdw-5557u total:289 pass:268 dwarn:0 dfail:0 fail:0 skip:21 time:445s fi-bdw-gvtdvm total:289 pass:265 dwarn:0 dfail:0 fail:0 skip:24 time:478s fi-blb-e6850 total:289 pass:224 dwarn:1 dfail:0 fail:0 skip:64 time:426s fi-bsw-n3050 total:289 pass:243 dwarn:0 dfail:0 fail:0 skip:46 time:524s fi-bwr-2160 total:289 pass:184 dwarn:0 dfail:0 fail:0 skip:105 time:277s fi-bxt-dsi total:289 pass:259 dwarn:0 dfail:0 fail:0 skip:30 time:499s fi-bxt-j4205 total:289 pass:260 dwarn:0 dfail:0 fail:0 skip:29 time:506s fi-byt-j1900 total:289 pass:254 dwarn:1 dfail:0 fail:0 skip:34 time:491s fi-byt-n2820 total:289 pass:250 dwarn:1 dfail:0 fail:0 skip:38 time:481s fi-cfl-s total:289 pass:256 dwarn:1 dfail:0 fail:0 skip:32 time:558s fi-cnl-y total:289 pass:261 dwarn:1 dfail:0 fail:0 skip:27 time:639s fi-elk-e7500 total:289 pass:230 dwarn:0 dfail:0 fail:0 skip:59 time:409s fi-glk-1 total:289 pass:259 dwarn:1 dfail:0 fail:0 skip:29 time:572s fi-hsw-4770 total:289 pass:263 dwarn:0 dfail:0 fail:0 skip:26 time:425s fi-hsw-4770r total:289 pass:263 dwarn:0 dfail:0 fail:0 skip:26 time:404s fi-ilk-650 total:289 pass:229 dwarn:0 dfail:0 fail:0 skip:60 time:433s fi-ivb-3520m total:289 pass:261 dwarn:0 dfail:0 fail:0 skip:28 time:499s fi-ivb-3770 total:289 pass:261 dwarn:0 dfail:0 fail:0 skip:28 time:462s fi-kbl-7500u total:289 pass:263 dwarn:1 dfail:0 fail:1 skip:24 time:472s fi-kbl-7560u total:289 pass:270 dwarn:0 dfail:0 fail:0 skip:19 time:578s fi-kbl-r total:289 pass:262 dwarn:0 dfail:0 fail:0 skip:27 time:587s fi-pnv-d510 total:289 pass:223 dwarn:1 dfail:0 fail:0 skip:65 time:544s fi-skl-6260u total:289 pass:269 dwarn:0 dfail:0 fail:0 skip:20 time:451s fi-skl-6700k total:289 pass:265 dwarn:0 dfail:0 fail:0 skip:24 time:750s fi-skl-6770hq total:289 pass:269 dwarn:0 dfail:0 fail:0 skip:20 time:487s fi-skl-gvtdvm total:289 pass:266 dwarn:0 dfail:0 fail:0 skip:23 time:479s fi-snb-2520m total:289 pass:251 dwarn:0 dfail:0 fail:0 skip:38 time:565s fi-snb-2600 total:289 pass:250 dwarn:0 dfail:0 fail:0 skip:39 time:415s
e650b9cdaff616445f38986379b1c0c4b03a4282 drm-tip: 2017y-09m-29d-11h-52m-41s UTC integration manifest 840a60659b63 drm/i915: Improve GuC request coalescing62de32bd90a8 drm/i915: Keep track of reserved execlist ports
685071169972 drm/i915: Introduce execlist_port_* accessors
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_5861/
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Patchwork
CI✓ Fi.CI.IGT: success for series starting with [1/3] drm/i915: Introduce execlist_port_* accessors
In reply to Mika Kuoppala== Series Details ==
== Series Details ==
Series: series starting with [1/3] drm/i915: Introduce execlist_port_* accessors
URL : https://patchwork.freedesktop.org/series/31175/
State : success
== Summary ==
Test perf:
Subgroup polling:
fail -> PASS (shard-hsw) fdo#102252fdo#102252 https://bugs.freedesktop.org/show_bug.cgi?id=102252
shard-hsw total:2429 pass:1333 dwarn:3 dfail:0 fail:10 skip:1083 time:9949s
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_5861/shards.html
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx