diff options
author | Chunming Zhou <David1.Zhou@amd.com> | 2016-04-24 22:28:24 -0400 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2016-05-11 12:31:14 -0400 |
commit | 444066b915c1b9d0aa4ec7b2d2bbe627e08bf7a6 (patch) | |
tree | 6c4ea3a9b09075a9c7ec4edfcec37939b93bb488 | |
parent | 2e726dc4b4e2dd3ae3fe675f9d3af88a2d593ee1 (diff) |
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: Chunming Zhou <David1.Zhou@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Monk Liu <monk.liu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c index 856116a874bb..e06d0661549f 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | |||
@@ -1454,6 +1454,7 @@ error_free_sched_entity: | |||
1454 | void amdgpu_vm_fini(struct amdgpu_device *adev, struct amdgpu_vm *vm) | 1454 | void amdgpu_vm_fini(struct amdgpu_device *adev, struct amdgpu_vm *vm) |
1455 | { | 1455 | { |
1456 | struct amdgpu_bo_va_mapping *mapping, *tmp; | 1456 | struct amdgpu_bo_va_mapping *mapping, *tmp; |
1457 | struct amdgpu_vm_id *id, *id_tmp; | ||
1457 | int i; | 1458 | int i; |
1458 | 1459 | ||
1459 | amd_sched_entity_fini(vm->entity.sched, &vm->entity); | 1460 | 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) | |||
1478 | amdgpu_bo_unref(&vm->page_directory); | 1479 | amdgpu_bo_unref(&vm->page_directory); |
1479 | fence_put(vm->page_directory_fence); | 1480 | fence_put(vm->page_directory_fence); |
1480 | 1481 | ||
1481 | for (i = 0; i < AMDGPU_MAX_RINGS; ++i) { | 1482 | mutex_lock(&adev->vm_manager.lock); |
1482 | struct amdgpu_vm_id *id = vm->ids[i]; | 1483 | list_for_each_entry_safe(id, id_tmp, &adev->vm_manager.ids_lru, |
1483 | 1484 | list) { | |
1484 | if (!id) | 1485 | if (!id) |
1485 | continue; | 1486 | continue; |
1486 | 1487 | if (atomic_long_read(&id->owner) == (long)vm) { | |
1487 | atomic_long_cmpxchg(&id->owner, (long)vm, 0); | 1488 | atomic_long_set(&id->owner, 0); |
1489 | id->pd_gpu_addr = 0; | ||
1490 | } | ||
1488 | } | 1491 | } |
1492 | mutex_unlock(&adev->vm_manager.lock); | ||
1489 | } | 1493 | } |
1490 | 1494 | ||
1491 | /** | 1495 | /** |