提交 444066b9 编写于 作者: C Chunming Zhou 提交者: Alex Deucher

drm/amdgpu: fix wrong release of vmid owner

The release of the vmid owner was not handled
correctly.  We need to take the lock and walk
the lru list.
Signed-off-by: NChunming Zhou <David1.Zhou@amd.com>
Reviewed-by: NAlex Deucher <alexander.deucher@amd.com>
Reviewed-by: NMonk Liu <monk.liu@amd.com>
Signed-off-by: NAlex Deucher <alexander.deucher@amd.com>
上级 2e726dc4
......@@ -1454,6 +1454,7 @@ int amdgpu_vm_init(struct amdgpu_device *adev, struct amdgpu_vm *vm)
void amdgpu_vm_fini(struct amdgpu_device *adev, struct amdgpu_vm *vm)
{
struct amdgpu_bo_va_mapping *mapping, *tmp;
struct amdgpu_vm_id *id, *id_tmp;
int i;
amd_sched_entity_fini(vm->entity.sched, &vm->entity);
......@@ -1478,14 +1479,17 @@ void amdgpu_vm_fini(struct amdgpu_device *adev, struct amdgpu_vm *vm)
amdgpu_bo_unref(&vm->page_directory);
fence_put(vm->page_directory_fence);
for (i = 0; i < AMDGPU_MAX_RINGS; ++i) {
struct amdgpu_vm_id *id = vm->ids[i];
mutex_lock(&adev->vm_manager.lock);
list_for_each_entry_safe(id, id_tmp, &adev->vm_manager.ids_lru,
list) {
if (!id)
continue;
atomic_long_cmpxchg(&id->owner, (long)vm, 0);
if (atomic_long_read(&id->owner) == (long)vm) {
atomic_long_set(&id->owner, 0);
id->pd_gpu_addr = 0;
}
}
mutex_unlock(&adev->vm_manager.lock);
}
/**
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册