aboutsummaryrefslogtreecommitdiffstats
path: root/meta-v1000/recipes-kernel/linux/linux-yocto-4.14.71/1606-amdkfd-Fix-a-kernel-crash-bug-when-memory-eviction-i.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta-v1000/recipes-kernel/linux/linux-yocto-4.14.71/1606-amdkfd-Fix-a-kernel-crash-bug-when-memory-eviction-i.patch')
-rw-r--r--meta-v1000/recipes-kernel/linux/linux-yocto-4.14.71/1606-amdkfd-Fix-a-kernel-crash-bug-when-memory-eviction-i.patch80
1 files changed, 80 insertions, 0 deletions
diff --git a/meta-v1000/recipes-kernel/linux/linux-yocto-4.14.71/1606-amdkfd-Fix-a-kernel-crash-bug-when-memory-eviction-i.patch b/meta-v1000/recipes-kernel/linux/linux-yocto-4.14.71/1606-amdkfd-Fix-a-kernel-crash-bug-when-memory-eviction-i.patch
new file mode 100644
index 00000000..8f227431
--- /dev/null
+++ b/meta-v1000/recipes-kernel/linux/linux-yocto-4.14.71/1606-amdkfd-Fix-a-kernel-crash-bug-when-memory-eviction-i.patch
@@ -0,0 +1,80 @@
+From 03d898fce90852e4a6667662f84fd82a1d1cb852 Mon Sep 17 00:00:00 2001
+From: Yong Zhao <Yong.Zhao@amd.com>
+Date: Fri, 3 Mar 2017 18:41:38 -0500
+Subject: [PATCH 1606/4131] amdkfd: Fix a kernel crash bug when memory eviction
+ is triggered
+
+The bug was accidentally introduced when rebasing commits from
+kernel 4.6 to 4.9.
+
+Change-Id: I9f5a772e9e4e9b1f330361afddda3be396e5192a
+Signed-off-by: Yong Zhao <Yong.Zhao@amd.com>
+---
+ drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c | 31 +++++++++---------------
+ 1 file changed, 11 insertions(+), 20 deletions(-)
+
+diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c
+index 294482f..9a26cff 100644
+--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c
++++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c
+@@ -2135,7 +2135,6 @@ int amdgpu_amdkfd_gpuvm_restore_process_bos(void *info)
+ &pd_bo_list[i]);
+ i++;
+ }
+- mutex_unlock(&process_info->lock);
+
+ /* Needed to splicing and cutting the lists */
+ last_pd_bo_entry = list_last_entry(&ctx.list,
+@@ -2143,7 +2142,6 @@ int amdgpu_amdkfd_gpuvm_restore_process_bos(void *info)
+ tv.head);
+
+ /* Reserve all BOs and page tables/directory. */
+- mutex_lock(&process_info->lock);
+ list_splice_init(&ctx.list, &process_info->kfd_bo_list);
+ ret = ttm_eu_reserve_buffers(&ctx.ticket, &process_info->kfd_bo_list,
+ false, &duplicate_save);
+@@ -2176,30 +2174,23 @@ int amdgpu_amdkfd_gpuvm_restore_process_bos(void *info)
+ goto validate_map_fail;
+ }
+ }
+- /* This isn't used for PTs any more, but can there be other
+- * duplicates? */
+- WARN_ONCE(!list_empty(&ctx.duplicates), "Duplicates not empty");
+- list_for_each_entry(entry, &ctx.duplicates, tv.head) {
+- struct amdgpu_bo *bo = entry->robj;
+
+- ret = amdgpu_amdkfd_bo_validate(bo, bo->prefered_domains,
+- false);
++ param.domain = AMDGPU_GEM_DOMAIN_VRAM;
++ param.wait = false;
++
++ /* Validate PTs*/
++ list_for_each_entry(peer_vm, &process_info->vm_list_head,
++ vm_list_node) {
++ adev = amdgpu_ttm_adev(peer_vm->base.page_directory->tbo.bdev);
++ ret = amdgpu_vm_validate_pt_bos(adev, &peer_vm->base,
++ amdgpu_amdkfd_validate, &param);
+ if (ret) {
+ pr_debug("Memory eviction: Validate PTs failed. Try again\n");
+ goto validate_map_fail;
+ }
++ peer_vm->base.last_eviction_counter =
++ atomic64_read(&adev->num_evictions);
+ }
+- param.domain = AMDGPU_GEM_DOMAIN_VRAM;
+- param.wait = false;
+- adev = amdgpu_ttm_adev(peer_vm->base.page_directory->tbo.bdev);
+- ret = amdgpu_vm_validate_pt_bos(adev, &peer_vm->base,
+- amdgpu_amdkfd_validate, &param);
+- if (ret) {
+- pr_debug("Memory eviction: Validate failed. Try again\n");
+- goto validate_map_fail;
+- }
+- peer_vm->base.last_eviction_counter =
+- atomic64_read(&adev->num_evictions);
+
+ /* Wait for PD/PTs validate to finish and attach eviction fence.
+ * PD/PT share the same reservation object
+--
+2.7.4
+