diff mbox

[2/2] drm/i915/execlists: Cache the priolist when rescheduling

Message ID 20180508003046.2633-2-chris@chris-wilson.co.uk (mailing list archive)
State New, archived
Headers show

Commit Message

Chris Wilson May 8, 2018, 12:30 a.m. UTC
When rescheduling a change of dependencies, they all need to be added to
the same priolist (at least the ones on the same engine!). Since we
likely want to move a batch of requests, keep the priolist around.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
---
 drivers/gpu/drm/i915/intel_lrc.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

Comments

Joonas Lahtinen May 8, 2018, 8:18 a.m. UTC | #1
Quoting Chris Wilson (2018-05-08 03:30:46)
> When rescheduling a change of dependencies, they all need to be added to
> the same priolist (at least the ones on the same engine!). Since we
> likely want to move a batch of requests, keep the priolist around.
> 
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>

Comment below.

Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>

> ---
>  drivers/gpu/drm/i915/intel_lrc.c | 11 ++++++++---
>  1 file changed, 8 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_lrc.c b/drivers/gpu/drm/i915/intel_lrc.c
> index a9d211f28ab8..28a02d3b53a4 100644
> --- a/drivers/gpu/drm/i915/intel_lrc.c
> +++ b/drivers/gpu/drm/i915/intel_lrc.c
> @@ -1197,7 +1197,8 @@ sched_lock_engine(struct i915_sched_node *node, struct intel_engine_cs *locked)
>  static void execlists_schedule(struct i915_request *request,
>                                const struct i915_sched_attr *attr)
>  {
> -       struct intel_engine_cs *engine;
> +       struct i915_priolist *uninitialized_var(pl);
> +       struct intel_engine_cs *engine, *last;
>         struct i915_dependency *dep, *p;
>         struct i915_dependency stack;
>         const int prio = attr->priority;
> @@ -1270,6 +1271,7 @@ static void execlists_schedule(struct i915_request *request,
>                 __list_del_entry(&stack.dfs_link);
>         }
>  
> +       last = NULL;
>         engine = request->engine;
>         spin_lock_irq(&engine->timeline.lock);
>  
> @@ -1286,8 +1288,11 @@ static void execlists_schedule(struct i915_request *request,
>  
>                 node->attr.priority = prio;
>                 if (!list_empty(&node->link)) {
> -                       __list_del_entry(&node->link);
> -                       queue_request(engine, node, prio);
> +                       if (last != engine) {
> +                               pl = lookup_priolist(engine, prio);
> +                               last = engine;
> +                       }

As you suggested, GEM_BUG_ON(pl->prio != prio) might make sense.

Regards, Joonas

> +                       list_move_tail(&node->link, &pl->requests);
>                 }
>  
>                 if (prio > engine->execlists.queue_priority &&
> -- 
> 2.17.0
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Chris Wilson May 8, 2018, 11:47 a.m. UTC | #2
Quoting Joonas Lahtinen (2018-05-08 09:18:03)
> Quoting Chris Wilson (2018-05-08 03:30:46)
> > When rescheduling a change of dependencies, they all need to be added to
> > the same priolist (at least the ones on the same engine!). Since we
> > likely want to move a batch of requests, keep the priolist around.
> > 
> > Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> 
> Comment below.
> 
> Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>

Applied the suggested assertions and pushed. Thanks for the review,
-Chris
diff mbox

Patch

diff --git a/drivers/gpu/drm/i915/intel_lrc.c b/drivers/gpu/drm/i915/intel_lrc.c
index a9d211f28ab8..28a02d3b53a4 100644
--- a/drivers/gpu/drm/i915/intel_lrc.c
+++ b/drivers/gpu/drm/i915/intel_lrc.c
@@ -1197,7 +1197,8 @@  sched_lock_engine(struct i915_sched_node *node, struct intel_engine_cs *locked)
 static void execlists_schedule(struct i915_request *request,
 			       const struct i915_sched_attr *attr)
 {
-	struct intel_engine_cs *engine;
+	struct i915_priolist *uninitialized_var(pl);
+	struct intel_engine_cs *engine, *last;
 	struct i915_dependency *dep, *p;
 	struct i915_dependency stack;
 	const int prio = attr->priority;
@@ -1270,6 +1271,7 @@  static void execlists_schedule(struct i915_request *request,
 		__list_del_entry(&stack.dfs_link);
 	}
 
+	last = NULL;
 	engine = request->engine;
 	spin_lock_irq(&engine->timeline.lock);
 
@@ -1286,8 +1288,11 @@  static void execlists_schedule(struct i915_request *request,
 
 		node->attr.priority = prio;
 		if (!list_empty(&node->link)) {
-			__list_del_entry(&node->link);
-			queue_request(engine, node, prio);
+			if (last != engine) {
+				pl = lookup_priolist(engine, prio);
+				last = engine;
+			}
+			list_move_tail(&node->link, &pl->requests);
 		}
 
 		if (prio > engine->execlists.queue_priority &&