Re: [PATCH v10 5/9] drm/i915: Engine busy time tracking

Chris Wilson
2017-10-17T11:07:33Z

Quoting Tvrtko Ursulin (2017-10-17 11:46:21)
> From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
>
> Track total time requests have been executing on the hardware.
>
> We add new kernel API to allow software tracking of time GPU
> engines are spending executing requests.
>
> Both per-engine and global API is added with the latter also
> being exported for use by external users.
>
> v2:
> * Squashed with the internal API.
> * Dropped static key.
> * Made per-engine.
> * Store time in monotonic ktime.
>
> v3: Moved stats clearing to disable.
>
> v4:
> * Comments.
> * Don't export the API just yet.
>
> v5: Whitespace cleanup.
>
> v6:
> * Rename ref to active.
> * Drop engine aggregate stats for now.
> * Account initial busy period after enabling stats.
>
> v7:
> * Rebase.
>
> v8:
> * Move context in notification after the notifier. (Chris Wilson)
>
> v9:
>
> In cases where stats tracking is getting disabled while there is
> an active context on an engine, add up the current value to the
> total. This also implies we don't clear the total when tracking
> is disabled any longer. There is no real need to do so because
> we define the stats as relative while enabled, meaning
> comparison between two samples while tracking is enabled is the
> valid usage. However, when busy stats will later be plugged into
> the perf PMU API, it is beneficial to not reset the total, since
> the PMU core likes to do some counter disable/enable cycles on
> startup, and while doing so during a single long context
> executing on an engine we would lose some accuracy and so make
> unit testing more difficult than needs to be.

Ok, so it's a counter since boot and not reset on every pmu reload.
We anticipate users are going to be doing (sampleB - sampleA)/delta_time
so they aren't concerned with absolute values, just deltas.

> v10:
> * Fix accounting for preemption.
>
> Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk> (v8)
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
-Chris