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

Chris Wilson chris at chris-wilson.co.uk
Tue Mar 14 13:30:40 UTC 2017


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 at chris-wilson.co.uk>
> Cc: Ville Syrjälä <ville.syrjala at linux.intel.com>
> Signed-off-by: Mika Kuoppala <mika.kuoppala at intel.com>
> ---
>  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().

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

-- 
Chris Wilson, Intel Open Source Technology Centre


More information about the Intel-gfx mailing list