[Intel-gfx] [RFC 12/14] drm/i915: Interface for controling engine stats collection
Chris Wilson
chris at chris-wilson.co.uk
Tue Jul 18 15:43:00 UTC 2017
Quoting Tvrtko Ursulin (2017-07-18 15:36:16)
> +int intel_enable_engine_stats(struct drm_i915_private *dev_priv)
> +{
> + if (!i915.enable_execlists)
> + return -ENODEV;
> +
> + mutex_lock(&i915_engine_stats_mutex);
> + if (i915_engine_stats_ref++ == 0) {
> + struct intel_engine_cs *engine;
> + enum intel_engine_id id;
> +
> + for_each_engine(engine, dev_priv, id) {
> + memset(&engine->stats, 0, sizeof(engine->stats));
> + spin_lock_init(&engine->stats.lock);
> + }
> +
> + static_branch_enable(&i915_engine_stats_key);
> + }
> + mutex_unlock(&i915_engine_stats_mutex);
I don't think static_branch_enable() is a might_sleep, so it looks like
you can rewrite this avoiding the mutex and thus not requiring the
worker and then can use the error code here to decide if you need to
use the timer instead.
-Chris
More information about the Intel-gfx
mailing list