aboutsummaryrefslogtreecommitdiffstats
path: root/common/recipes-kernel/linux/linux-yocto-4.14.71/1584-drm-amdgpu-Fix-unbalanced-restore-errors.patch
diff options
context:
space:
mode:
Diffstat (limited to 'common/recipes-kernel/linux/linux-yocto-4.14.71/1584-drm-amdgpu-Fix-unbalanced-restore-errors.patch')
-rw-r--r--common/recipes-kernel/linux/linux-yocto-4.14.71/1584-drm-amdgpu-Fix-unbalanced-restore-errors.patch62
1 files changed, 62 insertions, 0 deletions
diff --git a/common/recipes-kernel/linux/linux-yocto-4.14.71/1584-drm-amdgpu-Fix-unbalanced-restore-errors.patch b/common/recipes-kernel/linux/linux-yocto-4.14.71/1584-drm-amdgpu-Fix-unbalanced-restore-errors.patch
new file mode 100644
index 00000000..19d5a98a
--- /dev/null
+++ b/common/recipes-kernel/linux/linux-yocto-4.14.71/1584-drm-amdgpu-Fix-unbalanced-restore-errors.patch
@@ -0,0 +1,62 @@
+From aad37c9aa53203814399824d65f7de1059e442ee Mon Sep 17 00:00:00 2001
+From: Felix Kuehling <Felix.Kuehling@amd.com>
+Date: Fri, 3 Feb 2017 18:01:25 -0500
+Subject: [PATCH 1584/4131] drm/amdgpu: Fix unbalanced restore errors
+
+When a restore is canceled by a subsequent eviction while the restore
+worker was unlocked in update_user_pages, don't update mem->evicted to 0.
+
+Bug: SWDEV-112268
+Change-Id: I9d3d4b6dc50179a16042558060f51887bea8f15c
+Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
+---
+ drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c | 4 ++--
+ drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c | 17 +++++++++--------
+ 2 files changed, 11 insertions(+), 10 deletions(-)
+
+diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c
+index a2d1b55..b613ce0 100755
+--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c
++++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c
+@@ -282,8 +282,8 @@ static void amdgdu_amdkfd_restore_mem_worker(struct work_struct *work)
+ * was scheduled.
+ */
+ if (mem->evicted == 1) {
+- amdgpu_amdkfd_gpuvm_restore_mem(mem, mm);
+- mem->evicted = 0;
++ if (amdgpu_amdkfd_gpuvm_restore_mem(mem, mm) != -EBUSY)
++ mem->evicted = 0;
+ }
+
+ mem->mm = NULL;
+diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c
+index 8d05564..3ec1ff1 100644
+--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c
++++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c
+@@ -1936,14 +1936,15 @@ int amdgpu_amdkfd_gpuvm_restore_mem(struct kgd_mem *mem, struct mm_struct *mm)
+ pr_err("get_user_pages failed. Probably userptr is freed. %d\n",
+ ret);
+ }
+- }
+-
+- /* update_user_pages drops the lock briefly. Check if someone
+- * else evicted or restored the buffer in the mean time */
+- if (mem->evicted != 1) {
+- if (have_pages)
+- unreserve_bo_and_vms(&ctx, false);
+- return 0;
++ /* update_user_pages drops the lock briefly. Check if
++ * someone else evicted or restored the buffer in the
++ * mean time. Return -EBUSY to let the caller know.
++ */
++ if (mem->evicted != 1) {
++ if (have_pages)
++ unreserve_bo_and_vms(&ctx, false);
++ return -EBUSY;
++ }
+ }
+
+ if (have_pages) {
+--
+2.7.4
+