From: Daniel Vetter Subject: Re: [PATCH 3/3] drm/i915: Only do gtt cleanup in vma_unbind for the global vma Date: Wed, 14 May 2014 18:40:32 +0200 Message-ID: <20140514164032.GI8790@phenom.ffwll.local> References: <20140128124028.GX9454@intel.com> <1392383167-19948-1-git-send-email-daniel.vetter@ffwll.ch> <1392383167-19948-3-git-send-email-daniel.vetter@ffwll.ch> <20140514161413.GN18465@intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Return-path: Received: from mail-ee0-f48.google.com (mail-ee0-f48.google.com [74.125.83.48]) by gabe.freedesktop.org (Postfix) with ESMTP id EFC766E0FA for ; Wed, 14 May 2014 09:40:40 -0700 (PDT) Received: by mail-ee0-f48.google.com with SMTP id e49so1546502eek.7 for ; Wed, 14 May 2014 09:40:40 -0700 (PDT) Content-Disposition: inline In-Reply-To: <20140514161413.GN18465@intel.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" To: Ville =?iso-8859-1?Q?Syrj=E4l=E4?= Cc: Daniel Vetter , Intel Graphics Development List-Id: intel-gfx@lists.freedesktop.org On Wed, May 14, 2014 at 07:14:13PM +0300, Ville Syrj=E4l=E4 wrote: > On Fri, Feb 14, 2014 at 02:06:07PM +0100, Daniel Vetter wrote: > > Otherwise we end up tearing down fences when e.g. the client quits > > way too early. Might or might not fix a fence pin_count BUG Ville has > > reported. > > = > > Cc: Ville Syrj=E4l=E4 > > Signed-off-by: Daniel Vetter > = > For patches 1 and 3: > Reviewed-by: Ville Syrj=E4l=E4 Merged, thanks for the review and writing the testcase. -Daniel > = > > --- > > drivers/gpu/drm/i915/i915_gem.c | 12 +++++++----- > > 1 file changed, 7 insertions(+), 5 deletions(-) > > = > > diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i91= 5_gem.c > > index 675ad96a43e1..fa00b26a9cf7 100644 > > --- a/drivers/gpu/drm/i915/i915_gem.c > > +++ b/drivers/gpu/drm/i915/i915_gem.c > > @@ -2731,12 +2731,14 @@ int i915_vma_unbind(struct i915_vma *vma) > > * cause memory corruption through use-after-free. > > */ > > = > > - i915_gem_object_finish_gtt(obj); > > + if (i915_is_ggtt(vma->vm)) { > > + i915_gem_object_finish_gtt(obj); > > = > > - /* release the fence reg _after_ flushing */ > > - ret =3D i915_gem_object_put_fence(obj); > > - if (ret) > > - return ret; > > + /* release the fence reg _after_ flushing */ > > + ret =3D i915_gem_object_put_fence(obj); > > + if (ret) > > + return ret; > > + } > > = > > trace_i915_vma_unbind(vma); > > = > > -- = > > 1.8.5.2 > = > -- = > Ville Syrj=E4l=E4 > Intel OTC -- = Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch