So far this change appears to have stopped the intermittent page faults
that were causing problems for my desktop 6600 similar to what's reported
in:

  https://gitlab.freedesktop.org/drm/amd/-/work_items/6022
  https://gitlab.freedesktop.org/drm/amd/-/work_items/5914
  https://gitlab.freedesktop.org/drm/amd/-/work_items/5761

It was consistently happening once or twice a day in 7.4 rc builds on my
system, which I tried in order to find out if the bug had been fixed.  That's
much more frequent than in 7.3, and prompted me to try this.

Since I found no way to predict when the problem would occur it will take
another few days of running smoothly for the evidence to be strong that
this fixes it, but after three days it looks good so far.

Perhaps someone who understands gpu drivers could have a look?


---
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c
index 9fc8e9e97595..dc6c3fa598ce 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c
@@ -1015,17 +1015,17 @@ amdgpu_userq_bo_validate(struct amdgpu_device *adev, 
struct drm_exec *exec,
 
                ret = drm_exec_prepare_obj(exec, &bo->tbo.base,
                                           TTM_NUM_MOVE_FENCES + 1);
-               amdgpu_bo_unref(&tmp);
                if (unlikely(ret))
-                       return ret;
+                       goto unref_bo;
 
                amdgpu_bo_placement_from_domain(bo, bo->allowed_domains);
                ret = ttm_bo_validate(&bo->tbo, &bo->placement, &ctx);
                if (ret)
-                       return ret;
+                       goto unref_bo;
 
                /* This moves the bo_va to the idle list */
                ret = amdgpu_vm_bo_update(adev, bo_va, false);
+               amdgpu_bo_unref(&tmp);
                if (ret)
                        return ret;
 
@@ -1034,6 +1034,11 @@ amdgpu_userq_bo_validate(struct amdgpu_device *adev, 
struct drm_exec *exec,
        spin_unlock(&vm->individual_lock);
 
        return 0;
+
+unref_bo:
+       amdgpu_bo_unref(&tmp);
+       return ret;
+
 }

Reply via email to