Re: [RFC 00/17] Per-context and per-client engine busyness

Chris Wilson
2017-10-25T15:47:18Z

Quoting Tvrtko Ursulin (2017-10-25 16:36:15)
> From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
>
> Lightly tested (apart from patch 13) series to start the discussion early.
>
> Please skip patches 1-9, and probably 10-11 as well, those ones are the current
> PMU effort which is yet unmerged but needed as a basis for patches 12-17.
>
> Customer ask is to allow clients to query how much GPU engine time they are
> using per context.
>
> In patch 12 I add this, and then patch 13 I expose it via the context get param.
> (It feels like a slight misuse of get param though.)
>
> Patches 14-17 are not a customer ask as far as I know, but something I thought
> would be pretty cool. Basically bringing the ability to write a CPU top-like
> utility for GPU tasks.
>
> I've prototyped a quick demo of intel-client-top which produces output like:
>
> neverball[ 6011]: rcs0: 41.01% bcs0: 0.00% vcs0: 0.00% vecs0: 0.00%
> Xorg[ 5664]: rcs0: 31.16% bcs0: 0.00% vcs0: 0.00% vecs0: 0.00%
> xfwm4[ 5727]: rcs0: 0.00% bcs0: 0.00% vcs0: 0.00% vecs0: 0.00%

+1
+2 for a graph ;)

> As I say in the commit we could also extend this to show the overall engine
> busyness (via PMU), and also average load as queue-depth (also PMU), in the top
> header.
>
> Another potential use for the per-client infrastructure is tieing it up with
> perf PMU. At the moment our perf PMU are global counters only. With the per-
> client infrastructure it should be possible to make it work in the task mode as
> well and so enable GPU busyness profiling of single tasks.

ctx->pid can be misleading, as it set on creation, but the context can
be transferred over fd to the real client. (Typically that applies to
the default context, 0.)

In the back of my head, I thought we would need add-ctx, rm-ctx events
for PMU, sort of like how perf tracks new processes and mmaps.
-Chris