From patchwork Tue Apr 12 01:01:19 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ben Widawsky X-Patchwork-Id: 699141 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 p3C13lnr019456 for ; Tue, 12 Apr 2011 01:04:07 GMT Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 0AFC49EC5D for ; Mon, 11 Apr 2011 18:03:47 -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 7FBBF9E791 for ; Mon, 11 Apr 2011 18:01:30 -0700 (PDT) Received: from localhost.localdomain (fruit.freedesktop.org [131.252.210.190]) by cloud01.chad-versace.us (Postfix) with ESMTPSA id 67DD31D42CC; Tue, 12 Apr 2011 01:02:24 +0000 (UTC) From: Ben Widawsky To: intel-gfx@lists.freedesktop.org Date: Mon, 11 Apr 2011 18:01:19 -0700 Message-Id: <1302570079-17032-5-git-send-email-ben@bwidawsk.net> X-Mailer: git-send-email 1.7.3.4 In-Reply-To: <1302570079-17032-1-git-send-email-ben@bwidawsk.net> References: <1302570079-17032-1-git-send-email-ben@bwidawsk.net> Subject: [Intel-gfx] [PATCH 4/4] drm/i915: fewer warning patch (temporary) 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]); Tue, 12 Apr 2011 01:04:07 +0000 (UTC) This patch may help mask some of the warnings. Because it's only a requirement to hold struct_mutex to obtain a reference, it is acceptable from a hardware perspective to not hold struct_mutex if there is already a reference. However, it's still extremely dangerous since there is no real synchronization with the reference count (it could change right after our check). This should only be used by developers who want to debug some of the warnings, but want to deal with a possibly smaller set of warnings to start with. It should not go upstream. Signed-off-by: Ben Widawsky --- drivers/gpu/drm/i915/i915_drv.c | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c index 0894e9f..d5748ba 100644 --- a/drivers/gpu/drm/i915/i915_drv.c +++ b/drivers/gpu/drm/i915/i915_drv.c @@ -290,7 +290,8 @@ void gen6_gt_force_wake_get(struct drm_i915_private *dev_priv) * The other option is to introduce a new forcewake lock which must be * acquired prior to any register read. */ - 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); @@ -307,7 +308,8 @@ void gen6_gt_force_wake_put(struct drm_i915_private *dev_priv) /* * See gen6_gt_force_wake_get() */ - 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);