From patchwork Thu Mar 26 12:39:40 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tvrtko Ursulin X-Patchwork-Id: 6098311 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.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 225639F2A9 for ; Thu, 26 Mar 2015 12:39:55 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 42CAC203DF for ; Thu, 26 Mar 2015 12:39:54 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 2F63120394 for ; Thu, 26 Mar 2015 12:39:53 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 8D00A6E4CE; Thu, 26 Mar 2015 05:39:52 -0700 (PDT) X-Original-To: Intel-gfx@lists.freedesktop.org Delivered-To: Intel-gfx@lists.freedesktop.org Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by gabe.freedesktop.org (Postfix) with ESMTP id 0B47B6E4CE for ; Thu, 26 Mar 2015 05:39:51 -0700 (PDT) Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga102.jf.intel.com with ESMTP; 26 Mar 2015 05:39:45 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.11,471,1422950400"; d="scan'208";a="546667429" Received: from tursulin-linux.isw.intel.com ([10.102.226.48]) by orsmga003.jf.intel.com with ESMTP; 26 Mar 2015 05:39:43 -0700 From: Tvrtko Ursulin To: Intel-gfx@lists.freedesktop.org Date: Thu, 26 Mar 2015 12:39:40 +0000 Message-Id: <1427373580-20512-1-git-send-email-tvrtko.ursulin@linux.intel.com> X-Mailer: git-send-email 2.3.2 Subject: [Intel-gfx] [PATCH] drm/i915: Move drm_framebuffer_unreference out of struct_mutex for takeover X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.18 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=-3.2 required=5.0 tests=BAYES_00,HK_RANDOM_FROM, RCVD_IN_DNSWL_MED, T_RP_MATCHES_RCVD, 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: Tvrtko Ursulin intel_user_framebuffer_destroy() requires the struct_mutex for its object bookkeeping, so this means that all calls to drm_framebuffer_unreference must be held without that lock. This is a simplified version of the identically named patch by Chris Wilson. References: https://bugs.freedesktop.org/show_bug.cgi?id=89166 Cc: Chris Wilson Signed-off-by: Tvrtko Ursulin Tested-By: PRC QA PRTS (Patch Regression Test System Contact: shuang.he@intel.com) --- drivers/gpu/drm/i915/intel_display.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index cb50854..0788507 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c @@ -14020,11 +14020,21 @@ void intel_modeset_gem_init(struct drm_device *dev) c->primary->fb, c->primary->state, NULL)) { + /* + * We must drop struct_mutex when calling + * drm_framebuffer_unreference and it is safe to do so + * because it is not needed at this point anyway. + * At this stage the driver is still single-threaded and + * we are taking it only to silence a warning in + * intel_pin_and_fence_fb_obj. + */ + mutex_unlock(&dev->struct_mutex); DRM_ERROR("failed to pin boot fb on pipe %d\n", to_intel_crtc(c)->pipe); drm_framebuffer_unreference(c->primary->fb); c->primary->fb = NULL; update_state_fb(c->primary); + mutex_lock(&dev->struct_mutex); } } mutex_unlock(&dev->struct_mutex);