summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
diff options
context:
space:
mode:
authormonk.liu <monk.liu@amd.com>2015-05-26 10:22:41 +0800
committerAlex Deucher <alexander.deucher@amd.com>2015-06-03 21:03:53 -0400
commit3d5a08c114585e5b9f890807b04d2730dafde5e1 (patch)
treeca7104751852e063528f2e6c28ae93f9d367f8d4 /drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
parentca95261325cfdff85eb2c9107198c714e266cb5b (diff)
downloadblackbird-op-linux-3d5a08c114585e5b9f890807b04d2730dafde5e1.tar.gz
blackbird-op-linux-3d5a08c114585e5b9f890807b04d2730dafde5e1.zip
drm/amdgpu: max_pde_used usage should be under protect
Need to take the lock when accessing this. Signed-off-by: monk.liu <monk.liu@amd.com> Reviewed-by: Christian König <christian.koenig@amd.com> Reviewed-by: Jammy Zhou <jammy.zhou@amd.com>
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c')
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
index cc6dca2581a6..dcb2d3859cf1 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
@@ -90,10 +90,13 @@ struct amdgpu_bo_list_entry *amdgpu_vm_get_bos(struct amdgpu_device *adev,
struct amdgpu_bo_list_entry *list;
unsigned i, idx;
+ mutex_lock(&vm->mutex);
list = drm_malloc_ab(vm->max_pde_used + 2,
sizeof(struct amdgpu_bo_list_entry));
- if (!list)
+ if (!list) {
+ mutex_unlock(&vm->mutex);
return NULL;
+ }
/* add the vm page table to the list */
list[0].robj = vm->page_directory;
@@ -116,6 +119,7 @@ struct amdgpu_bo_list_entry *amdgpu_vm_get_bos(struct amdgpu_device *adev,
list[idx].tv.shared = true;
list_add(&list[idx++].tv.head, head);
}
+ mutex_unlock(&vm->mutex);
return list;
}
OpenPOWER on IntegriCloud