From patchwork Mon Jan 11 15:04:58 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Wilson X-Patchwork-Id: 8005271 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 7C55EBEEE5 for ; Mon, 11 Jan 2016 15:05:14 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 93150201FE for ; Mon, 11 Jan 2016 15:05:13 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 9BCD120138 for ; Mon, 11 Jan 2016 15:05:11 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id BDE386E186; Mon, 11 Jan 2016 07:05:10 -0800 (PST) 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 1CA4A6E186 for ; Mon, 11 Jan 2016 07:05:01 -0800 (PST) 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 51086953-1500048 for multiple; Mon, 11 Jan 2016 15:06:22 +0000 Received: by nuc-i3427.alporthouse.com (sSMTP sendmail emulation); Mon, 11 Jan 2016 15:04:58 +0000 Date: Mon, 11 Jan 2016 15:04:58 +0000 From: Chris Wilson To: Tvrtko Ursulin , Intel-gfx@lists.freedesktop.org Message-ID: <20160111150458.GI652@nuc-i3427.alporthouse.com> Mail-Followup-To: Chris Wilson , Tvrtko Ursulin , Intel-gfx@lists.freedesktop.org References: <1452521321-4032-1-git-send-email-tvrtko.ursulin@linux.intel.com> <1452521321-4032-8-git-send-email-tvrtko.ursulin@linux.intel.com> <20160111143800.GF652@nuc-i3427.alporthouse.com> <5693C075.5070006@linux.intel.com> <20160111150020.GH652@nuc-i3427.alporthouse.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20160111150020.GH652@nuc-i3427.alporthouse.com> User-Agent: Mutt/1.5.21 (2010-09-15) Subject: Re: [Intel-gfx] [PATCH 7/7] drm/i915: GEM operations need to be done under the big lock 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.2 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, Jan 11, 2016 at 03:00:20PM +0000, Chris Wilson wrote: > On Mon, Jan 11, 2016 at 02:47:17PM +0000, Tvrtko Ursulin wrote: > > > > On 11/01/16 14:38, Chris Wilson wrote: > > >On Mon, Jan 11, 2016 at 02:08:41PM +0000, Tvrtko Ursulin wrote: > > >>From: Tvrtko Ursulin > > >> > > >>VMA creation and GEM list management need the big lock. > > >> > > >>v2: > > >> > > >>Mutex unlock ended on the wrong path somehow. (0-day, Julia Lawall) > > >> > > >>Not to mention drm_gem_object_unreference was there in existing > > >>code with no mutex held. > > >> > > >>v3: > > >> > > >>Some callers of i915_gem_object_create_stolen_for_preallocated > > >>already hold the lock so move the mutex into the other caller > > >>as well. > > > > > >intel_pm.c valleyview_setup_pctx? > > > > Already holds it traced by the WARN_ON at its top. > > Which is a nice little mutex inversion of its own. :| > i.e. rpm vs struct_mutex bug -Chris diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index b1fb43fcfeea..c8f684f8799c 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c @@ -16018,9 +16018,7 @@ void intel_modeset_gem_init(struct drm_device *dev) struct drm_crtc *c; struct drm_i915_gem_object *obj; - mutex_lock(&dev->struct_mutex); intel_init_gt_powersave(dev); - mutex_unlock(&dev->struct_mutex); intel_modeset_init_hw(dev); diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c index a082b4577599..90e5bf7a2402 100644 --- a/drivers/gpu/drm/i915/intel_pm.c +++ b/drivers/gpu/drm/i915/intel_pm.c @@ -5224,8 +5224,6 @@ static void cherryview_setup_pctx(struct drm_device *dev) u32 pcbr; int pctx_size = 32*1024; - WARN_ON(!mutex_is_locked(&dev->struct_mutex)); - pcbr = I915_READ(VLV_PCBR); if ((pcbr >> VLV_PCBR_ADDR_SHIFT) == 0) { DRM_DEBUG_DRIVER("BIOS didn't set up PCBR, fixing up\n"); @@ -5247,8 +5245,7 @@ static void valleyview_setup_pctx(struct drm_device *dev) u32 pcbr; int pctx_size = 24*1024; - WARN_ON(!mutex_is_locked(&dev->struct_mutex)); - + mutex_lock(&dev->struct_mutex); pcbr = I915_READ(VLV_PCBR); if (pcbr) { /* BIOS set it up already, grab the pre-alloc'd space */ @@ -5275,7 +5272,7 @@ static void valleyview_setup_pctx(struct drm_device *dev) pctx = i915_gem_object_create_stolen(dev, pctx_size); if (!pctx) { DRM_DEBUG("not enough stolen space for PCTX, disabling\n"); - return; + goto out; } pctx_paddr = dev_priv->mm.stolen_base + pctx->stolen->start; @@ -5284,6 +5281,7 @@ static void valleyview_setup_pctx(struct drm_device *dev) out: DRM_DEBUG_DRIVER("PCBR: 0x%08x\n", I915_READ(VLV_PCBR)); dev_priv->vlv_pctx = pctx; + mutex_unlock(&dev->struct_mutex); } static void valleyview_cleanup_pctx(struct drm_device *dev)