drm/amdgpu: Revert "add spin lock to protect freed list in vm (v3)"
authorChristian König <christian.koenig@amd.com>
Tue, 8 Mar 2016 16:52:01 +0000 (17:52 +0100)
committerAlex Deucher <alexander.deucher@amd.com>
Wed, 9 Mar 2016 18:04:01 +0000 (13:04 -0500)
Not needed any more because we need to protect the elements on the list anyway.

This reverts commit dae6ecf9e6c9b677e577826c3ac665c6dd9c490b.

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>
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c

index 330e307c36ed67575f62f6ff9f7c9bb8c96a56cc..7e73e54eadb9839963082298cf4cd1ddd59247d0 100644 (file)
@@ -971,22 +971,18 @@ int amdgpu_vm_clear_freed(struct amdgpu_device *adev,
        struct amdgpu_bo_va_mapping *mapping;
        int r;
 
-       spin_lock(&vm->freed_lock);
        while (!list_empty(&vm->freed)) {
                mapping = list_first_entry(&vm->freed,
                        struct amdgpu_bo_va_mapping, list);
                list_del(&mapping->list);
-               spin_unlock(&vm->freed_lock);
+
                r = amdgpu_vm_bo_split_mapping(adev, NULL, 0, vm, mapping,
                                               0, NULL);
                kfree(mapping);
                if (r)
                        return r;
 
-               spin_lock(&vm->freed_lock);
        }
-       spin_unlock(&vm->freed_lock);
-
        return 0;
 
 }
@@ -1252,13 +1248,10 @@ int amdgpu_vm_bo_unmap(struct amdgpu_device *adev,
        spin_unlock(&vm->it_lock);
        trace_amdgpu_vm_bo_unmap(bo_va, mapping);
 
-       if (valid) {
-               spin_lock(&vm->freed_lock);
+       if (valid)
                list_add(&mapping->list, &vm->freed);
-               spin_unlock(&vm->freed_lock);
-       } else {
+       else
                kfree(mapping);
-       }
 
        return 0;
 }
@@ -1291,9 +1284,7 @@ void amdgpu_vm_bo_rmv(struct amdgpu_device *adev,
                interval_tree_remove(&mapping->it, &vm->va);
                spin_unlock(&vm->it_lock);
                trace_amdgpu_vm_bo_unmap(bo_va, mapping);
-               spin_lock(&vm->freed_lock);
                list_add(&mapping->list, &vm->freed);
-               spin_unlock(&vm->freed_lock);
        }
        list_for_each_entry_safe(mapping, next, &bo_va->invalids, list) {
                list_del(&mapping->list);
@@ -1357,7 +1348,6 @@ int amdgpu_vm_init(struct amdgpu_device *adev, struct amdgpu_vm *vm)
        INIT_LIST_HEAD(&vm->cleared);
        INIT_LIST_HEAD(&vm->freed);
        spin_lock_init(&vm->it_lock);
-       spin_lock_init(&vm->freed_lock);
        pd_size = amdgpu_vm_directory_size(adev);
        pd_entries = amdgpu_vm_num_pdes(adev);