[Intel-gfx] [PATCH 1/6] drm/i915: Allow late allocation of request for i915_add_request()

Chris Wilson chris at chris-wilson.co.uk
Thu Jul 12 19:56:41 CEST 2012


On Thu, 12 Jul 2012 19:43:47 +0200, Daniel Vetter <daniel at ffwll.ch> wrote:
> On Thu, Jul 12, 2012 at 04:13:34PM +0100, Chris Wilson wrote:
> >  	ret = ring->add_request(ring, &seqno);
> >  	if (ret)
> > -	    return ret;
> > +		return ret;
> > +
> > +	if (request == NULL) {
> > +		request = kmalloc(sizeof(*request), GFP_KERNEL);
> > +		if (request == NULL)
> > +			return -ENOMEM;
> > +	}
> 
> Hm, shouldn't we try to allocate the request struct before we emit the
> request? Otherwise looks good.

I considered the ordering immaterial so went with the cleanest error
path.

If the allocation fails after we add the breadcrumb, we will then reuse
the olr for further batches.... Oops.

I was wrong, it matters.
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre



More information about the Intel-gfx mailing list