Skip to content

Commit 5a37be4

Browse files
committed
Merge branch 'drm-fixes' of git://people.freedesktop.org/~airlied/linux
Pull drm fixes from Dave Airlie: "This is the final set of fixes for -rc8, just a few i915 and one vmwgfx ones. I'm off on holidays for a week, so if anything shows up for fixes I've asked Daniel or Sean Paul to herd it in the right direction" [ The additional etnaviv fixes were already herded towards me as seen in my previous pull - Linus ] * 'drm-fixes' of git://people.freedesktop.org/~airlied/linux: drm/vmwgfx: Free hash table allocated by cmdbuf managed res mgr drm/i915: Disable EXEC_OBJECT_ASYNC when doing relocations drm/i915: Hold struct_mutex for per-file stats in debugfs/i915_gem_object drm/i915: Retire the VMA's fence tracker before unbinding
2 parents cf72349 + 9ff1beb commit 5a37be4

File tree

4 files changed

+25
-4
lines changed

4 files changed

+25
-4
lines changed

drivers/gpu/drm/i915/i915_debugfs.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,8 @@ static int per_file_stats(int id, void *ptr, void *data)
292292
struct file_stats *stats = data;
293293
struct i915_vma *vma;
294294

295+
lockdep_assert_held(&obj->base.dev->struct_mutex);
296+
295297
stats->count++;
296298
stats->total += obj->base.size;
297299
if (!obj->bind_count)
@@ -476,6 +478,8 @@ static int i915_gem_object_info(struct seq_file *m, void *data)
476478
struct drm_i915_gem_request *request;
477479
struct task_struct *task;
478480

481+
mutex_lock(&dev->struct_mutex);
482+
479483
memset(&stats, 0, sizeof(stats));
480484
stats.file_priv = file->driver_priv;
481485
spin_lock(&file->table_lock);
@@ -487,7 +491,6 @@ static int i915_gem_object_info(struct seq_file *m, void *data)
487491
* still alive (e.g. get_pid(current) => fork() => exit()).
488492
* Therefore, we need to protect this ->comm access using RCU.
489493
*/
490-
mutex_lock(&dev->struct_mutex);
491494
request = list_first_entry_or_null(&file_priv->mm.request_list,
492495
struct drm_i915_gem_request,
493496
client_link);
@@ -497,6 +500,7 @@ static int i915_gem_object_info(struct seq_file *m, void *data)
497500
PIDTYPE_PID);
498501
print_file_stats(m, task ? task->comm : "<unknown>", stats);
499502
rcu_read_unlock();
503+
500504
mutex_unlock(&dev->struct_mutex);
501505
}
502506
mutex_unlock(&dev->filelist_mutex);

drivers/gpu/drm/i915/i915_gem_execbuffer.c

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -546,11 +546,12 @@ relocate_entry(struct drm_i915_gem_object *obj,
546546
}
547547

548548
static int
549-
i915_gem_execbuffer_relocate_entry(struct drm_i915_gem_object *obj,
549+
i915_gem_execbuffer_relocate_entry(struct i915_vma *vma,
550550
struct eb_vmas *eb,
551551
struct drm_i915_gem_relocation_entry *reloc,
552552
struct reloc_cache *cache)
553553
{
554+
struct drm_i915_gem_object *obj = vma->obj;
554555
struct drm_i915_private *dev_priv = to_i915(obj->base.dev);
555556
struct drm_gem_object *target_obj;
556557
struct drm_i915_gem_object *target_i915_obj;
@@ -628,6 +629,16 @@ i915_gem_execbuffer_relocate_entry(struct drm_i915_gem_object *obj,
628629
return -EINVAL;
629630
}
630631

632+
/*
633+
* If we write into the object, we need to force the synchronisation
634+
* barrier, either with an asynchronous clflush or if we executed the
635+
* patching using the GPU (though that should be serialised by the
636+
* timeline). To be completely sure, and since we are required to
637+
* do relocations we are already stalling, disable the user's opt
638+
* of our synchronisation.
639+
*/
640+
vma->exec_entry->flags &= ~EXEC_OBJECT_ASYNC;
641+
631642
ret = relocate_entry(obj, reloc, cache, target_offset);
632643
if (ret)
633644
return ret;
@@ -678,7 +689,7 @@ i915_gem_execbuffer_relocate_vma(struct i915_vma *vma,
678689
do {
679690
u64 offset = r->presumed_offset;
680691

681-
ret = i915_gem_execbuffer_relocate_entry(vma->obj, eb, r, &cache);
692+
ret = i915_gem_execbuffer_relocate_entry(vma, eb, r, &cache);
682693
if (ret)
683694
goto out;
684695

@@ -726,7 +737,7 @@ i915_gem_execbuffer_relocate_vma_slow(struct i915_vma *vma,
726737

727738
reloc_cache_init(&cache, eb->i915);
728739
for (i = 0; i < entry->relocation_count; i++) {
729-
ret = i915_gem_execbuffer_relocate_entry(vma->obj, eb, &relocs[i], &cache);
740+
ret = i915_gem_execbuffer_relocate_entry(vma, eb, &relocs[i], &cache);
730741
if (ret)
731742
break;
732743
}

drivers/gpu/drm/i915/i915_vma.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -650,6 +650,11 @@ int i915_vma_unbind(struct i915_vma *vma)
650650
break;
651651
}
652652

653+
if (!ret) {
654+
ret = i915_gem_active_retire(&vma->last_fence,
655+
&vma->vm->i915->drm.struct_mutex);
656+
}
657+
653658
__i915_vma_unpin(vma);
654659
if (ret)
655660
return ret;

drivers/gpu/drm/vmwgfx/vmwgfx_cmdbuf_res.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -321,6 +321,7 @@ void vmw_cmdbuf_res_man_destroy(struct vmw_cmdbuf_res_manager *man)
321321
list_for_each_entry_safe(entry, next, &man->list, head)
322322
vmw_cmdbuf_res_free(man, entry);
323323

324+
drm_ht_remove(&man->resources);
324325
kfree(man);
325326
}
326327

0 commit comments

Comments
 (0)