Re: [PATCH] drm/i915/pmu: Skip busyness sampling when and where not needed

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

 



Quoting Tvrtko Ursulin (2019-09-11 17:07:30)
> From: Tvrtko Ursulin <tvrtko.ursulin@xxxxxxxxx>
> 
> Since d0aa694b9239 ("drm/i915/pmu: Always sample an active ringbuffer")
> the cost of sampling the engine state on execlists platforms became a
> little bit higher when both engine busyness and one of the wait states are
> being monitored. (Previously the busyness sampling on legacy platforms was
> done via seqno comparison so there was no cost of mmio read.)
> 
> We can avoid that by skipping busyness sampling when engine supports
> software busy stats and so avoid the cost of potential mmio read and
> sample accumulation.
> 
> Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@xxxxxxxxx>
> Cc: Chris Wilson <chris@xxxxxxxxxxxxxxxxxx>
> ---
>  drivers/gpu/drm/i915/i915_pmu.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/drivers/gpu/drm/i915/i915_pmu.c b/drivers/gpu/drm/i915/i915_pmu.c
> index 8e251e719390..623ad32303a1 100644
> --- a/drivers/gpu/drm/i915/i915_pmu.c
> +++ b/drivers/gpu/drm/i915/i915_pmu.c
> @@ -194,6 +194,10 @@ engines_sample(struct intel_gt *gt, unsigned int period_ns)
>                 if (val & RING_WAIT_SEMAPHORE)
>                         add_sample(&pmu->sample[I915_SAMPLE_SEMA], period_ns);
>  
> +               /* No need to sample when busy stats are supported. */
> +               if (intel_engine_supports_stats(engine))
> +                       goto skip;
> +

Reviewed-by: Chris Wilson <chris@xxxxxxxxxxxxxxxxxx>

I was worried we were double accounting, but later on we
have

if (intel_engine_supports_stats())
	val = ktime_to_ns(intel_engine_get_busy_time());
else
	val = engine->pmu.sample[sample].cur;

so indeed, this is just wasted effort.
-Chris
_______________________________________________
Intel-gfx mailing list
Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/intel-gfx




[Index of Archives]     [AMD Graphics]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux