From patchwork Mon Jun 15 07:53:02 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Chris Wilson X-Patchwork-Id: 6606531 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id A1590C0020 for ; Mon, 15 Jun 2015 07:53:12 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id C1DFD20395 for ; Mon, 15 Jun 2015 07:53:11 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 7A9572037E for ; Mon, 15 Jun 2015 07:53:10 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 90BE16E23C; Mon, 15 Jun 2015 00:53:09 -0700 (PDT) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from fireflyinternet.com (mail.fireflyinternet.com [87.106.93.118]) by gabe.freedesktop.org (Postfix) with ESMTP id 867A16E23C for ; Mon, 15 Jun 2015 00:53:08 -0700 (PDT) X-Default-Received-SPF: pass (skip=forwardok (res=PASS)) x-ip-name=78.156.65.138; Received: from nuc-i3427.alporthouse.com (unverified [78.156.65.138]) by fireflyinternet.com (Firefly Internet (M1)) with ESMTP id 41092983-1500048 for multiple; Mon, 15 Jun 2015 08:53:46 +0100 Received: by nuc-i3427.alporthouse.com (sSMTP sendmail emulation); Mon, 15 Jun 2015 08:53:02 +0100 Date: Mon, 15 Jun 2015 08:53:02 +0100 From: Chris Wilson To: Jani Nikula Message-ID: <20150615075302.GR28462@nuc-i3427.alporthouse.com> Mail-Followup-To: Chris Wilson , Jani Nikula , Lukas Wunner , intel-gfx@lists.freedesktop.org References: <20150603134332.GA5548@wunner.de> <20150603135741.GB27056@nuc-i3427.alporthouse.com> <87a8w179og.fsf@intel.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <87a8w179og.fsf@intel.com> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: intel-gfx@lists.freedesktop.org Subject: Re: [Intel-gfx] Deadlock in intel_user_framebuffer_destroy() 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: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Spam-Status: No, score=-4.7 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, 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 On Mon, Jun 15, 2015 at 09:44:15AM +0300, Jani Nikula wrote: > On Wed, 03 Jun 2015, Chris Wilson wrote: > > On Wed, Jun 03, 2015 at 03:43:32PM +0200, Lukas Wunner wrote: > >> Hi, > >> > >> a deadlock was introduced by commit 60a5ca015ffd2aacfe5674b5a401cd2a37159e07 > >> > >> Author: Ville Syrjälä > >> Date: Fri Jun 13 11:10:53 2014 +0300 > >> > >> drm/i915: Add locking around framebuffer_references-- > >> > >> > >> The commit amended intel_display.c:intel_user_framebuffer_destroy() with > >> mutex_lock(&dev->struct_mutex). > >> > >> A few weeks prior Chris Wilson had amended intel_fbdev.c:intelfb_create() > >> with a call to drm_framebuffer_unreference() while &dev->struct_mutex is > >> locked (commit edd586fe705e819bc711b5ed7194a0b6f9f1a7e1, "drm/i915: Discard > >> BIOS framebuffers too small to accommodate chosen mode"). > >> > > > > Just move the mutex_lock down a step. > > Lucas, did you try this? There's a goto unlock that also needed to be disabled, such as diff --git a/drivers/gpu/drm/i915/intel_fbdev.c b/drivers/gpu/drm/i915/intel_fbdev.c index dda99c0d6be1..fc7ec5138fb7 100644 --- a/drivers/gpu/drm/i915/intel_fbdev.c +++ b/drivers/gpu/drm/i915/intel_fbdev.c @@ -213,8 +213,6 @@ static int intelfb_create(struct drm_fb_helper *helper, bool prealloc = false; int ret; - mutex_lock(&dev->struct_mutex); - if (intel_fb && (sizes->fb_width > intel_fb->base.width || sizes->fb_height > intel_fb->base.height)) { @@ -229,7 +227,7 @@ static int intelfb_create(struct drm_fb_helper *helper, DRM_DEBUG_KMS("no BIOS fb, allocating a new one\n"); ret = intelfb_alloc(helper, sizes); if (ret) - goto out_unlock; + return ret; intel_fb = ifbdev->fb; } else { DRM_DEBUG_KMS("re-using BIOS fb\n"); @@ -241,6 +239,7 @@ static int intelfb_create(struct drm_fb_helper *helper, obj = intel_fb->obj; vma = i915_gem_obj_to_ggtt(obj, NULL); + mutex_lock(&dev->struct_mutex); info = framebuffer_alloc(0, &dev->pdev->dev); if (!info) { ret = -ENOMEM; @@ -311,7 +310,6 @@ static int intelfb_create(struct drm_fb_helper *helper, out_unpin: drm_gem_object_unreference(&obj->base); -out_unlock: mutex_unlock(&dev->struct_mutex); return ret; }