[Intel-gfx] [PATCH] drm/i915: Hold struct_mutex for per-file stats in debugfs/i915_gem_object
Chris Wilson
chris at chris-wilson.co.uk
Wed Jun 21 09:28:10 UTC 2017
Quoting Tvrtko Ursulin (2017-06-21 10:22:00)
>
> On 17/06/2017 12:57, Chris Wilson wrote:
> > @@ -476,6 +478,8 @@ static int i915_gem_object_info(struct seq_file *m, void *data)
> > struct drm_i915_gem_request *request;
> > struct task_struct *task;
> >
> > + mutex_lock(&dev->struct_mutex);
>
> Could have put it just before the spin_lock for maximum OCD but doesn't
> matter. ;)
I was thinking that because it now covered a couple of locks, it should
have some whitespace between itself and those other locks so that it
didn't look coupled to either.
> > +
> > memset(&stats, 0, sizeof(stats));
> > stats.file_priv = file->driver_priv;
> > spin_lock(&file->table_lock);
> > @@ -487,7 +491,6 @@ static int i915_gem_object_info(struct seq_file *m, void *data)
> > * still alive (e.g. get_pid(current) => fork() => exit()).
> > * Therefore, we need to protect this ->comm access using RCU.
> > */
> > - mutex_lock(&dev->struct_mutex);
> > request = list_first_entry_or_null(&file_priv->mm.request_list,
> > struct drm_i915_gem_request,
> > client_link);
> > @@ -497,6 +500,7 @@ static int i915_gem_object_info(struct seq_file *m, void *data)
> > PIDTYPE_PID);
> > print_file_stats(m, task ? task->comm : "<unknown>", stats);
> > rcu_read_unlock();
> > +
> > mutex_unlock(&dev->struct_mutex);
> > }
> > mutex_unlock(&dev->filelist_mutex);
> >
>
> Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin at intel.com>
Much appreciated, pushed.
-Chris
More information about the Intel-gfx
mailing list