drm/i915: Fix struct mutex vs. RPS lock inversion
authorTvrtko Ursulin <tvrtko.ursulin@intel.com>
Thu, 11 Feb 2016 10:27:30 +0000 (10:27 +0000)
committerTvrtko Ursulin <tvrtko.ursulin@intel.com>
Mon, 15 Feb 2016 16:10:19 +0000 (16:10 +0000)
commitee504898777b7d14a6058fc1f1a93d02d974de87
treebeeeaf0a937293074cdea6dfbcbeebdd29def81d
parent12c83d99436b6a4dcd2d2afe7b086509a1391cc5
drm/i915: Fix struct mutex vs. RPS lock inversion

RPS lock must be taken before the struct_mutex to avoid
locking inversion. So stop grabbing it for the whole
powersave initialization and instead only take it during
the sections which need it.

Also, struct_mutex is not needed any more since dedicated
RPS lock was added in:

   commit 4fc688ce79772496503d22263d61b071a8fb596e
   Author: Jesse Barnes <jbarnes@virtuousgeek.org>
   Date:   Fri Nov 2 11:14:01 2012 -0700

       drm/i915: protect RPS/RC6 related accesses (including PCU) with a new mutex

Based on prototype patch by Chris Wilson and a subsequent
mailing list discussion involving Ville, Imre, Chris and
Daniel.

v2: More details in the commit.

v3: Use drm_gem_object_unreference_unlocked. (Chris Wilson)

Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Cc: Imre Deak <imre.deak@intel.com>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
drivers/gpu/drm/i915/intel_display.c
drivers/gpu/drm/i915/intel_pm.c