[Intel-gfx] [PATCH 07/10] drm/i915: Restructure priority inheritance
Chris Wilson
chris at chris-wilson.co.uk
Tue Jan 26 19:03:13 UTC 2021
Quoting Andi Shyti (2021-01-26 17:18:22)
> Hi Chris,
>
> > + local_bh_disable();
> > + i915_request_set_priority(rq, prio);
> > + local_bh_enable();
> > +
> > + i915_request_put(rq);
> > + rq = ptr_mask_bits(rn, 1);
>
> why are you using ptr_mask_bits here?
>
> > + } while (rq);
> > +}
> > +
> > +void i915_sched_init_ipi(struct i915_sched_ipi *ipi)
> > +{
> > + INIT_WORK(&ipi->work, ipi_schedule);
> > + ipi->list = NULL;
> > +}
> > +
> > +static void __ipi_add(struct i915_request *rq)
> > +{
> > +#define STUB ((struct i915_request *)1)
> > + struct intel_engine_cs *engine = READ_ONCE(rq->engine);
> > + struct i915_request *first;
> > +
> > + if (!i915_request_get_rcu(rq))
> > + return;
> > +
> > + if (__i915_request_is_complete(rq) ||
> > + cmpxchg(&rq->sched.ipi_link, NULL, STUB)) { /* already queued */
> > + i915_request_put(rq);
> > + return;
> > + }
> > +
> > + first = READ_ONCE(engine->execlists.ipi.list);
> > + do
> > + rq->sched.ipi_link = ptr_pack_bits(first, 1, 1);
>
> ... and why ptr_pack_bits here?
>
> do they make any difference?
We are using bit0 to differentiate against NULL. So we use the special
value of (void*)1 to mark when the elements is active, but pointing to
nothing.
-Chris
More information about the Intel-gfx
mailing list