[Intel-gfx] [PATCH] drm/i915: Take reference for signaling the request from hardirq

Chris Wilson chris at chris-wilson.co.uk
Fri Mar 3 14:57:48 UTC 2017


On Fri, Mar 03, 2017 at 02:52:59PM +0000, Chris Wilson wrote:
> On Fri, Mar 03, 2017 at 02:45:57PM +0000, Chris Wilson wrote:
> > ---
> >  drivers/gpu/drm/i915/i915_irq.c | 10 ++++------
> >  1 file changed, 4 insertions(+), 6 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c
> > index 5fa2c4c56b09..73ab5abf20d7 100644
> > --- a/drivers/gpu/drm/i915/i915_irq.c
> > +++ b/drivers/gpu/drm/i915/i915_irq.c
> > @@ -1039,8 +1039,6 @@ static void notify_ring(struct intel_engine_cs *engine)
> >  	atomic_inc(&engine->irq_count);
> >  	set_bit(ENGINE_IRQ_BREADCRUMB, &engine->irq_posted);
> >  
> > -	rcu_read_lock();
> > -
> >  	spin_lock(&engine->breadcrumbs.lock);
> >  	wait = engine->breadcrumbs.first_wait;
> >  	if (wait) {
> > @@ -1057,7 +1055,7 @@ static void notify_ring(struct intel_engine_cs *engine)
> >  		 */
> >  		if (i915_seqno_passed(intel_engine_get_seqno(engine),
> >  				      wait->seqno))
> > -			rq = wait->request;
> > +			rq = i915_gem_request_get(wait->request);
> >  
> >  		wake_up_process(wait->tsk);
> >  	} else {
> > @@ -1065,10 +1063,10 @@ static void notify_ring(struct intel_engine_cs *engine)
> >  	}
> >  	spin_unlock(&engine->breadcrumbs.lock);
> >  
> > -	if (rq)
> > +	if (rq) {
> >  		dma_fence_signal(&rq->fence);
> > -
> > -	rcu_read_unlock();
> > +		i915_gem_request_put(rq);
> > +	}
> 
> The alternative would be to place spin_unlock_wait() in
> i915_fence_release. The advantages of that will be avoiding the extra
> work inside the interrupt handler.

That's not enough as there's an open window before we acquire the
fence->lock.
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre


More information about the Intel-gfx mailing list