amdgpu_device_recover_vram always failed if only one node in shadow_list
Subsystems (2)
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. meanwhile, fix Call Trace by NULL of shadow->parent.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +10 -5
@@ -3183,7 +3183,7 @@ static int amdgpu_device_recover_vram(struct amdgpu_device *adev)/* No need to recover an evicted BO */ if (shadow->tbo.mem.mem_type !=TTM_PL_TT || - shadow->parent->tbo.mem.mem_type !=TTM_PL_VRAM ) + shadow->parent ==NULL || shadow->parent->tbo.mem.mem_type !=TTM_PL_VRAM )continue ; r =amdgpu_bo_restore_shadow (shadow, &next);
@@ -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, tmo is %d\n" , 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): 1554196784-25674-1-git-send-email-Wentao.Lou-5C7GfCeVMHo@public.gmane.org
Am 02.04.19 um 11:19 schrieb wentalou:
Quoted 18 lines
amdgpu_bo_restore_shadowwould assign zero to r if succeeded.
r would remain zero if there is only one node inshadow_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. meanwhile, fix Call Trace by NULL ofshadow->parent.Change-Id I7e836ec7ab6cd0f069aac24f88e454e906637541Signed-off-by Wentao Lou <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +0
-0
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c static int amdgpu_device_recover_vram(struct amdgpu_device *adev) · line 3186
Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +1
-1@@ -3183,7 +3183,7 @@ static int amdgpu_device_recover_vram(struct amdgpu_device *adev)/* No need to recover an evicted BO */ if (shadow->tbo.mem.mem_type !=TTM_PL_TT || - shadow->parent->tbo.mem.mem_type !=TTM_PL_VRAM ) + shadow->parent ==NULL || shadow->parent->tbo.mem.mem_type !=TTM_PL_VRAM )
That doesn't looks like a good idea to me. Did you actually run into this issue?
Quoted 23 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +7
-2continue ; r =amdgpu_bo_restore_shadow (shadow, &next);@@ -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 3215
Quoted 7 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, tmo is %d\n" , tmo);
Maybe print both r and tmo in the message.
Regards,
Christian.
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c static int amdgpu_device_recover_vram(struct amdgpu_device *adev) · line 3218
Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +0
-0return -EIO ; }
_______________________________________________
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): 470b5b5e-385c-84b8-8706-40222209fa34-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
Hi Christian,
Sometimes shadow->parent would be NULL in my testbed, but not reproduce today... Just sent out another patch following your advice.
Thanks.
BR,
Wentao
-----Original Message-----
From: Christian König <[email protected]>
Sent: Tuesday, April 2, 2019 6:36 PM
To: Lou, Wentao <[email protected]>; [email protected]
Subject: Re: [PATCH] amdgpu_device_recover_vram always failed if only one node in shadow_list
Am 02.04.19 um 11:19 schrieb wentalou:
Quoted 19 lines
amdgpu_bo_restore_shadowwould assign zero to r if succeeded.
r would remain zero if there is only one node inshadow_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. meanwhile, fix Call Trace by NULL ofshadow->parent.Change-Id I7e836ec7ab6cd0f069aac24f88e454e906637541Signed-off-by Wentao Lou <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +0
-0
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c static int amdgpu_device_recover_vram(struct · line 3188
Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +2
-1@@ -3183,7 +3183,7 @@ static int amdgpu_device_recover_vram(struct amdgpu_device *adev)/* No need to recover an evicted BO */ if (shadow->tbo.mem.mem_type !=TTM_PL_TT || - shadow->parent->tbo.mem.mem_type !=TTM_PL_VRAM ) + shadow->parent ==NULL || shadow->parent->tbo.mem.mem_type != +TTM_PL_VRAM )
That doesn't looks like a good idea to me. Did you actually run into this issue?
Quoted 23 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +0
-0continue ; r = amdgpu_bo_restore_shadow(shadow, &next); @@ -3191,11 +3191,16@@ static int
amdgpu_device_recover_vram(struct amdgpu_device *adev)
break;if (fence) {drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +7
-2- 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 3215
Quoted 7 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, tmo is %d\n" , tmo);
Maybe print both r and tmo in the message.
Regards,
Christian.
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c static int amdgpu_device_recover_vram(struct amdgpu_device *adev) · line 3218
Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +0
-0return -EIO ; }
_______________________________________________
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): MN2PR12MB328059309BE6D3A038FDF12A83570-rweVpJHSKToYX/[email protected]
Mhm, that sounds like another bug to me which we need to investigate.
Probably a race during freeing of shadow allocations.
Christian.
Am 03.04.19 um 08:35 schrieb Lou, Wentao:
Quoted 71 lines
Hi Christian,
Sometimes
shadow->parentwould be NULL in my testbed, but not reproduce today... Just sent out another patch following your advice.
Thanks.BR,
Wentao-----Original Message-----
From: Christian König <[email protected]>
Sent: Tuesday, April 2, 2019 6:36 PM
To: Lou, Wentao <[email protected]>; [email protected]
Subject: Re: [PATCH]amdgpu_device_recover_vramalways failed if only one node inshadow_listAm 02.04.19 um 11:19 schrieb wentalou:
Quoted 19 lines
amdgpu_bo_restore_shadowwould assign zero to r if succeeded.
r would remain zero if there is only one node inshadow_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. meanwhile, fix Call Trace by NULL ofshadow->parent.Change-Id I7e836ec7ab6cd0f069aac24f88e454e906637541Signed-off-by Wentao Lou <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +0
-0drivers/gpu/drm/amd/amdgpu/amdgpu_device.c static int amdgpu_device_recover_vram(struct · line 3188
Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +2
-1@@ -3183,7 +3183,7 @@ static int amdgpu_device_recover_vram(struct amdgpu_device *adev)/* No need to recover an evicted BO */ if (shadow->tbo.mem.mem_type !=TTM_PL_TT || - shadow->parent->tbo.mem.mem_type !=TTM_PL_VRAM ) + shadow->parent ==NULL || shadow->parent->tbo.mem.mem_type != +TTM_PL_VRAM )That doesn't looks like a good idea to me. Did you actually run into this issue?
Quoted 26 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +0
-0continue ; r = amdgpu_bo_restore_shadow(shadow, &next); @@ -3191,11 +3191,16@@ static int
amdgpu_device_recover_vram(struct amdgpu_device *adev)break; if (fence) {drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +7
-2- 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);
Quoted 12 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c static int amdgpu_device_recover_vram(struct amdgpu_device *adev) · line 3215
Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +2
-2-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, tmo is %d\n" , tmo);Maybe print both r and tmo in the message.
Regards,
Christian.Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +0
-0return -EIO ; }
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx