All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/amdgpu: amdgpu_device_recover_vram always failed if only one node in shadow_list
@ 2019-04-01  8:58 wentalou
       [not found] ` <1554109125-21890-1-git-send-email-Wentao.Lou-5C7GfCeVMHo@public.gmane.org>
  0 siblings, 1 reply; 7+ messages in thread
From: wentalou @ 2019-04-01  8:58 UTC (permalink / raw)
  To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW; +Cc: wentalou

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.

Change-Id: Iae6880e7c78b71fde6a6754c69665c2e312a80a5
Signed-off-by: Wentao Lou <Wentao.Lou@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
index c4c61e9..5cf21a4 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
@@ -3171,6 +3171,7 @@ static int amdgpu_device_recover_vram(struct amdgpu_device *adev)
 	struct dma_fence *fence = NULL, *next = NULL;
 	struct amdgpu_bo *shadow;
 	long r = 1, tmo;
+	bool single_shadow = false;
 
 	if (amdgpu_sriov_runtime(adev))
 		tmo = msecs_to_jiffies(8000);
@@ -3194,10 +3195,12 @@ static int amdgpu_device_recover_vram(struct amdgpu_device *adev)
 			r = dma_fence_wait_timeout(fence, false, tmo);
 			dma_fence_put(fence);
 			fence = next;
+			single_shadow = false;
 			if (r <= 0)
 				break;
 		} else {
 			fence = next;
+			single_shadow = true;
 		}
 	}
 	mutex_unlock(&adev->shadow_list_lock);
@@ -3206,7 +3209,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) {
+	/* r would be zero even if amdgpu_bo_restore_shadow succeeded when single shadow in list */
+	if (r < 0 || (r == 0 && !single_shadow) || tmo <= 0) {
 		DRM_ERROR("recover vram bo from shadow failed\n");
 		return -EIO;
 	}
-- 
2.7.4

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

^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2019-04-02 10:34 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-01  8:58 [PATCH] drm/amdgpu: amdgpu_device_recover_vram always failed if only one node in shadow_list wentalou
     [not found] ` <1554109125-21890-1-git-send-email-Wentao.Lou-5C7GfCeVMHo@public.gmane.org>
2019-04-02  4:03   ` Deng, Emily
     [not found]     ` <BN7PR12MB26445D172F6617137A8F905C8F560-Zx/IyJUqfGKoYeSiBV3SvgdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org>
2019-04-02  7:01       ` Christian König
     [not found]         ` <03f69f82-1352-8e4e-bd3b-21e5c031ec09-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2019-04-02  7:29           ` Lou, Wentao
     [not found]             ` <MN2PR12MB3280B0482A8DCD4D6499D42F83560-rweVpJHSKToYX/8oZD8ObAdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org>
2019-04-02  7:39               ` Koenig, Christian
     [not found]                 ` <d358855c-c37c-7623-cd24-86f4cb2be16f-5C7GfCeVMHo@public.gmane.org>
2019-04-02  9:23                   ` Lou, Wentao
     [not found]                     ` <MN2PR12MB328037EF2991597695B6FB9F83560-rweVpJHSKToYX/8oZD8ObAdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org>
2019-04-02 10:34                       ` Koenig, Christian

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.