aboutsummaryrefslogtreecommitdiffstats
path: root/meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.14.71/2013-drm-amdgpu-reserve-root-PD-while-releasing-it.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.14.71/2013-drm-amdgpu-reserve-root-PD-while-releasing-it.patch')
-rw-r--r--meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.14.71/2013-drm-amdgpu-reserve-root-PD-while-releasing-it.patch53
1 files changed, 53 insertions, 0 deletions
diff --git a/meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.14.71/2013-drm-amdgpu-reserve-root-PD-while-releasing-it.patch b/meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.14.71/2013-drm-amdgpu-reserve-root-PD-while-releasing-it.patch
new file mode 100644
index 00000000..5cb3485c
--- /dev/null
+++ b/meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.14.71/2013-drm-amdgpu-reserve-root-PD-while-releasing-it.patch
@@ -0,0 +1,53 @@
+From 080d6ad3b5d4ee657399bdca7510a5910e2aaae3 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Christian=20K=C3=B6nig?= <christian.koenig@amd.com>
+Date: Fri, 13 Oct 2017 17:24:31 +0200
+Subject: [PATCH 2013/4131] drm/amdgpu: reserve root PD while releasing it
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Otherwise somebody could try to evict it at the same time and try to use
+half torn down structures.
+
+Signed-off-by: Christian König <christian.koenig@amd.com>
+Reviewed-and-Tested-by: Michel Dänzer <michel.daenzer@amd.com>
+Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
+---
+ drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 13 +++++++++++--
+ 1 file changed, 11 insertions(+), 2 deletions(-)
+
+diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
+index 58d0abc..c02fcaf 100644
+--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
++++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
+@@ -2808,8 +2808,9 @@ void amdgpu_vm_fini(struct amdgpu_device *adev, struct amdgpu_vm *vm)
+ {
+ struct amdgpu_bo_va_mapping *mapping, *tmp;
+ bool prt_fini_needed = !!adev->gart.gart_funcs->set_prt;
++ struct amdgpu_bo *root;
+ u64 fault;
+- int i;
++ int i, r;
+
+ if (vm->vm_context == AMDGPU_VM_CONTEXT_COMPUTE) {
+ struct amdgpu_vm_id_manager *id_mgr =
+@@ -2861,7 +2862,15 @@ void amdgpu_vm_fini(struct amdgpu_device *adev, struct amdgpu_vm *vm)
+ amdgpu_vm_free_mapping(adev, vm, mapping, NULL);
+ }
+
+- amdgpu_vm_free_levels(&vm->root);
++ root = amdgpu_bo_ref(vm->root.base.bo);
++ r = amdgpu_bo_reserve(root, true);
++ if (r) {
++ dev_err(adev->dev, "Leaking page tables because BO reservation failed\n");
++ } else {
++ amdgpu_vm_free_levels(&vm->root);
++ amdgpu_bo_unreserve(root);
++ }
++ amdgpu_bo_unref(&root);
+ dma_fence_put(vm->last_update);
+ for (i = 0; i < AMDGPU_MAX_VMHUBS; i++)
+ amdgpu_vm_free_reserved_vmid(adev, vm, i);
+--
+2.7.4
+