[Intel-gfx] [PATCH] drm/i915/execlists: Cache ELSP register offset

Chris Wilson chris at chris-wilson.co.uk
Thu Dec 7 22:23:22 UTC 2017


Quoting Michel Thierry (2017-12-07 22:19:05)
> On 07/12/17 12:45, Chris Wilson wrote:
> > Currently on every submission, we recalculate the ELSP register offset
> > for the engine, after chasing the pointers to find the iomem base. Since
> > this is fixed for the lifetime of the driver record the offset in the
> > execlists struct.
> > 
> > In practice the difference is negligible, it just happens to remove 27
> > bytes of eyesore pointer dancing from next to the hottest instruction
> > (which is itself due to stalling for a cache miss) in perf profiles of
> > the execlists_submission_tasklet().
> > 
> > Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
> > Cc: Tvrtko Ursulin <tvrtko.ursulin at intel.com>
> > Cc: Mika Kuoppala <mika.kuoppala at linux.intel.com>
> > ---
> >   drivers/gpu/drm/i915/intel_lrc.c        | 12 ++++++------
> >   drivers/gpu/drm/i915/intel_ringbuffer.h |  5 +++++
> >   2 files changed, 11 insertions(+), 6 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/i915/intel_lrc.c b/drivers/gpu/drm/i915/intel_lrc.c
> > index 2a8160f603ab..93b5ce6307af 100644
> > --- a/drivers/gpu/drm/i915/intel_lrc.c
> > +++ b/drivers/gpu/drm/i915/intel_lrc.c
> > @@ -431,8 +431,7 @@ static inline void elsp_write(u64 desc, u32 __iomem *elsp)
> >   static void execlists_submit_ports(struct intel_engine_cs *engine)
> >   {
> >          struct execlist_port *port = engine->execlists.port;
> > -       u32 __iomem *elsp =
> > -               engine->i915->regs + i915_mmio_reg_offset(RING_ELSP(engine));
> > +       u32 __iomem *elsp = engine->execlists.elsp;
> >          unsigned int n;
> > 
> >          for (n = execlists_num_ports(&engine->execlists); n--; ) {
> 
> Since you're moving this, probably it can now use engine->execlists.elsp 
> directly (as inject_preempt_context does), i.e.:

In fact, gcc prefers it. Odd that it generates different code at all, I
wonder what it is actually doing...
-Chris


More information about the Intel-gfx mailing list