@@ -292,6 +292,8 @@ static int per_file_stats(int id, void *ptr, void *data)
292
292
struct file_stats * stats = data ;
293
293
struct i915_vma * vma ;
294
294
295
+ lockdep_assert_held (& obj -> base .dev -> struct_mutex );
296
+
295
297
stats -> count ++ ;
296
298
stats -> total += obj -> base .size ;
297
299
if (!obj -> bind_count )
@@ -476,6 +478,8 @@ static int i915_gem_object_info(struct seq_file *m, void *data)
476
478
struct drm_i915_gem_request * request ;
477
479
struct task_struct * task ;
478
480
481
+ mutex_lock (& dev -> struct_mutex );
482
+
479
483
memset (& stats , 0 , sizeof (stats ));
480
484
stats .file_priv = file -> driver_priv ;
481
485
spin_lock (& file -> table_lock );
@@ -487,7 +491,6 @@ static int i915_gem_object_info(struct seq_file *m, void *data)
487
491
* still alive (e.g. get_pid(current) => fork() => exit()).
488
492
* Therefore, we need to protect this ->comm access using RCU.
489
493
*/
490
- mutex_lock (& dev -> struct_mutex );
491
494
request = list_first_entry_or_null (& file_priv -> mm .request_list ,
492
495
struct drm_i915_gem_request ,
493
496
client_link );
@@ -497,6 +500,7 @@ static int i915_gem_object_info(struct seq_file *m, void *data)
497
500
PIDTYPE_PID );
498
501
print_file_stats (m , task ? task -> comm : "<unknown>" , stats );
499
502
rcu_read_unlock ();
503
+
500
504
mutex_unlock (& dev -> struct_mutex );
501
505
}
502
506
mutex_unlock (& dev -> filelist_mutex );
0 commit comments