diff mbox

drm/i915: Get runtime pm ref on i915_drop_caches_set

Message ID 1450179356-22702-1-git-send-email-mika.kuoppala@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Mika Kuoppala Dec. 15, 2015, 11:35 a.m. UTC
Some igt tests wants to drop caches by writing to this debugfs
entry. The call to shrinker may ensure and it wants to update
the fence registers, so hardware access happens. This access
can happen in a spot where the block containing these registers
might bepowered down.

To avoid getting unclaimed register access trace noise due
to this, take a runtime pm reference during i915_drop_caches set.

v2: pm_ref and mutex lock ordering (Chris)

Cc: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Signed-off-by: Mika Kuoppala <mika.kuoppala@intel.com>
---
 drivers/gpu/drm/i915/i915_debugfs.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

Comments

Joonas Lahtinen Dec. 15, 2015, 11:46 a.m. UTC | #1
On ti, 2015-12-15 at 13:35 +0200, Mika Kuoppala wrote:
> Some igt tests wants to drop caches by writing to this debugfs
> entry. The call to shrinker may ensure and it wants to update
> the fence registers, so hardware access happens. This access
> can happen in a spot where the block containing these registers
> might bepowered down.
> 
> To avoid getting unclaimed register access trace noise due
> to this, take a runtime pm reference during i915_drop_caches set.
> 
> v2: pm_ref and mutex lock ordering (Chris)
> 
> Cc: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>

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

> Signed-off-by: Mika Kuoppala <mika.kuoppala@intel.com>
> ---
>  drivers/gpu/drm/i915/i915_debugfs.c | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/i915_debugfs.c
> b/drivers/gpu/drm/i915/i915_debugfs.c
> index 24318b7..d96709a 100644
> --- a/drivers/gpu/drm/i915/i915_debugfs.c
> +++ b/drivers/gpu/drm/i915/i915_debugfs.c
> @@ -4833,11 +4833,13 @@ i915_drop_caches_set(void *data, u64 val)
>  
>  	DRM_DEBUG("Dropping caches: 0x%08llx\n", val);
>  
> +	intel_runtime_pm_get(dev_priv);
> +
>  	/* No need to check and wait for gpu resets, only libdrm
> auto-restarts
>  	 * on ioctls on -EAGAIN. */
>  	ret = mutex_lock_interruptible(&dev->struct_mutex);
>  	if (ret)
> -		return ret;
> +		goto pm_put;
>  
>  	if (val & DROP_ACTIVE) {
>  		ret = i915_gpu_idle(dev);
> @@ -4856,7 +4858,9 @@ i915_drop_caches_set(void *data, u64 val)
>  
>  unlock:
>  	mutex_unlock(&dev->struct_mutex);
> -
> +pm_put:
> +	intel_runtime_pm_put(dev_priv);
> +	
>  	return ret;
>  }
>
diff mbox

Patch

diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c
index 24318b7..d96709a 100644
--- a/drivers/gpu/drm/i915/i915_debugfs.c
+++ b/drivers/gpu/drm/i915/i915_debugfs.c
@@ -4833,11 +4833,13 @@  i915_drop_caches_set(void *data, u64 val)
 
 	DRM_DEBUG("Dropping caches: 0x%08llx\n", val);
 
+	intel_runtime_pm_get(dev_priv);
+
 	/* No need to check and wait for gpu resets, only libdrm auto-restarts
 	 * on ioctls on -EAGAIN. */
 	ret = mutex_lock_interruptible(&dev->struct_mutex);
 	if (ret)
-		return ret;
+		goto pm_put;
 
 	if (val & DROP_ACTIVE) {
 		ret = i915_gpu_idle(dev);
@@ -4856,7 +4858,9 @@  i915_drop_caches_set(void *data, u64 val)
 
 unlock:
 	mutex_unlock(&dev->struct_mutex);
-
+pm_put:
+	intel_runtime_pm_put(dev_priv);
+	
 	return ret;
 }