[Intel-gfx] [PATCH 1/2] drm/i915: signal first fence from irq handler if complete
Chris Wilson
chris at chris-wilson.co.uk
Wed Feb 22 18:09:30 UTC 2017
On Wed, Feb 22, 2017 at 04:53:35PM +0000, Tvrtko Ursulin wrote:
>
> On 17/02/2017 15:51, Chris Wilson wrote:
> > if (engine->irq_seqno_barrier &&
> >- rcu_access_pointer(engine->breadcrumbs.irq_seqno_bh) == current &&
> > test_and_clear_bit(ENGINE_IRQ_BREADCRUMB, &engine->irq_posted)) {
> >- struct task_struct *tsk;
> >+ unsigned long flags;
> >
> > /* The ordering of irq_posted versus applying the barrier
> > * is crucial. The clearing of the current irq_posted must
> >@@ -4058,17 +4061,17 @@ __i915_request_irq_complete(const struct drm_i915_gem_request *req)
> > * the seqno before we believe it coherent since they see
> > * irq_posted == false but we are still running).
> > */
> >- rcu_read_lock();
> >- tsk = rcu_dereference(engine->breadcrumbs.irq_seqno_bh);
> >- if (tsk && tsk != current)
> >+ spin_lock_irqsave(&engine->breadcrumbs.lock, flags);
> >+ if (engine->breadcrumbs.first_wait &&
> >+ engine->breadcrumbs.first_wait->tsk != current)
> > /* Note that if the bottom-half is changed as we
> > * are sending the wake-up, the new bottom-half will
> > * be woken by whomever made the change. We only have
> > * to worry about when we steal the irq-posted for
> > * ourself.
> > */
> >- wake_up_process(tsk);
> >- rcu_read_unlock();
> >+ wake_up_process(engine->breadcrumbs.first_wait->tsk);
> >+ spin_unlock_irqrestore(&engine->breadcrumbs.lock, flags);
>
> Worth caching &engine->breadcrumbs maybe?
Makes no difference to object code, but makes it more pleasant to read,
so yes.
-Chris
--
Chris Wilson, Intel Open Source Technology Centre
More information about the Intel-gfx
mailing list