[Intel-gfx] [PATCH 2/4] drm/i915: Poison the request before emitting commands

Chris Wilson chris at chris-wilson.co.uk
Mon Apr 24 12:50:30 UTC 2017


On Mon, Apr 24, 2017 at 03:29:48PM +0300, Mika Kuoppala wrote:
> Chris Wilson <chris at chris-wilson.co.uk> writes:
> 
> > If we poison the request before we emit commands, it should be easier to
> > spot when we execute an uninitialised request.
> >
> > References: https://bugs.freedesktop.org/show_bug.cgi?id=100144
> > Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
> > ---
> >  drivers/gpu/drm/i915/intel_ringbuffer.c | 1 +
> >  1 file changed, 1 insertion(+)
> >
> > diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.c b/drivers/gpu/drm/i915/intel_ringbuffer.c
> > index 8c874996c617..1ec98851a621 100644
> > --- a/drivers/gpu/drm/i915/intel_ringbuffer.c
> > +++ b/drivers/gpu/drm/i915/intel_ringbuffer.c
> > @@ -1693,6 +1693,7 @@ u32 *intel_ring_begin(struct drm_i915_gem_request *req, int num_dwords)
> >  
> >  	GEM_BUG_ON(ring->emit > ring->size - bytes);
> >  	cs = ring->vaddr + ring->emit;
> > +	GEM_DEBUG_EXEC(memset(cs, POISON_INUSE, bytes));
> 
> Will more modern hardware just skipover these? If so
> then perhaps more advanced solution would be to fill with bb
> start into the previous address to get a guaranteed
> hang on the spot.

It's not so much the expectation that the value will cause a hang, but
that the value is much more recognisable when diagnosing after something
goes wrong. Such as we do write a complete LRI but forget the value, the
command is correct and so no harm caused, but we may spot the poison
later on.
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre


More information about the Intel-gfx mailing list