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
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

Reply via email to