From mboxrd@z Thu Jan 1 00:00:00 1970 From: Chris Wilson Subject: Re: [PATCH 1/2] drm/i915: Defer assignment of obj->gtt_space until after all possible mallocs Date: Wed, 21 Nov 2012 13:15:24 +0000 Message-ID: References: <1353503044-20343-1-git-send-email-chris@chris-wilson.co.uk> <20121121131134.GQ5854@phenom.ffwll.local> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by gabe.freedesktop.org (Postfix) with ESMTP id 6E26FE5CAB for ; Wed, 21 Nov 2012 05:15:28 -0800 (PST) In-Reply-To: <20121121131134.GQ5854@phenom.ffwll.local> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: intel-gfx-bounces+gcfxdi-intel-gfx=m.gmane.org@lists.freedesktop.org Errors-To: intel-gfx-bounces+gcfxdi-intel-gfx=m.gmane.org@lists.freedesktop.org To: Daniel Vetter Cc: intel-gfx@lists.freedesktop.org List-Id: intel-gfx@lists.freedesktop.org On Wed, 21 Nov 2012 14:11:34 +0100, Daniel Vetter wrote: > On Wed, Nov 21, 2012 at 01:04:03PM +0000, Chris Wilson wrote: > > As we may invoke the shrinker whilst trying to allocate memory to hold > > the gtt_space for this object, we need to be careful not to mark the > > drm_mm_node as activated (by assigning it to this object) before we > > have finished our sequence of allocations. > > > > Reported-by: Imre Deak > > Signed-off-by: Chris Wilson > > --- > > > @@ -3449,11 +3443,16 @@ i915_gem_object_pin(struct drm_i915_gem_object *obj, > > } > > > > if (obj->gtt_space == NULL) { > > + struct drm_i915_private *dev_priv = obj->base.dev->dev_private; > > + > > ret = i915_gem_object_bind_to_gtt(obj, alignment, > > map_and_fenceable, > > nonblocking); > > if (ret) > > return ret; > > + > > + if (!dev_priv->mm.aliasing_ppgtt) > > + i915_gem_gtt_bind_object(obj, obj->cache_level); > > Spurious hunk? Not really, I need to reorder the bind_object until after the assignment of obj->gtt_space and upon reflection it looked better if I did the bind there next to its compadre then amongst the assignments in the tail of bind_to_gtt(). Of course, this means that bind_to_gtt is now a grand misnomer. -Chris -- Chris Wilson, Intel Open Source Technology Centre