From patchwork Sat Apr 9 20:31:22 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ben Widawsky X-Patchwork-Id: 696231 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p39KXXbn030192 for ; Sat, 9 Apr 2011 20:33:54 GMT Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 0F1379F5DA for ; Sat, 9 Apr 2011 13:33:34 -0700 (PDT) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from cloud01.chad-versace.us (184-106-247-128.static.cloud-ips.com [184.106.247.128]) by gabe.freedesktop.org (Postfix) with ESMTP id 5D7D29F5D0 for ; Sat, 9 Apr 2011 13:31:30 -0700 (PDT) Received: from localhost.localdomain (unknown [67.208.96.87]) by cloud01.chad-versace.us (Postfix) with ESMTPSA id 1862C1D42B5; Sat, 9 Apr 2011 20:32:22 +0000 (UTC) From: Ben Widawsky To: intel-gfx@lists.freedesktop.org Date: Sat, 9 Apr 2011 13:31:22 -0700 Message-Id: <1302381082-3167-5-git-send-email-ben@bwidawsk.net> X-Mailer: git-send-email 1.7.3.4 In-Reply-To: <1302381082-3167-4-git-send-email-ben@bwidawsk.net> References: <1302284850-8274-1-git-send-email-ben@bwidawsk.net> <1302381082-3167-1-git-send-email-ben@bwidawsk.net> <1302381082-3167-2-git-send-email-ben@bwidawsk.net> <1302381082-3167-3-git-send-email-ben@bwidawsk.net> <1302381082-3167-4-git-send-email-ben@bwidawsk.net> Subject: [Intel-gfx] [PATCH 4/4] drm/i915: optional fewer warning patch X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.11 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 X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Sat, 09 Apr 2011 20:33:54 +0000 (UTC) This patch will likely produce much fewer warnings, but perhaps hide some bugs in the driver. Any warnings while using this patch are extremely likely to cause problems, while warnings without this patch are also driver bugs, but much less likely to be causing issues. Without this patch we may also get false warnings for intelligent users of the new refcount mechanism. Signed-off-by: Ben Widawsky --- drivers/gpu/drm/i915/i915_drv.c | 10 ++++++++-- 1 files changed, 8 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c index 96b3bfc..6da7079 100644 --- a/drivers/gpu/drm/i915/i915_drv.c +++ b/drivers/gpu/drm/i915/i915_drv.c @@ -286,8 +286,13 @@ void gen6_gt_force_wake_get(struct drm_i915_private *dev_priv) * immediately. Not having the lock causes a race, but all bets are off * when using forced forcewake, which should only be touched through * root-only entry in debugfs. + * + * Intelligent users of the interface may do a force_wake_get() followed + * by many register reads and writes, knowing that the reference count + * is already incremented. So we do not want to warn on those. */ - WARN_ON(!mutex_is_locked(&dev_priv->dev->struct_mutex)); + WARN_ON(!mutex_is_locked(&dev_priv->dev->struct_mutex) && + !dev_priv->forcewake_count); if (dev_priv->forcewake_count++ == 0) __gen6_gt_force_wake_get(dev_priv); @@ -301,7 +306,8 @@ static void __gen6_gt_force_wake_put(struct drm_i915_private *dev_priv) void gen6_gt_force_wake_put(struct drm_i915_private *dev_priv) { - WARN_ON(!mutex_is_locked(&dev_priv->dev->struct_mutex)); + WARN_ON(!mutex_is_locked(&dev_priv->dev->struct_mutex) && + !dev_priv->forcewake_count); if (--dev_priv->forcewake_count == 0) __gen6_gt_force_wake_put(dev_priv);