Re: [PATCH 5/7] drm/i915: Use cpu clock to calculate rc0 residency

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Mar 14, 2017 at 01:30:40PM +0000, Chris Wilson wrote:
> On Tue, Mar 14, 2017 at 03:17:27PM +0200, Mika Kuoppala wrote:
> > Avoid more costly punit access and use the local cpu clock.
> > The time diff between separate processor units is irrelevant in
> > our rc0 residency granularity so we can ignore it.
> > 
> > Cc: Chris Wilson <chris@xxxxxxxxxxxxxxxxxx>
> > Cc: Ville Syrjälä <ville.syrjala@xxxxxxxxxxxxxxx>
> > Signed-off-by: Mika Kuoppala <mika.kuoppala@xxxxxxxxx>
> > ---
> >  drivers/gpu/drm/i915/i915_drv.h |  2 +-
> >  drivers/gpu/drm/i915/i915_irq.c | 10 ++++------
> >  2 files changed, 5 insertions(+), 7 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
> > index 0023e21..70e335c 100644
> > --- a/drivers/gpu/drm/i915/i915_drv.h
> > +++ b/drivers/gpu/drm/i915/i915_drv.h
> > @@ -1323,7 +1323,7 @@ struct vlv_s0ix_state {
> >  };
> >  
> >  struct intel_rps_ei {
> > -	u32 cz_clock;
> > +	u64 cpu_clock;
> >  	u32 render_c0;
> >  	u32 media_c0;
> >  };
> > diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c
> > index 31f0d7c..00e7875 100644
> > --- a/drivers/gpu/drm/i915/i915_irq.c
> > +++ b/drivers/gpu/drm/i915/i915_irq.c
> > @@ -1076,7 +1076,7 @@ static void notify_ring(struct intel_engine_cs *engine)
> >  static void vlv_c0_read(struct drm_i915_private *dev_priv,
> >  			struct intel_rps_ei *ei)
> >  {
> > -	ei->cz_clock = vlv_punit_read(dev_priv, PUNIT_REG_CZ_TIMESTAMP);
> > +	ei->cpu_clock = local_clock();
> 
> local_clock() is specific to a single cpu.
> 
> ktime_t ktime_get().

Perhaps _raw() so that ntp adjustment doesn't change things
over time? But I guess it shouldn't matter all that much
either way.

> 
> ktime_to_ns(ktime_sub(now.cpu_clock, prev->cpu_clock));

There's no ktime_ns_delta() it seems. There is ktime_us_delta()
and ktime_ms_delta() if you don't need ns resolution.

-- 
Ville Syrjälä
Intel OTC
_______________________________________________
Intel-gfx mailing list
Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/intel-gfx




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux