Skip to contentSkip to conversation

amdgpu_device_recover_vram always failed if only one node in shadow_list

PATCH In review wentalou 2 participants 2 messages Apr 3, 2019 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore

wentalou

author
#0 lore raw

PATCH 1/1 amdgpu_device_recover_vram always failed if only one node in shadow_list

amdgpu_bo_restore_shadow would assign zero to r if succeeded.
r would remain zero if there is only one node in shadow_list. current code would always return failure when r <= 0.
restart the timeout for each wait was a rather problematic bug as well. The value of tmo SHOULD be changed, otherwise we wait tmo jiffies on each loop.

Change-Id I7e836ec7ab6cd0f069aac24f88e454e906637541
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +9 -4
index c4c61e9..fcb3d95 100644
@@ -3191,11 +3191,16 @@ static int amdgpu_device_recover_vram(struct amdgpu_device *adev)
 			break;
 
 		if (fence) {
-			r = dma_fence_wait_timeout(fence, false, tmo);
+			tmo = dma_fence_wait_timeout(fence, false, tmo);
 			dma_fence_put(fence);
 			fence = next;
-			if (r <= 0)
+			if (tmo == 0) {
+				r = -ETIMEDOUT;
 				break;
+			} else if (tmo < 0) {
+				r = tmo;
+				break;
+			}
 		} else {
 			fence = next;
 		}
@@ -3206,8 +3211,8 @@ static int amdgpu_device_recover_vram(struct amdgpu_device *adev)
 		tmo = dma_fence_wait_timeout(fence, false, tmo);
 	dma_fence_put(fence);
 
-	if (r <= 0 || tmo <= 0) {
-		DRM_ERROR("recover vram bo from shadow failed\n");
+	if (r < 0 || tmo <= 0) {
+		DRM_ERROR("recover vram bo from shadow failed, r is %ld, tmo is %ld\n", r, tmo);
 		return -EIO;
 	}
 
Signature · 6 lines
2.7.4

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): 1554273187-28657-1-git-send-email-Wentao.Lou-5C7GfCeVMHo@public.gmane.org

Reviewed-by
#2 lore raw

Am 03.04.19 um 08:33 schrieb wentalou:

Quoted 8 lines

amdgpu_bo_restore_shadow would assign zero to r if succeeded.
r would remain zero if there is only one node in shadow_list. current code would always return failure when r <= 0.
restart the timeout for each wait was a rather problematic bug as well. The value of tmo SHOULD be changed, otherwise we wait tmo jiffies on each loop.

Change-Id I7e836ec7ab6cd0f069aac24f88e454e906637541
Quoted 28 lines
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 13 +++++++++----
  1 file changed, 9 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +7 -2
index c4c61e9..fcb3d95 100644
@@ -3191,11 +3191,16 @@ static int amdgpu_device_recover_vram(struct amdgpu_device *adev)
  			break;
 
  		if (fence) {
-			r = dma_fence_wait_timeout(fence, false, tmo);
+			tmo = dma_fence_wait_timeout(fence, false, tmo);
  			dma_fence_put(fence);
  			fence = next;
-			if (r <= 0)
+			if (tmo == 0) {
+				r = -ETIMEDOUT;
  				break;
+			} else if (tmo < 0) {
+				r = tmo;
+				break;
+			}
  		} else {
  			fence = next;
  		}

drivers/gpu/drm/amd/amdgpu/amdgpu_device.c static int amdgpu_device_recover_vram(struct amdgpu_device *adev) · line 3218

Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +2 -2
@@ -3206,8 +3211,8 @@ static int amdgpu_device_recover_vram(struct amdgpu_device *adev)
  		tmo = dma_fence_wait_timeout(fence, false, tmo);
  	dma_fence_put(fence);
 
-	if (r <= 0 || tmo <= 0) {
-		DRM_ERROR("recover vram bo from shadow failed\n");
+	if (r < 0 || tmo <= 0) {
+		DRM_ERROR("recover vram bo from shadow failed, r is %ld, tmo is %ld\n", r, tmo);
  		return -EIO;
  	}
 

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx