From patchwork Wed Jun 22 16:55:00 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ben Widawsky X-Patchwork-Id: 906402 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by demeter1.kernel.org (8.14.4/8.14.4) with ESMTP id p5MGtrcK007417 for ; Wed, 22 Jun 2011 16:56:13 GMT Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 6060F9EB47 for ; Wed, 22 Jun 2011 09:55:53 -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 C88BE9E7B1 for ; Wed, 22 Jun 2011 09:55:07 -0700 (PDT) Received: from localhost.localdomain (jfdmzpr01-ext.jf.intel.com [134.134.139.70]) by cloud01.chad-versace.us (Postfix) with ESMTPSA id 131C41D4078; Wed, 22 Jun 2011 16:57:11 +0000 (UTC) From: Ben Widawsky To: intel-gfx@lists.freedesktop.org Date: Wed, 22 Jun 2011 09:55:00 -0700 Message-Id: <1308761701-1751-2-git-send-email-ben@bwidawsk.net> X-Mailer: git-send-email 1.7.5.2 In-Reply-To: <1308761701-1751-1-git-send-email-ben@bwidawsk.net> References: <1308761701-1751-1-git-send-email-ben@bwidawsk.net> Cc: Alexander Zhaunerchyk Subject: [Intel-gfx] [PATCH 1/2] drm/i915: more forcewake lock error info 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]); Wed, 22 Jun 2011 16:56:13 +0000 (UTC) Get some more useful info for debugging backtraces on forcewake problems. Appropriate debug flags will be required for the drm module. Signed-off-by: Ben Widawsky --- drivers/gpu/drm/i915/i915_drv.c | 12 ++++++++---- drivers/gpu/drm/i915/i915_drv.h | 8 +++++--- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c index 0defd42..af59811 100644 --- a/drivers/gpu/drm/i915/i915_drv.c +++ b/drivers/gpu/drm/i915/i915_drv.c @@ -317,13 +317,15 @@ static void __gen6_gt_force_wake_get(struct drm_i915_private *dev_priv) * be called at the beginning of the sequence followed by a call to * gen6_gt_force_wake_put() at the end of the sequence. */ -void gen6_gt_force_wake_get(struct drm_i915_private *dev_priv) +int gen6_gt_force_wake_get(struct drm_i915_private *dev_priv) { - WARN_ON(!mutex_is_locked(&dev_priv->dev->struct_mutex)); + int ret = WARN_ON(!mutex_is_locked(&dev_priv->dev->struct_mutex)); /* Forcewake is atomic in case we get in here without the lock */ if (atomic_add_return(1, &dev_priv->forcewake_count) == 1) __gen6_gt_force_wake_get(dev_priv); + + return ret; } static void __gen6_gt_force_wake_put(struct drm_i915_private *dev_priv) @@ -335,12 +337,14 @@ static void __gen6_gt_force_wake_put(struct drm_i915_private *dev_priv) /* * see gen6_gt_force_wake_get() */ -void gen6_gt_force_wake_put(struct drm_i915_private *dev_priv) +int gen6_gt_force_wake_put(struct drm_i915_private *dev_priv) { - WARN_ON(!mutex_is_locked(&dev_priv->dev->struct_mutex)); + int ret = WARN_ON(!mutex_is_locked(&dev_priv->dev->struct_mutex)); if (atomic_dec_and_test(&dev_priv->forcewake_count)) __gen6_gt_force_wake_put(dev_priv); + + return ret; } void __gen6_gt_wait_for_fifo(struct drm_i915_private *dev_priv) diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h index 8a9fd91..7421eb9 100644 --- a/drivers/gpu/drm/i915/i915_drv.h +++ b/drivers/gpu/drm/i915/i915_drv.h @@ -1362,8 +1362,8 @@ extern void intel_display_print_error_state(struct seq_file *m, * must be set to prevent GT core from power down and stale values being * returned. */ -void gen6_gt_force_wake_get(struct drm_i915_private *dev_priv); -void gen6_gt_force_wake_put(struct drm_i915_private *dev_priv); +int gen6_gt_force_wake_get(struct drm_i915_private *dev_priv); +int gen6_gt_force_wake_put(struct drm_i915_private *dev_priv); void __gen6_gt_wait_for_fifo(struct drm_i915_private *dev_priv); /* We give fast paths for the really cool registers */ @@ -1376,7 +1376,9 @@ void __gen6_gt_wait_for_fifo(struct drm_i915_private *dev_priv); static inline u##x i915_read##x(struct drm_i915_private *dev_priv, u32 reg) { \ u##x val = 0; \ if (NEEDS_FORCE_WAKE((dev_priv), (reg))) { \ - gen6_gt_force_wake_get(dev_priv); \ + if (gen6_gt_force_wake_get(dev_priv)) { \ + DRM_DEBUG_DRIVER("unlocked forcewake for 0x%08x\n", reg); \ + } \ val = read##y(dev_priv->regs + reg); \ gen6_gt_force_wake_put(dev_priv); \ } else { \