From patchwork Fri Mar 18 23:12:45 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ben Widawsky X-Patchwork-Id: 645691 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 p2INDg29005108 for ; Fri, 18 Mar 2011 23:14:07 GMT Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id CB91B9EF85 for ; Fri, 18 Mar 2011 16:13:42 -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 9AAFF9E7CA for ; Fri, 18 Mar 2011 16:12:58 -0700 (PDT) Received: from localhost.localdomain (unknown [67.208.96.87]) by cloud01.chad-versace.us (Postfix) with ESMTPSA id 42C561D406F; Fri, 18 Mar 2011 23:13:27 +0000 (UTC) From: Ben Widawsky To: intel-gfx@lists.freedesktop.org Date: Fri, 18 Mar 2011 16:12:45 -0700 Message-Id: <1300489968-8574-2-git-send-email-ben@bwidawsk.net> X-Mailer: git-send-email 1.7.3.4 In-Reply-To: <1300489968-8574-1-git-send-email-ben@bwidawsk.net> References: <1300489968-8574-1-git-send-email-ben@bwidawsk.net> Subject: [Intel-gfx] [PATCH 1/4] drm/i915: fix ilk rc6 teardown locking 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]); Fri, 18 Mar 2011 23:14:07 +0000 (UTC) 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; }