drm/amdgpu: 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. Signed-off-by: Wentao Lou <Wentao.Lou@amd.com> Reviewed-by: Christian König <christian.koenig@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
This commit is contained in:
@@ -3173,11 +3173,16 @@ static int amdgpu_device_recover_vram(struct amdgpu_device *adev)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
if (fence) {
|
if (fence) {
|
||||||
r = dma_fence_wait_timeout(fence, false, tmo);
|
tmo = dma_fence_wait_timeout(fence, false, tmo);
|
||||||
dma_fence_put(fence);
|
dma_fence_put(fence);
|
||||||
fence = next;
|
fence = next;
|
||||||
if (r <= 0)
|
if (tmo == 0) {
|
||||||
|
r = -ETIMEDOUT;
|
||||||
break;
|
break;
|
||||||
|
} else if (tmo < 0) {
|
||||||
|
r = tmo;
|
||||||
|
break;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
fence = next;
|
fence = next;
|
||||||
}
|
}
|
||||||
@@ -3188,8 +3193,8 @@ static int amdgpu_device_recover_vram(struct amdgpu_device *adev)
|
|||||||
tmo = dma_fence_wait_timeout(fence, false, tmo);
|
tmo = dma_fence_wait_timeout(fence, false, tmo);
|
||||||
dma_fence_put(fence);
|
dma_fence_put(fence);
|
||||||
|
|
||||||
if (r <= 0 || tmo <= 0) {
|
if (r < 0 || tmo <= 0) {
|
||||||
DRM_ERROR("recover vram bo from shadow failed\n");
|
DRM_ERROR("recover vram bo from shadow failed, r is %ld, tmo is %ld\n", r, tmo);
|
||||||
return -EIO;
|
return -EIO;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user