Commit 061468c4 authored by Christian König's avatar Christian König Committed by Alex Deucher
Browse files

drm/amdgpu: allocate PDs/PTs with no_gpu_wait in a page fault



While handling a page fault we can't wait for other ongoing GPU
operations or we can potentially run into deadlocks.

Signed-off-by: default avatarChristian König <christian.koenig@amd.com>
Reviewed-by: default avatarFelix Kuehling <Felix.Kuehling@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 0f6064d6
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -451,7 +451,7 @@ static int amdgpu_bo_do_create(struct amdgpu_device *adev,
{
	struct ttm_operation_ctx ctx = {
		.interruptible = (bp->type != ttm_bo_type_kernel),
		.no_wait_gpu = false,
		.no_wait_gpu = bp->no_wait_gpu,
		.resv = bp->resv,
		.flags = TTM_OPT_FLAG_ALLOW_RES_EVICT
	};
+1 −0
Original line number Diff line number Diff line
@@ -41,6 +41,7 @@ struct amdgpu_bo_param {
	u32				preferred_domain;
	u64				flags;
	enum ttm_bo_type		type;
	bool				no_wait_gpu;
	struct dma_resv	*resv;
};

+5 −3
Original line number Diff line number Diff line
@@ -821,7 +821,8 @@ static int amdgpu_vm_clear_bo(struct amdgpu_device *adev,
 * @bp: resulting BO allocation parameters
 */
static void amdgpu_vm_bo_param(struct amdgpu_device *adev, struct amdgpu_vm *vm,
			       int level, struct amdgpu_bo_param *bp)
			       int level, bool direct,
			       struct amdgpu_bo_param *bp)
{
	memset(bp, 0, sizeof(*bp));

@@ -836,6 +837,7 @@ static void amdgpu_vm_bo_param(struct amdgpu_device *adev, struct amdgpu_vm *vm,
	else if (!vm->root.base.bo || vm->root.base.bo->shadow)
		bp->flags |= AMDGPU_GEM_CREATE_SHADOW;
	bp->type = ttm_bo_type_kernel;
	bp->no_wait_gpu = direct;
	if (vm->root.base.bo)
		bp->resv = vm->root.base.bo->tbo.base.resv;
}
@@ -877,7 +879,7 @@ static int amdgpu_vm_alloc_pts(struct amdgpu_device *adev,
	if (entry->base.bo)
		return 0;

	amdgpu_vm_bo_param(adev, vm, cursor->level, &bp);
	amdgpu_vm_bo_param(adev, vm, cursor->level, direct, &bp);

	r = amdgpu_bo_create(adev, &bp, &pt);
	if (r)
@@ -2714,7 +2716,7 @@ int amdgpu_vm_init(struct amdgpu_device *adev, struct amdgpu_vm *vm,
		vm->update_funcs = &amdgpu_vm_sdma_funcs;
	vm->last_update = NULL;

	amdgpu_vm_bo_param(adev, vm, adev->vm_manager.root_level, &bp);
	amdgpu_vm_bo_param(adev, vm, adev->vm_manager.root_level, false, &bp);
	if (vm_context == AMDGPU_VM_CONTEXT_COMPUTE)
		bp.flags &= ~AMDGPU_GEM_CREATE_SHADOW;
	r = amdgpu_bo_create(adev, &bp, &root);