Re: [RFC 1/5] drm/i915: Track per-context engine busyness

Chris Wilson
2018-02-14T19:07:28Z

Quoting Tvrtko Ursulin (2018-02-14 18:50:31)
> +ktime_t intel_context_engine_get_busy_time(struct i915_gem_context *ctx,
> + struct intel_engine_cs *engine)
> +{
> + struct intel_context *ce = &ctx->engine[engine->id];
> + ktime_t total;
> +
> + spin_lock_irq(&ce->stats.lock);
> +
> + total = ce->stats.total;
> +
> + if (ce->stats.active)
> + total = ktime_add(total,
> + ktime_sub(ktime_get(), ce->stats.start));
> +
> + spin_unlock_irq(&ce->stats.lock);

Looks like we can just use a seqlock here.
-Chris