Skip to content

Commit

Permalink
drm/amdgpu: sync fence of clear_invalids (v2)
Browse files Browse the repository at this point in the history
bo_va may un-initialized, fix it.

Signed-off-by: monk.liu <monk.liu@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Jammy Zhou <jammy.zhou@amd.com>
  • Loading branch information
monk.liu authored and Alex Deucher committed Jun 4, 2015
1 parent 3d5a08c commit cfe2c97
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion drivers/gpu/drm/amd/amdgpu/amdgpu.h
Original file line number Diff line number Diff line change
Expand Up @@ -2268,7 +2268,7 @@ int amdgpu_vm_update_page_directory(struct amdgpu_device *adev,
int amdgpu_vm_clear_freed(struct amdgpu_device *adev,
struct amdgpu_vm *vm);
int amdgpu_vm_clear_invalids(struct amdgpu_device *adev,
struct amdgpu_vm *vm);
struct amdgpu_vm *vm, struct amdgpu_sync *sync);
int amdgpu_vm_bo_update(struct amdgpu_device *adev,
struct amdgpu_bo_va *bo_va,
struct ttm_mem_reg *mem);
Expand Down
2 changes: 1 addition & 1 deletion drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
Original file line number Diff line number Diff line change
Expand Up @@ -520,7 +520,7 @@ static int amdgpu_bo_vm_update_pte(struct amdgpu_cs_parser *p,

amdgpu_sync_fence(&p->ibs[0].sync, bo_va->last_pt_update);
}
return amdgpu_vm_clear_invalids(adev, vm);
return amdgpu_vm_clear_invalids(adev, vm, &p->ibs[0].sync);
}

static int amdgpu_cs_ib_vm_chunk(struct amdgpu_device *adev,
Expand Down
6 changes: 4 additions & 2 deletions drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
Original file line number Diff line number Diff line change
Expand Up @@ -858,9 +858,9 @@ int amdgpu_vm_clear_freed(struct amdgpu_device *adev,
* PTs have to be reserved and mutex must be locked!
*/
int amdgpu_vm_clear_invalids(struct amdgpu_device *adev,
struct amdgpu_vm *vm)
struct amdgpu_vm *vm, struct amdgpu_sync *sync)
{
struct amdgpu_bo_va *bo_va;
struct amdgpu_bo_va *bo_va = NULL;
int r;

spin_lock(&vm->status_lock);
Expand All @@ -877,6 +877,8 @@ int amdgpu_vm_clear_invalids(struct amdgpu_device *adev,
}
spin_unlock(&vm->status_lock);

if (bo_va)
amdgpu_sync_fence(sync, bo_va->last_pt_update);
return 0;
}

Expand Down

0 comments on commit cfe2c97

Please sign in to comment.