Skip to content

Commit

Permalink
drm/amdgpu: add debug printks for d3ef581
Browse files Browse the repository at this point in the history
Signed-off-by: Nirmoy Das <nirmoy.das@amd.com>
  • Loading branch information
Nirmoy Das committed Feb 26, 2021
1 parent 19bafac commit 72c7a7e
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 6 deletions.
12 changes: 9 additions & 3 deletions drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
Expand Up @@ -1336,8 +1336,10 @@ vm_fault_t amdgpu_bo_fault_reserve_notify(struct ttm_buffer_object *bo)
return 0;

/* Can't move a pinned BO to visible VRAM */
if (abo->tbo.pin_count > 0)
if (abo->tbo.pin_count > 0) {
printk("amdgpu_bo_fault_reserve_notify: pin count > 0\n");
return VM_FAULT_SIGBUS;
}

/* hurrah the memory is not visible ! */
atomic64_inc(&adev->num_vram_cpu_page_faults);
Expand All @@ -1351,14 +1353,18 @@ vm_fault_t amdgpu_bo_fault_reserve_notify(struct ttm_buffer_object *bo)
r = ttm_bo_validate(bo, &abo->placement, &ctx);
if (unlikely(r == -EBUSY || r == -ERESTARTSYS))
return VM_FAULT_NOPAGE;
else if (unlikely(r))
else if (unlikely(r)) {
printk("amdgpu_bo_fault_reserve_notify: Failed to ttm_bo_validate %d\n", r);
return VM_FAULT_SIGBUS;
}

offset = bo->mem.start << PAGE_SHIFT;
/* this should never happen */
if (bo->mem.mem_type == TTM_PL_VRAM &&
(offset + size) > adev->gmc.visible_vram_size)
(offset + size) > adev->gmc.visible_vram_size) {
printk("amdgpu_bo_fault_reserve_notify: sending SIGBUS offset +size > visible vram\n");
return VM_FAULT_SIGBUS;
}

ttm_bo_move_to_lru_tail_unlocked(bo);
return 0;
Expand Down
12 changes: 9 additions & 3 deletions drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
Expand Up @@ -1985,17 +1985,23 @@ static vm_fault_t amdgpu_ttm_fault(struct vm_fault *vmf)
vm_fault_t ret;

ret = ttm_bo_vm_reserve(bo, vmf);
if (ret)
if (ret) {
printk("amdgpu_ttm_fault: ttm_bo_vm_reserve failed with %d\n", ret);
return ret;
}

ret = amdgpu_bo_fault_reserve_notify(bo);
if (ret)
if (ret) {
printk("amdgpu_ttm_fault: amdgpu_bo_fault_reserve_notify failed with %d\n", ret);
goto unlock;
}

ret = ttm_bo_vm_fault_reserved(vmf, vmf->vma->vm_page_prot,
TTM_BO_VM_NUM_PREFAULT, 1);
if (ret == VM_FAULT_RETRY && !(vmf->flags & FAULT_FLAG_RETRY_NOWAIT))
if (ret == VM_FAULT_RETRY && !(vmf->flags & FAULT_FLAG_RETRY_NOWAIT)) {
printk("amdgpu_ttm_fault: ttm_bo_vm_fault_reserved failed with %d\n", ret);
return ret;
}

unlock:
dma_resv_unlock(bo->base.resv);
Expand Down

0 comments on commit 72c7a7e

Please sign in to comment.