From: Ben Widawsky <ben@bwidawsk.net>
To: intel-gfx@lists.freedesktop.org
Subject: [PATCH 1/4] drm/i915: fix ilk rc6 teardown locking
Date: Fri, 18 Mar 2011 16:12:45 -0700 [thread overview]
Message-ID: <1300489968-8574-2-git-send-email-ben@bwidawsk.net> (raw)
In-Reply-To: <1300489968-8574-1-git-send-email-ben@bwidawsk.net>
In the failure cases during rc6 initialization, both the power context
and render context may get !refcount without holding struct_mutex.
However, on rc6 disabling, the lock is held by the caller.
Added a simple parameter to control whether or not to acquire the lock.
Signed-off-by: Ben Widawsky <ben@bwidawsk.net>
---
drivers/gpu/drm/i915/intel_display.c | 14 ++++++++++----
1 files changed, 10 insertions(+), 4 deletions(-)
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 49fb54f..790af25 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -6541,10 +6541,13 @@ void intel_enable_clock_gating(struct drm_device *dev)
}
}
-static void ironlake_teardown_rc6(struct drm_device *dev)
+static void ironlake_teardown_rc6(struct drm_device *dev, bool need_lock)
{
struct drm_i915_private *dev_priv = dev->dev_private;
+ if (need_lock)
+ mutex_lock(&dev->struct_mutex);
+
if (dev_priv->renderctx) {
i915_gem_object_unpin(dev_priv->renderctx);
drm_gem_object_unreference(&dev_priv->renderctx->base);
@@ -6556,6 +6559,9 @@ static void ironlake_teardown_rc6(struct drm_device *dev)
drm_gem_object_unreference(&dev_priv->pwrctx->base);
dev_priv->pwrctx = NULL;
}
+
+ if (need_lock)
+ mutex_unlock(&dev->struct_mutex);
}
static void ironlake_disable_rc6(struct drm_device *dev)
@@ -6575,7 +6581,7 @@ static void ironlake_disable_rc6(struct drm_device *dev)
POSTING_READ(RSTDBYCTL);
}
- ironlake_teardown_rc6(dev);
+ ironlake_teardown_rc6(dev, false);
}
static int ironlake_setup_rc6(struct drm_device *dev)
@@ -6590,7 +6596,7 @@ static int ironlake_setup_rc6(struct drm_device *dev)
if (dev_priv->pwrctx == NULL)
dev_priv->pwrctx = intel_alloc_context_page(dev);
if (!dev_priv->pwrctx) {
- ironlake_teardown_rc6(dev);
+ ironlake_teardown_rc6(dev, true);
return -ENOMEM;
}
@@ -6618,7 +6624,7 @@ void ironlake_enable_rc6(struct drm_device *dev)
*/
ret = BEGIN_LP_RING(6);
if (ret) {
- ironlake_teardown_rc6(dev);
+ ironlake_teardown_rc6(dev, true);
return;
}
--
1.7.3.4
next prev parent reply other threads:[~2011-03-18 23:12 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-03-18 23:12 [PATCH 0/4] Re-enable RC6 on Ironlake Ben Widawsky
2011-03-18 23:12 ` Ben Widawsky [this message]
2011-03-19 7:44 ` [PATCH 1/4] drm/i915: fix ilk rc6 teardown locking Chris Wilson
2011-03-19 18:38 ` [PATCH v2 " Ben Widawsky
2011-03-19 18:46 ` [PATCH " Keith Packard
2011-03-20 1:14 ` [PATCH v2 1/5] " Ben Widawsky
2011-03-20 1:14 ` [PATCH v2 2/5] drm/1915: ringbuffer wait for idle function Ben Widawsky
2011-03-20 1:14 ` [PATCH v2 3/5] drm/i915: fix rc6 initialization on Ironlake Ben Widawsky
2011-03-20 1:14 ` [PATCH v2 4/5] drm/i915: debugfs for context information Ben Widawsky
2011-03-20 1:14 ` [PATCH v2 5/5] drm/i915: re-enable rc6 for ironlake Ben Widawsky
2011-03-18 23:12 ` [PATCH 2/4] drm/i915: fix rc6 initialization on Ironlake Ben Widawsky
2011-03-19 7:55 ` Chris Wilson
2011-03-20 0:07 ` Ben Widawsky
2011-03-18 23:12 ` [PATCH 3/4] drm/i915: debugfs for context information Ben Widawsky
2011-03-18 23:12 ` [PATCH 4/4] drm/i915: re-enable rc6 for ironlake Ben Widawsky
2011-04-27 7:49 ` Chris Wilson
2011-04-27 21:20 ` Jesse Barnes
2011-04-27 22:03 ` Chris Wilson
2011-04-27 22:49 ` Jesse Barnes
2011-04-28 17:10 ` 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=1300489968-8574-2-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).