[Intel-gfx] [RFC 5/5] drm/i915: Add sysfs toggle to enable per-client engine stats

Chris Wilson chris at chris-wilson.co.uk
Fri Oct 25 14:49:06 UTC 2019


Quoting Tvrtko Ursulin (2019-10-25 15:21:31)
> +       ret = i915_mutex_lock_interruptible(&i915->drm);
> +       if (ret)
> +               return ret;
> +
> +       if (val && !i915->clients.stats.enabled)
> +               enable = true;
> +       else if (!val && i915->clients.stats.enabled)
> +               disable = true;

The struct_mutex is just for atomically enabling/disabling stats, right?
Only one user may toggle status at a time.

I'd wrap it a i915->spinlock just so the locking is clear from the
outset.

> +       if (!enable && !disable)
> +               goto out;
> +
> +       for_each_engine(engine, i915, id) {

A quick s/for_each_engine/for_each_uabi_engine/

> +               if (enable)
> +                       WARN_ON_ONCE(intel_enable_engine_stats(engine));
> +               else if (disable)
> +                       intel_disable_engine_stats(engine);
> +       }
> +
> +       i915->clients.stats.enabled = val;

Now as for whether we want a toggle approach, or only while the file is
open (and refcount)?
-Chris


More information about the Intel-gfx mailing list