[PATCH 1/2] drm//amdgpu: Always sync fence before unlock eviction_lock

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The fence generated in ->commit is a shared one, so add it to resv.
And we need do that with eviction lock hold.

Currently we only sync last_direct/last_delayed before ->prepare. But we
fail to sync the last fence generated by ->commit. That cuases problems
if eviction happenes later, but it does not sync the last fence.

Cc: Christian König <christian.koenig@xxxxxxx>
Cc: Alex Deucher <alexander.deucher@xxxxxxx>
Cc: Felix Kuehling <Felix.Kuehling@xxxxxxx>
Signed-off-by: xinhui pan <xinhui.pan@xxxxxxx>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
index 73398831196f..f424b5969930 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
@@ -1582,6 +1582,7 @@ static int amdgpu_vm_bo_update_mapping(struct amdgpu_device *adev,
 	struct amdgpu_vm_update_params params;
 	enum amdgpu_sync_mode sync_mode;
 	int r;
+	struct amdgpu_bo *root = vm->root.base.bo;
 
 	memset(&params, 0, sizeof(params));
 	params.adev = adev;
@@ -1604,8 +1605,6 @@ static int amdgpu_vm_bo_update_mapping(struct amdgpu_device *adev,
 	}
 
 	if (flags & AMDGPU_PTE_VALID) {
-		struct amdgpu_bo *root = vm->root.base.bo;
-
 		if (!dma_fence_is_signaled(vm->last_direct))
 			amdgpu_bo_fence(root, vm->last_direct, true);
 
@@ -1623,6 +1622,12 @@ static int amdgpu_vm_bo_update_mapping(struct amdgpu_device *adev,
 
 	r = vm->update_funcs->commit(&params, fence);
 
+	if (!dma_fence_is_signaled(vm->last_direct))
+		amdgpu_bo_fence(root, vm->last_direct, true);
+
+	if (!dma_fence_is_signaled(vm->last_delayed))
+		amdgpu_bo_fence(root, vm->last_delayed, true);
+
 error_unlock:
 	amdgpu_vm_eviction_unlock(vm);
 	return r;
-- 
2.17.1

_______________________________________________
amd-gfx mailing list
amd-gfx@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/amd-gfx




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux