[Intel-gfx] [RFC 11/14] drm/i915: Engine busy time tracking

Chris Wilson chris at chris-wilson.co.uk
Tue Jul 18 15:19:08 UTC 2017


Quoting Tvrtko Ursulin (2017-07-18 15:36:15)
> From: Tvrtko Ursulin <tvrtko.ursulin at intel.com>
> 
> Track total time requests have been executing on the hardware.
> 
> To make this cheap it is hidden behind a static branch with the
> intention that it is only enabled when there is a consumer
> listening. This means that in the default off case the total
> cost of the tracking is just a few no-op instructions on the
> fast paths.

> +static inline void intel_engine_context_in(struct intel_engine_cs *engine)
> +{
> +       if (static_branch_unlikely(&i915_engine_stats_key)) {
> +               unsigned long flags;
> +
> +               spin_lock_irqsave(&engine->stats.lock, flags);

What's the purpose of this lock? RMW is ordered by virtue of the tasklet
(only one cpu can be doing the rmw at any time). Did I miss another
user?

> +               if (engine->stats.ref++ == 0)
> +                       engine->stats.start = ktime_get_real_ns();

Use ktime_get_raw() and leave the conversion to ns to the caller.
What is the cost of a ktime nowadays?

How do you handle the currently active case when reporting? Imagine a
continuous stream of requests, hoping between contexts without a
break.
-Chris


More information about the Intel-gfx mailing list