drm/i915: Drop mutex around clearing error state

Submitted by Chris Wilson on Sept. 1, 2016, 8:55 p.m.

Details

Message ID 20160901205510.31307-1-chris@chris-wilson.co.uk
State Accepted
Commit 662d19e78b2c0a955879f487755e6a70a5e0226a
Headers show
Series "drm/i915: Drop mutex around clearing error state" ( rev: 1 ) in Intel GFX

Not browsing as part of any series.

Commit Message

Chris Wilson Sept. 1, 2016, 8:55 p.m.
The error state itself is guarded by a spinlock (admittedly even that is
overkill for a single pointer!) and doesn't require us to take the
struct_mutex in the debugfs/sysfs interface. Removing the struct_mutex
removes one more potential blockage when trying to debug a deadlock.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
---
 drivers/gpu/drm/i915/i915_debugfs.c | 10 +---------
 drivers/gpu/drm/i915/i915_sysfs.c   | 10 +---------
 2 files changed, 2 insertions(+), 18 deletions(-)

Patch hide | download patch | download mbox

diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c
index 7124e5666629..e238627c68b6 100644
--- a/drivers/gpu/drm/i915/i915_debugfs.c
+++ b/drivers/gpu/drm/i915/i915_debugfs.c
@@ -978,17 +978,9 @@  i915_error_state_write(struct file *filp,
 		       loff_t *ppos)
 {
 	struct i915_error_state_file_priv *error_priv = filp->private_data;
-	struct drm_device *dev = error_priv->dev;
-	int ret;
 
 	DRM_DEBUG_DRIVER("Resetting error state\n");
-
-	ret = mutex_lock_interruptible(&dev->struct_mutex);
-	if (ret)
-		return ret;
-
-	i915_destroy_error_state(dev);
-	mutex_unlock(&dev->struct_mutex);
+	i915_destroy_error_state(error_priv->dev);
 
 	return cnt;
 }
diff --git a/drivers/gpu/drm/i915/i915_sysfs.c b/drivers/gpu/drm/i915/i915_sysfs.c
index 2d482f677f56..1012eeea1324 100644
--- a/drivers/gpu/drm/i915/i915_sysfs.c
+++ b/drivers/gpu/drm/i915/i915_sysfs.c
@@ -556,17 +556,9 @@  static ssize_t error_state_write(struct file *file, struct kobject *kobj,
 {
 	struct device *kdev = kobj_to_dev(kobj);
 	struct drm_i915_private *dev_priv = kdev_minor_to_i915(kdev);
-	struct drm_device *dev = &dev_priv->drm;
-	int ret;
 
 	DRM_DEBUG_DRIVER("Resetting error state\n");
-
-	ret = mutex_lock_interruptible(&dev->struct_mutex);
-	if (ret)
-		return ret;
-
-	i915_destroy_error_state(dev);
-	mutex_unlock(&dev->struct_mutex);
+	i915_destroy_error_state(&dev_priv->drm);
 
 	return count;
 }

Comments

On Thu, Sep 01, 2016 at 09:55:10PM +0100, Chris Wilson wrote:
> The error state itself is guarded by a spinlock (admittedly even that is
> overkill for a single pointer!) and doesn't require us to take the
> struct_mutex in the debugfs/sysfs interface. Removing the struct_mutex
> removes one more potential blockage when trying to debug a deadlock.
> 
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>

Lots of lines disappearing. Yay!

Reviewed-by: David Weinehall <david.weinehall@linux.intel.com>

> ---
>  drivers/gpu/drm/i915/i915_debugfs.c | 10 +---------
>  drivers/gpu/drm/i915/i915_sysfs.c   | 10 +---------
>  2 files changed, 2 insertions(+), 18 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c
> index 7124e5666629..e238627c68b6 100644
> --- a/drivers/gpu/drm/i915/i915_debugfs.c
> +++ b/drivers/gpu/drm/i915/i915_debugfs.c
> @@ -978,17 +978,9 @@ i915_error_state_write(struct file *filp,
>  		       loff_t *ppos)
>  {
>  	struct i915_error_state_file_priv *error_priv = filp->private_data;
> -	struct drm_device *dev = error_priv->dev;
> -	int ret;
>  
>  	DRM_DEBUG_DRIVER("Resetting error state\n");
> -
> -	ret = mutex_lock_interruptible(&dev->struct_mutex);
> -	if (ret)
> -		return ret;
> -
> -	i915_destroy_error_state(dev);
> -	mutex_unlock(&dev->struct_mutex);
> +	i915_destroy_error_state(error_priv->dev);
>  
>  	return cnt;
>  }
> diff --git a/drivers/gpu/drm/i915/i915_sysfs.c b/drivers/gpu/drm/i915/i915_sysfs.c
> index 2d482f677f56..1012eeea1324 100644
> --- a/drivers/gpu/drm/i915/i915_sysfs.c
> +++ b/drivers/gpu/drm/i915/i915_sysfs.c
> @@ -556,17 +556,9 @@ static ssize_t error_state_write(struct file *file, struct kobject *kobj,
>  {
>  	struct device *kdev = kobj_to_dev(kobj);
>  	struct drm_i915_private *dev_priv = kdev_minor_to_i915(kdev);
> -	struct drm_device *dev = &dev_priv->drm;
> -	int ret;
>  
>  	DRM_DEBUG_DRIVER("Resetting error state\n");
> -
> -	ret = mutex_lock_interruptible(&dev->struct_mutex);
> -	if (ret)
> -		return ret;
> -
> -	i915_destroy_error_state(dev);
> -	mutex_unlock(&dev->struct_mutex);
> +	i915_destroy_error_state(&dev_priv->drm);
>  
>  	return count;
>  }
> -- 
> 2.9.3
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx