[Intel-gfx] [PATCH] drm/i915: Assert that the context pin_counts do not overflow

Chris Wilson chris at chris-wilson.co.uk
Thu Mar 16 16:30:02 UTC 2017


On Thu, Mar 16, 2017 at 06:27:16PM +0200, Mika Kuoppala wrote:
> Chris Wilson <chris at chris-wilson.co.uk> writes:
> 
> > This should be impossible, but let's assert that we do not pin a context
> > 4 billion times before retiring!
> >
> > Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
> > Cc: Tvrtko Ursulin <tvrtko.ursulin at linux.intel.com>
> > Cc: Joonas Lahtinen <joonas.lahtinen at linux.intel.com>
> > ---
> >  drivers/gpu/drm/i915/intel_lrc.c        | 1 +
> >  drivers/gpu/drm/i915/intel_ringbuffer.c | 1 +
> >  2 files changed, 2 insertions(+)
> >
> > diff --git a/drivers/gpu/drm/i915/intel_lrc.c b/drivers/gpu/drm/i915/intel_lrc.c
> > index 32ec06245281..77574dfc48ef 100644
> > --- a/drivers/gpu/drm/i915/intel_lrc.c
> > +++ b/drivers/gpu/drm/i915/intel_lrc.c
> > @@ -747,6 +747,7 @@ static int execlists_context_pin(struct intel_engine_cs *engine,
> >  
> >  	if (ce->pin_count++)
> >  		return 0;
> > +	GEM_BUG_ON(ce->pin_count); /* no overflow please! */
> >
> 
> !ce->pin_count?
You might be right ;)
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre


More information about the Intel-gfx mailing list