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