Commit 33c6bd98 authored by Philip Yang's avatar Philip Yang Committed by Alex Deucher

drm/amdkfd: debug message to count successfully migrated pages

Not all migrate.cpages returned from migrate_vma_setup can be migrated,
for example non anonymous page, or out of device memory. So after
migrate_vma_pages returns, add debug message to count pages are
successfully migrated which has MIGRATE_PFN_VALID and
MIGRATE_PFN_MIGRATE flag set.
Signed-off-by: default avatarPhilip Yang <Philip.Yang@amd.com>
Reviewed-by: default avatarFelix Kuehling <Felix.Kuehling@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 75fa98d6
...@@ -268,6 +268,19 @@ static void svm_migrate_put_sys_page(unsigned long addr) ...@@ -268,6 +268,19 @@ static void svm_migrate_put_sys_page(unsigned long addr)
put_page(page); put_page(page);
} }
static unsigned long svm_migrate_successful_pages(struct migrate_vma *migrate)
{
unsigned long cpages = 0;
unsigned long i;
for (i = 0; i < migrate->npages; i++) {
if (migrate->src[i] & MIGRATE_PFN_VALID &&
migrate->src[i] & MIGRATE_PFN_MIGRATE)
cpages++;
}
return cpages;
}
static int static int
svm_migrate_copy_to_vram(struct amdgpu_device *adev, struct svm_range *prange, svm_migrate_copy_to_vram(struct amdgpu_device *adev, struct svm_range *prange,
struct migrate_vma *migrate, struct dma_fence **mfence, struct migrate_vma *migrate, struct dma_fence **mfence,
...@@ -429,6 +442,10 @@ svm_migrate_vma_to_vram(struct amdgpu_device *adev, struct svm_range *prange, ...@@ -429,6 +442,10 @@ svm_migrate_vma_to_vram(struct amdgpu_device *adev, struct svm_range *prange,
r = svm_migrate_copy_to_vram(adev, prange, &migrate, &mfence, scratch); r = svm_migrate_copy_to_vram(adev, prange, &migrate, &mfence, scratch);
migrate_vma_pages(&migrate); migrate_vma_pages(&migrate);
pr_debug("successful/cpages/npages 0x%lx/0x%lx/0x%lx\n",
svm_migrate_successful_pages(&migrate), cpages, migrate.npages);
svm_migrate_copy_done(adev, mfence); svm_migrate_copy_done(adev, mfence);
migrate_vma_finalize(&migrate); migrate_vma_finalize(&migrate);
...@@ -665,6 +682,10 @@ svm_migrate_vma_to_ram(struct amdgpu_device *adev, struct svm_range *prange, ...@@ -665,6 +682,10 @@ svm_migrate_vma_to_ram(struct amdgpu_device *adev, struct svm_range *prange,
r = svm_migrate_copy_to_ram(adev, prange, &migrate, &mfence, r = svm_migrate_copy_to_ram(adev, prange, &migrate, &mfence,
scratch, npages); scratch, npages);
migrate_vma_pages(&migrate); migrate_vma_pages(&migrate);
pr_debug("successful/cpages/npages 0x%lx/0x%lx/0x%lx\n",
svm_migrate_successful_pages(&migrate), cpages, migrate.npages);
svm_migrate_copy_done(adev, mfence); svm_migrate_copy_done(adev, mfence);
migrate_vma_finalize(&migrate); migrate_vma_finalize(&migrate);
svm_range_dma_unmap(adev->dev, scratch, 0, npages); svm_range_dma_unmap(adev->dev, scratch, 0, npages);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment