Commit 6b6cd2eb authored by Chris Wilson's avatar Chris Wilson

drm/i915: Mark concurrent submissions with a weak-dependency

We recorded the dependencies for WAIT_FOR_SUBMIT in order that we could
correctly perform priority inheritance from the parallel branches to the
common trunk. However, for the purpose of timeslicing and reset
handling, the dependency is weak -- as we the pair of requests are
allowed to run in parallel and not in strict succession.

The real significance though is that this allows us to rearrange
groups of WAIT_FOR_SUBMIT linked requests along the single engine, and
so can resolve user level inter-batch scheduling dependencies from user
semaphores.

Fixes: c81471f5 ("drm/i915: Copy across scheduler behaviour flags across submit fences")
Testcase: igt/gem_exec_fence/submit
Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Cc: <stable@vger.kernel.org> # v5.6+
Reviewed-by: default avatarTvrtko Ursulin <tvrtko.ursulin@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200507155109.8892-1-chris@chris-wilson.co.uk
parent d248b371
...@@ -1880,6 +1880,9 @@ static void defer_request(struct i915_request *rq, struct list_head * const pl) ...@@ -1880,6 +1880,9 @@ static void defer_request(struct i915_request *rq, struct list_head * const pl)
struct i915_request *w = struct i915_request *w =
container_of(p->waiter, typeof(*w), sched); container_of(p->waiter, typeof(*w), sched);
if (p->flags & I915_DEPENDENCY_WEAK)
continue;
/* Leave semaphores spinning on the other engines */ /* Leave semaphores spinning on the other engines */
if (w->engine != rq->engine) if (w->engine != rq->engine)
continue; continue;
......
...@@ -1040,7 +1040,9 @@ i915_request_await_request(struct i915_request *to, struct i915_request *from) ...@@ -1040,7 +1040,9 @@ i915_request_await_request(struct i915_request *to, struct i915_request *from)
} }
if (to->engine->schedule) { if (to->engine->schedule) {
ret = i915_sched_node_add_dependency(&to->sched, &from->sched); ret = i915_sched_node_add_dependency(&to->sched,
&from->sched,
I915_DEPENDENCY_EXTERNAL);
if (ret < 0) if (ret < 0)
return ret; return ret;
} }
...@@ -1202,7 +1204,9 @@ __i915_request_await_execution(struct i915_request *to, ...@@ -1202,7 +1204,9 @@ __i915_request_await_execution(struct i915_request *to,
/* Couple the dependency tree for PI on this exposed to->fence */ /* Couple the dependency tree for PI on this exposed to->fence */
if (to->engine->schedule) { if (to->engine->schedule) {
err = i915_sched_node_add_dependency(&to->sched, &from->sched); err = i915_sched_node_add_dependency(&to->sched,
&from->sched,
I915_DEPENDENCY_WEAK);
if (err < 0) if (err < 0)
return err; return err;
} }
......
...@@ -462,7 +462,8 @@ bool __i915_sched_node_add_dependency(struct i915_sched_node *node, ...@@ -462,7 +462,8 @@ bool __i915_sched_node_add_dependency(struct i915_sched_node *node,
} }
int i915_sched_node_add_dependency(struct i915_sched_node *node, int i915_sched_node_add_dependency(struct i915_sched_node *node,
struct i915_sched_node *signal) struct i915_sched_node *signal,
unsigned long flags)
{ {
struct i915_dependency *dep; struct i915_dependency *dep;
...@@ -473,8 +474,7 @@ int i915_sched_node_add_dependency(struct i915_sched_node *node, ...@@ -473,8 +474,7 @@ int i915_sched_node_add_dependency(struct i915_sched_node *node,
local_bh_disable(); local_bh_disable();
if (!__i915_sched_node_add_dependency(node, signal, dep, if (!__i915_sched_node_add_dependency(node, signal, dep,
I915_DEPENDENCY_EXTERNAL | flags | I915_DEPENDENCY_ALLOC))
I915_DEPENDENCY_ALLOC))
i915_dependency_free(dep); i915_dependency_free(dep);
local_bh_enable(); /* kick submission tasklet */ local_bh_enable(); /* kick submission tasklet */
......
...@@ -34,7 +34,8 @@ bool __i915_sched_node_add_dependency(struct i915_sched_node *node, ...@@ -34,7 +34,8 @@ bool __i915_sched_node_add_dependency(struct i915_sched_node *node,
unsigned long flags); unsigned long flags);
int i915_sched_node_add_dependency(struct i915_sched_node *node, int i915_sched_node_add_dependency(struct i915_sched_node *node,
struct i915_sched_node *signal); struct i915_sched_node *signal,
unsigned long flags);
void i915_sched_node_fini(struct i915_sched_node *node); void i915_sched_node_fini(struct i915_sched_node *node);
......
...@@ -78,6 +78,7 @@ struct i915_dependency { ...@@ -78,6 +78,7 @@ struct i915_dependency {
unsigned long flags; unsigned long flags;
#define I915_DEPENDENCY_ALLOC BIT(0) #define I915_DEPENDENCY_ALLOC BIT(0)
#define I915_DEPENDENCY_EXTERNAL BIT(1) #define I915_DEPENDENCY_EXTERNAL BIT(1)
#define I915_DEPENDENCY_WEAK BIT(2)
}; };
#endif /* _I915_SCHEDULER_TYPES_H_ */ #endif /* _I915_SCHEDULER_TYPES_H_ */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment