From patchwork Fri Aug 1 18:49:15 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paulo Zanoni X-Patchwork-Id: 4664171 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id A54ED9F2B8 for ; Fri, 1 Aug 2014 18:49:38 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id E8BBD201DD for ; Fri, 1 Aug 2014 18:49:37 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id BDBBD201CD for ; Fri, 1 Aug 2014 18:49:36 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id BDE5B6E28F; Fri, 1 Aug 2014 11:49:35 -0700 (PDT) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mail-vc0-f179.google.com (mail-vc0-f179.google.com [209.85.220.179]) by gabe.freedesktop.org (Postfix) with ESMTP id 3CF006E28F for ; Fri, 1 Aug 2014 11:49:34 -0700 (PDT) Received: by mail-vc0-f179.google.com with SMTP id hq11so7276725vcb.24 for ; Fri, 01 Aug 2014 11:49:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=kHxK3dafxO8GX/SLAWweoTOhmZL71jptB6xxuc316iE=; b=xD/Mp30UBXWhRcJ/LZLnjFqY13wX5mKpYCNHCVt2pEptDIb5Z/VjRSSMmwueKrblAH UXKZnLrFWxKOcDLQWnNCBKyGJv+RTtkvv/U4I7mrWqnGO6+CHVj94dbJRyM2pglt2Oa8 TT3CL+CN+s1jGeuugj8jU4ku0qycshp5SvTA3lWGTRT1SEgL9bcTh/J8GCLvZ4VXQsFO gjeGAr+iahnu2o12KFJRVaHlEspoIOTJaoLTS0z94QSPStPLY7AmDiJEywCOcazX6O8q 9z8gzDYZyl983PHl1pTrmhLG8Rz1EeL7+2pqmVVrNG/fxSMnKBToqaUtW3pPYqXIbdBE W+nQ== X-Received: by 10.220.81.194 with SMTP id y2mr8845485vck.29.1406918973676; Fri, 01 Aug 2014 11:49:33 -0700 (PDT) Received: from localhost.localdomain ([177.156.177.122]) by mx.google.com with ESMTPSA id u6sm7154590vem.7.2014.08.01.11.49.31 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 01 Aug 2014 11:49:33 -0700 (PDT) From: Paulo Zanoni To: intel-gfx@lists.freedesktop.org Date: Fri, 1 Aug 2014 15:49:15 -0300 Message-Id: <1406918955-1876-1-git-send-email-przanoni@gmail.com> X-Mailer: git-send-email 2.0.1 Cc: Paulo Zanoni Subject: [Intel-gfx] [PATCH] drm/i915: grab struct_mutex at intel_edp_psr_enable() X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Spam-Status: No, score=-4.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Paulo Zanoni Otherwise we will hit "lockdep_assert_held(&dev->struct_mutex)" from intel_edp_psr_match_conditions(). This happens all the time on my BDW machine: just boot it and you'll get it. In this patch I just grab struct_mutex in the deepest possible place (around psr.lock, otherwise lockdep complains). Signed-off-by: Paulo Zanoni --- drivers/gpu/drm/i915/intel_dp.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c index 87d0489..a91142c 100644 --- a/drivers/gpu/drm/i915/intel_dp.c +++ b/drivers/gpu/drm/i915/intel_dp.c @@ -1876,11 +1876,11 @@ void intel_edp_psr_enable(struct intel_dp *intel_dp) return; } + mutex_lock(&dev->struct_mutex); mutex_lock(&dev_priv->psr.lock); if (dev_priv->psr.enabled) { DRM_DEBUG_KMS("PSR already in use\n"); - mutex_unlock(&dev_priv->psr.lock); - return; + goto out; } dev_priv->psr.busy_frontbuffer_bits = 0; @@ -1890,7 +1890,10 @@ void intel_edp_psr_enable(struct intel_dp *intel_dp) if (intel_edp_psr_match_conditions(intel_dp)) dev_priv->psr.enabled = intel_dp; + +out: mutex_unlock(&dev_priv->psr.lock); + mutex_unlock(&dev->struct_mutex); } void intel_edp_psr_disable(struct intel_dp *intel_dp)