From patchwork Thu Aug 9 13:07:02 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Vetter X-Patchwork-Id: 1300571 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by patchwork2.kernel.org (Postfix) with ESMTP id 0B83DDFF7B for ; Thu, 9 Aug 2012 12:51:07 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 9B0FCA0DFA for ; Thu, 9 Aug 2012 05:51:06 -0700 (PDT) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mail-wg0-f43.google.com (mail-wg0-f43.google.com [74.125.82.43]) by gabe.freedesktop.org (Postfix) with ESMTP id 16CEC9E84C for ; Thu, 9 Aug 2012 05:50:14 -0700 (PDT) Received: by mail-wg0-f43.google.com with SMTP id dr1so284617wgb.12 for ; Thu, 09 Aug 2012 05:50:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; bh=UyZO2TFi4CONTD1eQ/z/IEuuJJ32u37nsPB8gJLNnyI=; b=InRh6c+957eqoCz43GOd4noWYF5hIPwPF0U+Wqp1cyFBMfPER/FLxBJJuDHH1AjjXU 4/egHyyK49QPCLzsp+cZHdcjqCKdOOVRBAFo9RW5yfxueUCw7aRs3+Yf6ukLIjBb94td qW16WHuQRw/tlIehQUl2i2cj5la1xN99iOPdU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references :x-gm-message-state; bh=UyZO2TFi4CONTD1eQ/z/IEuuJJ32u37nsPB8gJLNnyI=; b=LrLtggcbU7DaT8i9f4aS2wLGAHpscMO9qmRFoH4QuwV+DNSxV6VuGd5sTMGgKXf7M1 fMyEAP1FSzQA6PLUA0O5jDm/K7Y+T7MNJ3PQDOtMhLeI5u2CCbiKHAtAVNbfAKpK1r3k rh92+snO4bJCFB+qAnKdoL1PygZ2sj+aUoP7TfBw8gMHahbgMe3BYE8laB/vjaaWSt1L dp6DW3r8BjkdF7PBMtro3qDttHNLZs8XlXu6I71PpjLcuwTRF4Nf4I74YRTgNfoGPMC9 ZWPuOFdQ9CbVzcvbK4U3Vmj/kwGCS3IwG4ad4eAtEdhuVFe21BylgY+H71cKaHNy4CY2 mF1g== Received: by 10.216.30.83 with SMTP id j61mr11474174wea.168.1344516614877; Thu, 09 Aug 2012 05:50:14 -0700 (PDT) Received: from hummel.ffwll.local (178-83-130-250.dynamic.hispeed.ch. [178.83.130.250]) by mx.google.com with ESMTPS id fu8sm1534288wib.5.2012.08.09.05.50.13 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 09 Aug 2012 05:50:14 -0700 (PDT) From: Daniel Vetter To: Intel Graphics Development Date: Thu, 9 Aug 2012 15:07:02 +0200 Message-Id: <1344517622-21888-2-git-send-email-daniel.vetter@ffwll.ch> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1344517622-21888-1-git-send-email-daniel.vetter@ffwll.ch> References: <1344504744_63017@CP5-2952> <1344517622-21888-1-git-send-email-daniel.vetter@ffwll.ch> X-Gm-Message-State: ALoCoQkNiugzUUCM802BQuugPbgCPxGI6TX2JCCoo/wCIpdc03EJ3jr4N/R5KZdwpIetDyWQY538 Cc: Daniel Vetter Subject: [Intel-gfx] [PATCH 2/2] drm/i915: use mutex_lock_interruptible for debugfs files X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: intel-gfx-bounces+patchwork-intel-gfx=patchwork.kernel.org@lists.freedesktop.org Errors-To: intel-gfx-bounces+patchwork-intel-gfx=patchwork.kernel.org@lists.freedesktop.org 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 --- 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);