|
@@ -323,6 +323,7 @@ int amdgpu_bo_create_restricted(struct amdgpu_device *adev,
|
|
|
struct amdgpu_bo *bo;
|
|
|
enum ttm_bo_type type;
|
|
|
unsigned long page_align;
|
|
|
+ u64 initial_bytes_moved;
|
|
|
size_t acc_size;
|
|
|
int r;
|
|
|
|
|
@@ -401,10 +402,15 @@ int amdgpu_bo_create_restricted(struct amdgpu_device *adev,
|
|
|
locked = ww_mutex_trylock(&bo->tbo.ttm_resv.lock);
|
|
|
WARN_ON(!locked);
|
|
|
}
|
|
|
+
|
|
|
+ initial_bytes_moved = atomic64_read(&adev->num_bytes_moved);
|
|
|
r = ttm_bo_init(&adev->mman.bdev, &bo->tbo, size, type,
|
|
|
&bo->placement, page_align, !kernel, NULL,
|
|
|
acc_size, sg, resv ? resv : &bo->tbo.ttm_resv,
|
|
|
&amdgpu_ttm_bo_destroy);
|
|
|
+ amdgpu_cs_report_moved_bytes(adev,
|
|
|
+ atomic64_read(&adev->num_bytes_moved) - initial_bytes_moved);
|
|
|
+
|
|
|
if (unlikely(r != 0)) {
|
|
|
if (!resv)
|
|
|
ww_mutex_unlock(&bo->tbo.resv->lock);
|