mirror of https://gitee.com/openkylin/linux.git
drm/amdgpu: Revert "add mutex for ba_va->valids/invalids"
Not needed any more because we need to protect the elements on the list anyway. This reverts commit 38bf516c75b4ef0f5c716e05fa9baab7c52d6c39. Signed-off-by: Christian König <christian.koenig@amd.com> Reviewed-by: Chunming Zhou <david1.zhou@amd.com> Acked-by: Alex Deucher <alexander.deucher@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
This commit is contained in:
parent
2025021582
commit
32b41ac21f
|
@ -484,7 +484,6 @@ struct amdgpu_bo_va_mapping {
|
||||||
|
|
||||||
/* bo virtual addresses in a specific vm */
|
/* bo virtual addresses in a specific vm */
|
||||||
struct amdgpu_bo_va {
|
struct amdgpu_bo_va {
|
||||||
struct mutex mutex;
|
|
||||||
/* protected by bo being reserved */
|
/* protected by bo being reserved */
|
||||||
struct list_head bo_list;
|
struct list_head bo_list;
|
||||||
struct fence *last_pt_update;
|
struct fence *last_pt_update;
|
||||||
|
|
|
@ -1009,9 +1009,8 @@ int amdgpu_vm_clear_invalids(struct amdgpu_device *adev,
|
||||||
bo_va = list_first_entry(&vm->invalidated,
|
bo_va = list_first_entry(&vm->invalidated,
|
||||||
struct amdgpu_bo_va, vm_status);
|
struct amdgpu_bo_va, vm_status);
|
||||||
spin_unlock(&vm->status_lock);
|
spin_unlock(&vm->status_lock);
|
||||||
mutex_lock(&bo_va->mutex);
|
|
||||||
r = amdgpu_vm_bo_update(adev, bo_va, NULL);
|
r = amdgpu_vm_bo_update(adev, bo_va, NULL);
|
||||||
mutex_unlock(&bo_va->mutex);
|
|
||||||
if (r)
|
if (r)
|
||||||
return r;
|
return r;
|
||||||
|
|
||||||
|
@ -1055,7 +1054,7 @@ struct amdgpu_bo_va *amdgpu_vm_bo_add(struct amdgpu_device *adev,
|
||||||
INIT_LIST_HEAD(&bo_va->valids);
|
INIT_LIST_HEAD(&bo_va->valids);
|
||||||
INIT_LIST_HEAD(&bo_va->invalids);
|
INIT_LIST_HEAD(&bo_va->invalids);
|
||||||
INIT_LIST_HEAD(&bo_va->vm_status);
|
INIT_LIST_HEAD(&bo_va->vm_status);
|
||||||
mutex_init(&bo_va->mutex);
|
|
||||||
list_add_tail(&bo_va->bo_list, &bo->va);
|
list_add_tail(&bo_va->bo_list, &bo->va);
|
||||||
|
|
||||||
return bo_va;
|
return bo_va;
|
||||||
|
@ -1131,9 +1130,7 @@ int amdgpu_vm_bo_map(struct amdgpu_device *adev,
|
||||||
mapping->offset = offset;
|
mapping->offset = offset;
|
||||||
mapping->flags = flags;
|
mapping->flags = flags;
|
||||||
|
|
||||||
mutex_lock(&bo_va->mutex);
|
|
||||||
list_add(&mapping->list, &bo_va->invalids);
|
list_add(&mapping->list, &bo_va->invalids);
|
||||||
mutex_unlock(&bo_va->mutex);
|
|
||||||
interval_tree_insert(&mapping->it, &vm->va);
|
interval_tree_insert(&mapping->it, &vm->va);
|
||||||
|
|
||||||
/* Make sure the page tables are allocated */
|
/* Make sure the page tables are allocated */
|
||||||
|
@ -1215,7 +1212,7 @@ int amdgpu_vm_bo_unmap(struct amdgpu_device *adev,
|
||||||
bool valid = true;
|
bool valid = true;
|
||||||
|
|
||||||
saddr /= AMDGPU_GPU_PAGE_SIZE;
|
saddr /= AMDGPU_GPU_PAGE_SIZE;
|
||||||
mutex_lock(&bo_va->mutex);
|
|
||||||
list_for_each_entry(mapping, &bo_va->valids, list) {
|
list_for_each_entry(mapping, &bo_va->valids, list) {
|
||||||
if (mapping->it.start == saddr)
|
if (mapping->it.start == saddr)
|
||||||
break;
|
break;
|
||||||
|
@ -1229,12 +1226,10 @@ int amdgpu_vm_bo_unmap(struct amdgpu_device *adev,
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (&mapping->list == &bo_va->invalids) {
|
if (&mapping->list == &bo_va->invalids)
|
||||||
mutex_unlock(&bo_va->mutex);
|
|
||||||
return -ENOENT;
|
return -ENOENT;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
mutex_unlock(&bo_va->mutex);
|
|
||||||
list_del(&mapping->list);
|
list_del(&mapping->list);
|
||||||
interval_tree_remove(&mapping->it, &vm->va);
|
interval_tree_remove(&mapping->it, &vm->va);
|
||||||
trace_amdgpu_vm_bo_unmap(bo_va, mapping);
|
trace_amdgpu_vm_bo_unmap(bo_va, mapping);
|
||||||
|
@ -1280,8 +1275,8 @@ void amdgpu_vm_bo_rmv(struct amdgpu_device *adev,
|
||||||
interval_tree_remove(&mapping->it, &vm->va);
|
interval_tree_remove(&mapping->it, &vm->va);
|
||||||
kfree(mapping);
|
kfree(mapping);
|
||||||
}
|
}
|
||||||
|
|
||||||
fence_put(bo_va->last_pt_update);
|
fence_put(bo_va->last_pt_update);
|
||||||
mutex_destroy(&bo_va->mutex);
|
|
||||||
kfree(bo_va);
|
kfree(bo_va);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue