intel-gfx.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: Ben Widawsky <ben@bwidawsk.net>
To: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Intel Graphics Development <intel-gfx@lists.freedesktop.org>
Subject: Re: [PATCH 2/2] drm/i915: use mutex_lock_interruptible for debugfs files
Date: Thu, 9 Aug 2012 13:18:41 -0700	[thread overview]
Message-ID: <20120809131841.0b116f2e@bwidawsk.net> (raw)
In-Reply-To: <1344517622-21888-2-git-send-email-daniel.vetter@ffwll.ch>

On Thu,  9 Aug 2012 15:07:02 +0200
Daniel Vetter <daniel.vetter@ffwll.ch> wrote:

> It's no fun if your shell hangs when the driver has gone on vacation
> and you want to know why ...
> 
> Signed-Off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
> ---
>  drivers/gpu/drm/i915/i915_debugfs.c |   32 +++++++++++++++++++++++++-------
>  1 file changed, 25 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c
> index 31aa4b8..8acb8e9 100644
> --- a/drivers/gpu/drm/i915/i915_debugfs.c
> +++ b/drivers/gpu/drm/i915/i915_debugfs.c
> @@ -794,10 +794,14 @@ i915_error_state_write(struct file *filp,
>  	struct seq_file *m = filp->private_data;
>  	struct i915_error_state_file_priv *error_priv = m->private;
>  	struct drm_device *dev = error_priv->dev;
> +	int ret;
>  
>  	DRM_DEBUG_DRIVER("Resetting error state\n");
>  
> -	mutex_lock(&dev->struct_mutex);
> +	ret = mutex_lock_interruptible(&dev->struct_mutex);
> +	if (ret)
> +		return ret;
> +
>  	i915_destroy_error_state(dev);
>  	mutex_unlock(&dev->struct_mutex);
>  
> @@ -1467,8 +1471,12 @@ static int i915_swizzle_info(struct seq_file *m, void *data)
>  	struct drm_info_node *node = (struct drm_info_node *) m->private;
>  	struct drm_device *dev = node->minor->dev;
>  	struct drm_i915_private *dev_priv = dev->dev_private;
> +	int ret;
> +
> +	ret = mutex_lock_interruptible(&dev->struct_mutex);
> +	if (ret)
> +		return ret;
>  
> -	mutex_lock(&dev->struct_mutex);
>  	seq_printf(m, "bit6 swizzle for X-tiling = %s\n",
>  		   swizzle_string(dev_priv->mm.bit_6_swizzle_x));
>  	seq_printf(m, "bit6 swizzle for Y-tiling = %s\n",
> @@ -1669,7 +1677,7 @@ i915_ring_stop_write(struct file *filp,
>  	struct drm_device *dev = filp->private_data;
>  	struct drm_i915_private *dev_priv = dev->dev_private;
>  	char buf[20];
> -	int val = 0;
> +	int val = 0, ret;
>  
>  	if (cnt > 0) {
>  		if (cnt > sizeof(buf) - 1)
> @@ -1684,7 +1692,10 @@ i915_ring_stop_write(struct file *filp,
>  
>  	DRM_DEBUG_DRIVER("Stopping rings 0x%08x\n", val);
>  
> -	mutex_lock(&dev->struct_mutex);
> +	ret = mutex_lock_interruptible(&dev->struct_mutex);
> +	if (ret)
> +		return ret;
> +
>  	dev_priv->stop_rings = val;
>  	mutex_unlock(&dev->struct_mutex);
>  
> @@ -1861,12 +1872,15 @@ i915_cache_sharing_read(struct file *filp,
>  	drm_i915_private_t *dev_priv = dev->dev_private;
>  	char buf[80];
>  	u32 snpcr;
> -	int len;
> +	int len, ret;
>  
>  	if (!(IS_GEN6(dev) || IS_GEN7(dev)))
>  		return -ENODEV;
>  
> -	mutex_lock(&dev_priv->dev->struct_mutex);
> +	ret = mutex_lock_interruptible(&dev->struct_mutex);
> +	if (ret)
> +		return ret;
> +
>  	snpcr = I915_READ(GEN6_MBCUNIT_SNPCR);
>  	mutex_unlock(&dev_priv->dev->struct_mutex);
>  
> @@ -1976,6 +1990,7 @@ static int i915_forcewake_release(struct inode *inode, struct file *file)
>  {
>  	struct drm_device *dev = inode->i_private;
>  	struct drm_i915_private *dev_priv = dev->dev_private;
> +	int ret;
>  
>  	if (INTEL_INFO(dev)->gen < 6)
>  		return 0;
> @@ -1987,7 +2002,10 @@ static int i915_forcewake_release(struct inode *inode, struct file *file)
>  	 * hanging here is probably a minor inconvenience not to be seen my
>  	 * almost every user.
>  	 */
> -	mutex_lock(&dev->struct_mutex);
> +	ret = mutex_lock_interruptible(&dev->struct_mutex);
> +	if (ret)
> +		return ret;
> +
>  	gen6_gt_force_wake_put(dev_priv);
>  	mutex_unlock(&dev->struct_mutex);
>  


If you feel like changing this intentionally non interruptible lock, you
should kill the comment about it too.



-- 
Ben Widawsky, Intel Open Source Technology Center

  reply	other threads:[~2012-08-09 20:18 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-08 21:35 [PATCH 0/8] rps locking fixes v2 Daniel Vetter
2012-08-08 21:35 ` [PATCH 1/8] drm/i915: properly guard ilk ips state Daniel Vetter
2012-08-09 14:44   ` [PATCH] " Daniel Vetter
2012-08-08 21:35 ` [PATCH 2/8] drm/i915: fixup up debugfs rps state handling Daniel Vetter
2012-08-09  9:32   ` Chris Wilson
2012-08-09 13:07     ` [PATCH 1/2] " Daniel Vetter
2012-08-09 13:07       ` [PATCH 2/2] drm/i915: use mutex_lock_interruptible for debugfs files Daniel Vetter
2012-08-09 20:18         ` Ben Widawsky [this message]
2012-08-08 21:35 ` [PATCH 3/8] drm/i915: move all rps state into dev_priv->rps Daniel Vetter
2012-08-08 21:35 ` [PATCH 4/8] drm/i915: kill dev_priv->mchdev_lock Daniel Vetter
2012-08-08 21:35 ` [PATCH 5/8] drm/i915: DE_PCU_EVENT irq is ilk-only Daniel Vetter
2012-08-08 21:35 ` [PATCH 6/8] drm/i915: fix up ilk drps/ips locking Daniel Vetter
2012-08-09 14:46   ` [PATCH] " Daniel Vetter
2012-08-08 21:35 ` [PATCH 7/8] drm/ips: move drps/ips/ilk related variables into dev_priv->ips Daniel Vetter
2012-08-28 16:14   ` Daniel Vetter
2012-08-08 21:35 ` [PATCH 8/8] drm/i915: enable rc6 on ilk again Daniel Vetter
2012-08-09 20:26   ` Ben Widawsky
2012-08-09  9:43 ` [PATCH 0/8] rps locking fixes v2 Chris Wilson
2012-08-09 11:48   ` Daniel Vetter
2012-08-09 14:58 ` Lespiau, Damien
2012-08-09 20:36   ` Daniel Vetter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20120809131841.0b116f2e@bwidawsk.net \
    --to=ben@bwidawsk.net \
    --cc=daniel.vetter@ffwll.ch \
    --cc=intel-gfx@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).