diff options
author | wentalou <Wentao.Lou@amd.com> | 2019-04-02 05:13:05 -0400 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2019-04-04 11:22:06 -0400 |
commit | 1712fb1a2f6829150032ac76eb0e39b82a549cfb (patch) | |
tree | 78822194b681dd076ab52fe2d6289a1e128c47e4 /drivers/gpu/drm/amd | |
parent | d4162c61e253177936fcfe6c29f7b224d9a1efb8 (diff) |
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>
Diffstat (limited to 'drivers/gpu/drm/amd')
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c index ac0d646a7b74..5d8b30fd4534 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | |||
@@ -3173,11 +3173,16 @@ static int amdgpu_device_recover_vram(struct amdgpu_device *adev) | |||
3173 | break; | 3173 | break; |
3174 | 3174 | ||
3175 | if (fence) { | 3175 | if (fence) { |
3176 | r = dma_fence_wait_timeout(fence, false, tmo); | 3176 | tmo = dma_fence_wait_timeout(fence, false, tmo); |
3177 | dma_fence_put(fence); | 3177 | dma_fence_put(fence); |
3178 | fence = next; | 3178 | fence = next; |
3179 | if (r <= 0) | 3179 | if (tmo == 0) { |
3180 | r = -ETIMEDOUT; | ||
3180 | break; | 3181 | break; |
3182 | } else if (tmo < 0) { | ||
3183 | r = tmo; | ||
3184 | break; | ||
3185 | } | ||
3181 | } else { | 3186 | } else { |
3182 | fence = next; | 3187 | fence = next; |
3183 | } | 3188 | } |
@@ -3188,8 +3193,8 @@ static int amdgpu_device_recover_vram(struct amdgpu_device *adev) | |||
3188 | tmo = dma_fence_wait_timeout(fence, false, tmo); | 3193 | tmo = dma_fence_wait_timeout(fence, false, tmo); |
3189 | dma_fence_put(fence); | 3194 | dma_fence_put(fence); |
3190 | 3195 | ||
3191 | if (r <= 0 || tmo <= 0) { | 3196 | if (r < 0 || tmo <= 0) { |
3192 | DRM_ERROR("recover vram bo from shadow failed\n"); | 3197 | DRM_ERROR("recover vram bo from shadow failed, r is %ld, tmo is %ld\n", r, tmo); |
3193 | return -EIO; | 3198 | return -EIO; |
3194 | } | 3199 | } |
3195 | 3200 | ||