[PATCH 1/2] drm/amdgpu: handle the return for sync wait

Emily Deng Emily.Deng at amd.com
Fri Oct 20 09:59:10 UTC 2023


Add error handling for amdgpu_sync_wait.

Signed-off-by: Emily Deng <Emily.Deng at amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c | 9 ++++++---
 drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c          | 6 +++++-
 2 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c
index 54f31a420229..3011c191d7dd 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c
@@ -2668,7 +2668,7 @@ static int validate_invalid_user_pages(struct amdkfd_process_info *process_info)
 
 unreserve_out:
 	ttm_eu_backoff_reservation(&ticket, &resv_list);
-	amdgpu_sync_wait(&sync, false);
+	ret = amdgpu_sync_wait(&sync, false);
 	amdgpu_sync_free(&sync);
 out_free:
 	kfree(pd_bo_list_entries);
@@ -2939,8 +2939,11 @@ int amdgpu_amdkfd_gpuvm_restore_process_bos(void *info, struct dma_fence **ef)
 	}
 
 	/* Wait for validate and PT updates to finish */
-	amdgpu_sync_wait(&sync_obj, false);
-
+	ret = amdgpu_sync_wait(&sync_obj, false);
+	if (ret) {
+		pr_err("Failed to wait for validate and PT updates to finish\n");
+		goto validate_map_fail;
+	}
 	/* Release old eviction fence and create new one, because fence only
 	 * goes from unsignaled to signaled, fence cannot be reused.
 	 * Use context and mm from the old fence.
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c
index 70fe3b39c004..a63139277583 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c
@@ -1153,7 +1153,11 @@ int amdgpu_mes_ctx_map_meta_data(struct amdgpu_device *adev,
 	}
 	amdgpu_sync_fence(&sync, vm->last_update);
 
-	amdgpu_sync_wait(&sync, false);
+	r = amdgpu_sync_wait(&sync, false);
+	if (r) {
+		DRM_ERROR("failed to wait sync\n");
+		goto error;
+	}
 	ttm_eu_backoff_reservation(&ticket, &list);
 
 	amdgpu_sync_free(&sync);
-- 
2.36.1



More information about the amd-gfx mailing list