drm/i915: Pull VM lists under the VM mutex.
A starting point to counter the pervasive struct_mutex. For the goal of avoiding (or at least blocking under them!) global locks during user request submission, a simple but important step is being able to manage each clients GTT separately. For which, we want to replace using the struct_mutex as the guard for all things GTT/VM and switch instead to a specific mutex inside i915_address_space. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/20190128102356.15037-2-chris@chris-wilson.co.uk
This commit is contained in:
@@ -213,7 +213,10 @@ vma_create(struct drm_i915_gem_object *obj,
|
||||
}
|
||||
rb_link_node(&vma->obj_node, rb, p);
|
||||
rb_insert_color(&vma->obj_node, &obj->vma_tree);
|
||||
|
||||
mutex_lock(&vm->mutex);
|
||||
list_add(&vma->vm_link, &vm->unbound_list);
|
||||
mutex_unlock(&vm->mutex);
|
||||
|
||||
return vma;
|
||||
|
||||
@@ -656,7 +659,9 @@ i915_vma_insert(struct i915_vma *vma, u64 size, u64 alignment, u64 flags)
|
||||
GEM_BUG_ON(!drm_mm_node_allocated(&vma->node));
|
||||
GEM_BUG_ON(!i915_gem_valid_gtt_space(vma, cache_level));
|
||||
|
||||
mutex_lock(&vma->vm->mutex);
|
||||
list_move_tail(&vma->vm_link, &vma->vm->bound_list);
|
||||
mutex_unlock(&vma->vm->mutex);
|
||||
|
||||
if (vma->obj) {
|
||||
struct drm_i915_gem_object *obj = vma->obj;
|
||||
@@ -689,8 +694,10 @@ i915_vma_remove(struct i915_vma *vma)
|
||||
|
||||
vma->ops->clear_pages(vma);
|
||||
|
||||
mutex_lock(&vma->vm->mutex);
|
||||
drm_mm_remove_node(&vma->node);
|
||||
list_move_tail(&vma->vm_link, &vma->vm->unbound_list);
|
||||
mutex_unlock(&vma->vm->mutex);
|
||||
|
||||
/*
|
||||
* Since the unbound list is global, only move to that list if
|
||||
@@ -802,7 +809,11 @@ static void __i915_vma_destroy(struct i915_vma *vma)
|
||||
GEM_BUG_ON(i915_gem_active_isset(&vma->last_fence));
|
||||
|
||||
list_del(&vma->obj_link);
|
||||
|
||||
mutex_lock(&vma->vm->mutex);
|
||||
list_del(&vma->vm_link);
|
||||
mutex_unlock(&vma->vm->mutex);
|
||||
|
||||
if (vma->obj)
|
||||
rb_erase(&vma->obj_node, &vma->obj->vma_tree);
|
||||
|
||||
|
Reference in New Issue
Block a user