aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
diff options
context:
space:
mode:
authorMonk Liu <Monk.Liu@amd.com>2017-05-01 04:15:31 -0400
committerAlex Deucher <alexander.deucher@amd.com>2017-05-05 18:12:42 -0400
commit236763d340d6190c56554caee61c2bd5cfdf5217 (patch)
tree3556de5494f017c3da48af7afc55bf730920a9bf /drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
parent1d1a2cd58f05da1167c04394292aef9fbcf29bff (diff)
drm/amdgpu:fix waiting on dirty fence
if bo->shadow is NULL (race issue:BO shadow was just released and gpu-reset kick in but BO hasn't yet) recover_vram_from_shadow won't set @next, so the following "fence=next" will wrongly use a fence pointer which may already dirty. fixing it by set next to NULL prior to recover_vram_from_shadow Signed-off-by: Monk Liu <Monk.Liu@amd.com> Reviewed-by: Chunming Zhou<david1.zhou@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/amdgpu_device.c')
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_device.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
index 3c1754df4c40..367811cd0763 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
@@ -2522,6 +2522,7 @@ int amdgpu_sriov_gpu_reset(struct amdgpu_device *adev, bool voluntary)
2522 ring = adev->mman.buffer_funcs_ring; 2522 ring = adev->mman.buffer_funcs_ring;
2523 mutex_lock(&adev->shadow_list_lock); 2523 mutex_lock(&adev->shadow_list_lock);
2524 list_for_each_entry_safe(bo, tmp, &adev->shadow_list, shadow_list) { 2524 list_for_each_entry_safe(bo, tmp, &adev->shadow_list, shadow_list) {
2525 next = NULL;
2525 amdgpu_recover_vram_from_shadow(adev, ring, bo, &next); 2526 amdgpu_recover_vram_from_shadow(adev, ring, bo, &next);
2526 if (fence) { 2527 if (fence) {
2527 r = dma_fence_wait(fence, false); 2528 r = dma_fence_wait(fence, false);
@@ -2668,6 +2669,7 @@ retry:
2668 DRM_INFO("recover vram bo from shadow\n"); 2669 DRM_INFO("recover vram bo from shadow\n");
2669 mutex_lock(&adev->shadow_list_lock); 2670 mutex_lock(&adev->shadow_list_lock);
2670 list_for_each_entry_safe(bo, tmp, &adev->shadow_list, shadow_list) { 2671 list_for_each_entry_safe(bo, tmp, &adev->shadow_list, shadow_list) {
2672 next = NULL;
2671 amdgpu_recover_vram_from_shadow(adev, ring, bo, &next); 2673 amdgpu_recover_vram_from_shadow(adev, ring, bo, &next);
2672 if (fence) { 2674 if (fence) {
2673 r = dma_fence_wait(fence, false); 2675 r = dma_fence_wait(fence, false);