[PATCH 3/3] drm/amdkfd: add invalid pages debug at vram migration

Felix Kuehling felix.kuehling at amd.com
Mon May 17 14:38:18 UTC 2021


Am 2021-05-12 um 1:34 p.m. schrieb Alex Sierra:

> This is for debug purposes only.
> It conditionally generates partial migrations to test mixed
> CPU/GPU memory domain pages in a prange easily.
>
> Signed-off-by: Alex Sierra <alex.sierra at amd.com>
> ---
>  drivers/gpu/drm/amd/amdkfd/kfd_migrate.c | 14 ++++++++++++++
>  1 file changed, 14 insertions(+)
>
> diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_migrate.c b/drivers/gpu/drm/amd/amdkfd/kfd_migrate.c
> index e1cc844b2f4e..4c6e340393fb 100644
> --- a/drivers/gpu/drm/amd/amdkfd/kfd_migrate.c
> +++ b/drivers/gpu/drm/amd/amdkfd/kfd_migrate.c
> @@ -403,6 +403,20 @@ svm_migrate_copy_to_vram(struct amdgpu_device *adev, struct svm_range *prange,
>  		}
>  	}
>  
> +#ifdef DEBUG_FORCE_MIXED_DOMAINS
> +	for (i = 0, j = 0; i < npages; i += 4, j++) {
> +		if (j & 1)
> +			continue;
> +		svm_migrate_put_vram_page(adev, dst[i]);
> +		migrate->dst[i] = 0;
> +		svm_migrate_put_vram_page(adev, dst[i + 1]);
> +		migrate->dst[i + 1] = 0;
> +		svm_migrate_put_vram_page(adev, dst[i + 2]);
> +		migrate->dst[i + 2] = 0;
> +		svm_migrate_put_vram_page(adev, dst[i + 3]);
> +		migrate->dst[i + 3] = 0;
> +	}
> +#endif

You're doing this at the end of svm_migrate_copy_to_vram. If you did it
in the beginning, you could also check that svm_migrate_copy_to_vram
itself is behaving correctly for partial migrations.

Regards,
  Felix


>  out:
>  	return r;
>  }


More information about the amd-gfx mailing list