diff options
Diffstat (limited to 'common/recipes-kernel/linux/files/0378-drm-amdgpu-reserve-the-PD-during-unmap-and-remove.patch')
-rw-r--r-- | common/recipes-kernel/linux/files/0378-drm-amdgpu-reserve-the-PD-during-unmap-and-remove.patch | 88 |
1 files changed, 88 insertions, 0 deletions
diff --git a/common/recipes-kernel/linux/files/0378-drm-amdgpu-reserve-the-PD-during-unmap-and-remove.patch b/common/recipes-kernel/linux/files/0378-drm-amdgpu-reserve-the-PD-during-unmap-and-remove.patch new file mode 100644 index 00000000..28096794 --- /dev/null +++ b/common/recipes-kernel/linux/files/0378-drm-amdgpu-reserve-the-PD-during-unmap-and-remove.patch @@ -0,0 +1,88 @@ +From 3f2874ebc604baada1c76eba598e27b6ec797903 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Christian=20K=C3=B6nig?= <christian.koenig@amd.com> +Date: Tue, 8 Mar 2016 17:47:46 +0100 +Subject: [PATCH 0378/1110] drm/amdgpu: reserve the PD during unmap and remove +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +We not only need to protect the mapping tree and freed list itself, +but also the items on those list. + +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_gem.c | 34 +++++++++++++++++++++++---------- + 1 file changed, 24 insertions(+), 10 deletions(-) + +diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c +index cbacf72..dcf6611 100644 +--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c ++++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c +@@ -140,25 +140,40 @@ int amdgpu_gem_object_open(struct drm_gem_object *obj, struct drm_file *file_pri + void amdgpu_gem_object_close(struct drm_gem_object *obj, + struct drm_file *file_priv) + { +- struct amdgpu_bo *rbo = gem_to_amdgpu_bo(obj); +- struct amdgpu_device *adev = rbo->adev; ++ struct amdgpu_bo *bo = gem_to_amdgpu_bo(obj); ++ struct amdgpu_device *adev = bo->adev; + struct amdgpu_fpriv *fpriv = file_priv->driver_priv; + struct amdgpu_vm *vm = &fpriv->vm; ++ ++ struct amdgpu_bo_list_entry vm_pd; ++ struct list_head list, duplicates; ++ struct ttm_validate_buffer tv; ++ struct ww_acquire_ctx ticket; + struct amdgpu_bo_va *bo_va; + int r; +- r = amdgpu_bo_reserve(rbo, true); ++ ++ INIT_LIST_HEAD(&list); ++ INIT_LIST_HEAD(&duplicates); ++ ++ tv.bo = &bo->tbo; ++ tv.shared = true; ++ list_add(&tv.head, &list); ++ ++ amdgpu_vm_get_pd_bo(vm, &list, &vm_pd); ++ ++ r = ttm_eu_reserve_buffers(&ticket, &list, true, &duplicates); + if (r) { + dev_err(adev->dev, "leaking bo va because " + "we fail to reserve bo (%d)\n", r); + return; + } +- bo_va = amdgpu_vm_bo_find(vm, rbo); ++ bo_va = amdgpu_vm_bo_find(vm, bo); + if (bo_va) { + if (--bo_va->ref_count == 0) { + amdgpu_vm_bo_rmv(adev, bo_va); + } + } +- amdgpu_bo_unreserve(rbo); ++ ttm_eu_backoff_reservation(&ticket, &list); + } + + static int amdgpu_gem_handle_lockup(struct amdgpu_device *adev, int r) +@@ -580,11 +595,10 @@ int amdgpu_gem_va_ioctl(struct drm_device *dev, void *data, + tv.shared = true; + list_add(&tv.head, &list); + +- if (args->operation == AMDGPU_VA_OP_MAP) { +- tv_pd.bo = &fpriv->vm.page_directory->tbo; +- tv_pd.shared = true; +- list_add(&tv_pd.head, &list); +- } ++ tv_pd.bo = &fpriv->vm.page_directory->tbo; ++ tv_pd.shared = true; ++ list_add(&tv_pd.head, &list); ++ + r = ttm_eu_reserve_buffers(&ticket, &list, true, &duplicates); + if (r) { + drm_gem_object_unreference_unlocked(gobj); +-- +2.7.4 + |