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

drm/i915: Stop needlessly acquiring wakeref for debugfs/drop_caches_set

We only need to acquire a wakeref for ourselves for a few operations, as
most either already acquire their own wakeref or imply a wakeref. In
particular, it is i915_gem_set_wedged() that needed us to present it
with a wakeref, which is incongruous with its "use anywhere" ability.
Suggested-by: default avatar"Yokoyama, Caz" <caz.yokoyama@intel.com>
Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
Cc: "Yokoyama, Caz" <caz.yokoyama@intel.com>
Cc: Mika Kuoppala <mika.kuoppala@linux.intel.com>
Reviewed-by: default avatarTvrtko Ursulin <tvrtko.ursulin@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20190318095204.9913-7-chris@chris-wilson.co.uk
parent 794a11cb
...@@ -3888,12 +3888,9 @@ static int ...@@ -3888,12 +3888,9 @@ static int
i915_drop_caches_set(void *data, u64 val) i915_drop_caches_set(void *data, u64 val)
{ {
struct drm_i915_private *i915 = data; struct drm_i915_private *i915 = data;
intel_wakeref_t wakeref;
int ret = 0;
DRM_DEBUG("Dropping caches: 0x%08llx [0x%08llx]\n", DRM_DEBUG("Dropping caches: 0x%08llx [0x%08llx]\n",
val, val & DROP_ALL); val, val & DROP_ALL);
wakeref = intel_runtime_pm_get(i915);
if (val & DROP_RESET_ACTIVE && if (val & DROP_RESET_ACTIVE &&
wait_for(intel_engines_are_idle(i915), I915_IDLE_ENGINES_TIMEOUT)) wait_for(intel_engines_are_idle(i915), I915_IDLE_ENGINES_TIMEOUT))
...@@ -3902,9 +3899,11 @@ i915_drop_caches_set(void *data, u64 val) ...@@ -3902,9 +3899,11 @@ i915_drop_caches_set(void *data, u64 val)
/* No need to check and wait for gpu resets, only libdrm auto-restarts /* No need to check and wait for gpu resets, only libdrm auto-restarts
* on ioctls on -EAGAIN. */ * on ioctls on -EAGAIN. */
if (val & (DROP_ACTIVE | DROP_RETIRE | DROP_RESET_SEQNO)) { if (val & (DROP_ACTIVE | DROP_RETIRE | DROP_RESET_SEQNO)) {
int ret;
ret = mutex_lock_interruptible(&i915->drm.struct_mutex); ret = mutex_lock_interruptible(&i915->drm.struct_mutex);
if (ret) if (ret)
goto out; return ret;
if (val & DROP_ACTIVE) if (val & DROP_ACTIVE)
ret = i915_gem_wait_for_idle(i915, ret = i915_gem_wait_for_idle(i915,
...@@ -3943,10 +3942,7 @@ i915_drop_caches_set(void *data, u64 val) ...@@ -3943,10 +3942,7 @@ i915_drop_caches_set(void *data, u64 val)
if (val & DROP_FREED) if (val & DROP_FREED)
i915_gem_drain_freed_objects(i915); i915_gem_drain_freed_objects(i915);
out: return 0;
intel_runtime_pm_put(i915, wakeref);
return ret;
} }
DEFINE_SIMPLE_ATTRIBUTE(i915_drop_caches_fops, DEFINE_SIMPLE_ATTRIBUTE(i915_drop_caches_fops,
......
...@@ -863,9 +863,11 @@ static void __i915_gem_set_wedged(struct drm_i915_private *i915) ...@@ -863,9 +863,11 @@ static void __i915_gem_set_wedged(struct drm_i915_private *i915)
void i915_gem_set_wedged(struct drm_i915_private *i915) void i915_gem_set_wedged(struct drm_i915_private *i915)
{ {
struct i915_gpu_error *error = &i915->gpu_error; struct i915_gpu_error *error = &i915->gpu_error;
intel_wakeref_t wakeref;
mutex_lock(&error->wedge_mutex); mutex_lock(&error->wedge_mutex);
__i915_gem_set_wedged(i915); with_intel_runtime_pm(i915, wakeref)
__i915_gem_set_wedged(i915);
mutex_unlock(&error->wedge_mutex); mutex_unlock(&error->wedge_mutex);
} }
......
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