diff options
author | Christian König <christian.koenig@amd.com> | 2017-12-22 11:13:03 -0500 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2017-12-27 11:34:31 -0500 |
commit | 727ffdf2ac6d165f611b1accdf7f6ca770595aea (patch) | |
tree | bbc4600f81b5ca147fbd6e5186e726863343565f /drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | |
parent | 6a83a553033d6c3d8fb4683a9c87833ace44121b (diff) |
drm/amdgpu: fix VM faults with per VM BOs
There was a small window between unreserve and second reserve where the
freshly allocated BO could have been evicted without the VM noticing it.
Signed-off-by: Christian König <christian.koenig@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_vm.c')
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c index af7dceb7131e..e623109be202 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | |||
@@ -1745,8 +1745,26 @@ struct amdgpu_bo_va *amdgpu_vm_bo_add(struct amdgpu_device *adev, | |||
1745 | INIT_LIST_HEAD(&bo_va->valids); | 1745 | INIT_LIST_HEAD(&bo_va->valids); |
1746 | INIT_LIST_HEAD(&bo_va->invalids); | 1746 | INIT_LIST_HEAD(&bo_va->invalids); |
1747 | 1747 | ||
1748 | if (bo) | 1748 | if (!bo) |
1749 | list_add_tail(&bo_va->base.bo_list, &bo->va); | 1749 | return bo_va; |
1750 | |||
1751 | list_add_tail(&bo_va->base.bo_list, &bo->va); | ||
1752 | |||
1753 | if (bo->tbo.resv != vm->root.base.bo->tbo.resv) | ||
1754 | return bo_va; | ||
1755 | |||
1756 | if (bo->preferred_domains & | ||
1757 | amdgpu_mem_type_to_domain(bo->tbo.mem.mem_type)) | ||
1758 | return bo_va; | ||
1759 | |||
1760 | /* | ||
1761 | * We checked all the prerequisites, but it looks like this per VM BO | ||
1762 | * is currently evicted. add the BO to the evicted list to make sure it | ||
1763 | * is validated on next VM use to avoid fault. | ||
1764 | * */ | ||
1765 | spin_lock(&vm->status_lock); | ||
1766 | list_move_tail(&bo_va->base.vm_status, &vm->evicted); | ||
1767 | spin_unlock(&vm->status_lock); | ||
1750 | 1768 | ||
1751 | return bo_va; | 1769 | return bo_va; |
1752 | } | 1770 | } |