diff options
Diffstat (limited to 'meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.14.71/1399-Reserve-all-PD-BOs-from-VMs-along-with-a-BO-when-it-.patch')
-rw-r--r-- | meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.14.71/1399-Reserve-all-PD-BOs-from-VMs-along-with-a-BO-when-it-.patch | 71 |
1 files changed, 71 insertions, 0 deletions
diff --git a/meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.14.71/1399-Reserve-all-PD-BOs-from-VMs-along-with-a-BO-when-it-.patch b/meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.14.71/1399-Reserve-all-PD-BOs-from-VMs-along-with-a-BO-when-it-.patch new file mode 100644 index 00000000..49cf81d9 --- /dev/null +++ b/meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.14.71/1399-Reserve-all-PD-BOs-from-VMs-along-with-a-BO-when-it-.patch @@ -0,0 +1,71 @@ +From 83a1bec8c5ac6a51f983cf028824038df2ab5b43 Mon Sep 17 00:00:00 2001 +From: Yong Zhao <yong.zhao@amd.com> +Date: Thu, 21 Apr 2016 15:27:12 -0400 +Subject: [PATCH 1399/4131] Reserve all PD BOs from VMs along with a BO when it + is freed + +Change-Id: Ic1fe7affb9427cf8530296ed54617454988aa74f +--- + drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c | 24 ++++++++++++++---------- + 1 file changed, 14 insertions(+), 10 deletions(-) + +diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c +index e1e83b4..0db8980 100644 +--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c ++++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c +@@ -135,11 +135,11 @@ static int add_bo_to_vm(struct amdgpu_device *adev, struct kgd_mem *mem, + } + + static void remove_bo_from_vm(struct amdgpu_device *adev, +- struct amdgpu_bo *bo, struct amdgpu_bo_va *bo_va) ++ struct kfd_bo_va_list *entry) + { +- amdgpu_bo_reserve(bo, true); +- amdgpu_vm_bo_rmv(adev, bo_va); +- amdgpu_bo_unreserve(bo); ++ amdgpu_vm_bo_rmv(adev, entry->bo_va); ++ list_del(&entry->bo_list); ++ kfree(entry); + } + + +@@ -758,6 +758,8 @@ int amdgpu_amdkfd_gpuvm_free_memory_of_gpu( + { + struct amdgpu_device *adev; + struct kfd_bo_va_list *entry, *tmp; ++ struct bo_vm_reservation_context ctx; ++ int ret; + + BUG_ON(kgd == NULL); + BUG_ON(mem == NULL); +@@ -781,19 +783,21 @@ int amdgpu_amdkfd_gpuvm_free_memory_of_gpu( + if (mem->data2.work.work.func) + cancel_delayed_work_sync(&mem->data2.work); + ++ ret = reserve_bo_and_vms(mem, NULL, false, &ctx); ++ if (unlikely(ret != 0)) ++ return ret; ++ + /* Remove from VM internal data structures */ + list_for_each_entry_safe(entry, tmp, &mem->data2.bo_va_list, bo_list) { + pr_debug("Releasing BO with VA %p, size %lu bytes\n", + entry->bo_va, + mem->data2.bo->tbo.mem.size); +- if (entry->bo_va->vm != NULL) +- remove_bo_from_vm( +- (struct amdgpu_device *)entry->kgd_dev, +- mem->data2.bo, entry->bo_va); +- list_del(&entry->bo_list); +- kfree(entry); ++ remove_bo_from_vm((struct amdgpu_device *)entry->kgd_dev, ++ entry); + } + ++ unreserve_bo_and_vms(&ctx, true); ++ + /* Free the BO*/ + amdgpu_bo_unref(&mem->data2.bo); + kfree(mem); +-- +2.7.4 + |