Commit 27745e82 authored by Chris Wilson's avatar Chris Wilson

drm/i915/execlists: Use a local lock for dfs_link access

Avoid requiring struct_mutex for exclusive access to the temporary
dfs_link inside the i915_dependency as not all callers may want to touch
struct_mutex. So rather than force them to take a highly contended
lock, introduce a local lock for the execlists schedule operation.
Reported-by: default avatarDavid Weinehall <david.weinehall@linux.intel.com>
Fixes: 9a151987 ("drm/i915: Add execution priority boosting for mmioflips")
Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Cc: David Weinehall <david.weinehall@linux.intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20161116152721.11053-1-chris@chris-wilson.co.ukReviewed-by: default avatarTvrtko Ursulin <tvrtko.ursulin@intel.com>
parent 85ee17eb
...@@ -694,6 +694,7 @@ pt_lock_engine(struct i915_priotree *pt, struct intel_engine_cs *locked) ...@@ -694,6 +694,7 @@ pt_lock_engine(struct i915_priotree *pt, struct intel_engine_cs *locked)
static void execlists_schedule(struct drm_i915_gem_request *request, int prio) static void execlists_schedule(struct drm_i915_gem_request *request, int prio)
{ {
static DEFINE_MUTEX(lock);
struct intel_engine_cs *engine = NULL; struct intel_engine_cs *engine = NULL;
struct i915_dependency *dep, *p; struct i915_dependency *dep, *p;
struct i915_dependency stack; struct i915_dependency stack;
...@@ -702,8 +703,8 @@ static void execlists_schedule(struct drm_i915_gem_request *request, int prio) ...@@ -702,8 +703,8 @@ static void execlists_schedule(struct drm_i915_gem_request *request, int prio)
if (prio <= READ_ONCE(request->priotree.priority)) if (prio <= READ_ONCE(request->priotree.priority))
return; return;
/* Need BKL in order to use the temporary link inside i915_dependency */ /* Need global lock to use the temporary link inside i915_dependency */
lockdep_assert_held(&request->i915->drm.struct_mutex); mutex_lock(&lock);
stack.signaler = &request->priotree; stack.signaler = &request->priotree;
list_add(&stack.dfs_link, &dfs); list_add(&stack.dfs_link, &dfs);
...@@ -770,6 +771,8 @@ static void execlists_schedule(struct drm_i915_gem_request *request, int prio) ...@@ -770,6 +771,8 @@ static void execlists_schedule(struct drm_i915_gem_request *request, int prio)
if (engine) if (engine)
spin_unlock_irq(&engine->timeline->lock); spin_unlock_irq(&engine->timeline->lock);
mutex_unlock(&lock);
/* XXX Do we need to preempt to make room for us and our deps? */ /* XXX Do we need to preempt to make room for us and our deps? */
} }
......
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