From: Ben Widawsky <ben@bwidawsk.net>
To: intel-gfx@lists.freedesktop.org
Subject: [PATCH 4/4] drm/i915: optional fewer warning patch
Date: Fri, 8 Apr 2011 10:47:30 -0700 [thread overview]
Message-ID: <1302284850-8274-5-git-send-email-ben@bwidawsk.net> (raw)
In-Reply-To: <1302284850-8274-1-git-send-email-ben@bwidawsk.net>
This patch will likely produce much fewer warnings, but perhaps hide
some bugs in the driver. I believe it's a good starting point however to
find the really serious issues first.
Goal is to hide warnings if the refcount for the forcewake "lock" is not
zero
Signed-off-by: Ben Widawsky <ben@bwidawsk.net>
---
drivers/gpu/drm/i915/i915_drv.c | 14 ++++++++++----
1 files changed, 10 insertions(+), 4 deletions(-)
diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
index fcd5c9a..33341d4 100644
--- a/drivers/gpu/drm/i915/i915_drv.c
+++ b/drivers/gpu/drm/i915/i915_drv.c
@@ -286,9 +286,14 @@ 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) &&
- !atomic_read(&dev_priv->forcewake_force));
+ WARN_ON((!mutex_is_locked(&dev_priv->dev->struct_mutex) &&
+ !dev_priv->forcewake_count) &&
+ !atomic_read(&dev_priv->forcewake_force));
if (dev_priv->forcewake_count++ == 0)
__gen6_gt_force_wake_get(dev_priv);
@@ -302,8 +307,9 @@ 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) &&
- !atomic_read(&dev_priv->forcewake_force));
+ WARN_ON((!mutex_is_locked(&dev_priv->dev->struct_mutex) &&
+ !dev_priv->forcewake_count) &&
+ !atomic_read(&dev_priv->forcewake_force));
if (--dev_priv->forcewake_count == 0)
__gen6_gt_force_wake_put(dev_priv);
--
1.7.3.4
next prev parent reply other threads:[~2011-04-08 17:47 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-04-08 17:47 forcewake junk, RFC, RFT(test) Ben Widawsky
2011-04-08 17:47 ` [PATCH 1/4] drm/i915: proper use of forcewake Ben Widawsky
2011-04-08 17:47 ` [PATCH 2/4] drm/i915: refcounts for forcewake Ben Widawsky
2011-04-08 17:47 ` [PATCH 3/4] drm/i915: userspace interface to the forcewake refcount Ben Widawsky
2011-04-08 17:47 ` Ben Widawsky [this message]
2011-04-09 20:26 ` forcewake junk, part2 Ben Widawsky
2011-04-09 20:26 ` (no subject) Ben Widawsky
[not found] ` <1302380787-2957-3-git-send-email-ben@bwidawsk.net>
2011-04-09 20:26 ` [PATCH 1/4] drm/i915: proper use of forcewake Ben Widawsky
2011-04-09 20:26 ` [PATCH 2/4] drm/i915: refcounts for forcewake Ben Widawsky
2011-04-09 20:26 ` [PATCH 3/4] drm/i915: userspace interface to the forcewake refcount Ben Widawsky
2011-04-09 20:31 ` forcewake patches (ignore previous, please) Ben Widawsky
2011-04-09 20:31 ` [PATCH 1/4] drm/i915: proper use of forcewake Ben Widawsky
2011-04-09 20:31 ` [PATCH 2/4] drm/i915: refcounts for forcewake Ben Widawsky
2011-04-09 20:31 ` [PATCH 3/4] drm/i915: userspace interface to the forcewake refcount Ben Widawsky
2011-04-09 20:31 ` [PATCH 4/4] drm/i915: optional fewer warning patch Ben Widawsky
2011-04-09 22:31 ` Chris Wilson
2011-04-09 23:32 ` Ben Widawsky
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=1302284850-8274-5-git-send-email-ben@bwidawsk.net \
--to=ben@bwidawsk.net \
--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).