[PATCH 2/2] drm/amdkfd: set new unregistered range accessible by GPU

Felix Kuehling felix.kuehling at amd.com
Wed May 5 20:03:44 UTC 2021


Am 2021-05-05 um 1:56 p.m. schrieb Philip Yang:
> GPU retry vm fault on unregistered address, new range is created to
> recover the retry vm fault. Instead of setting new range perferred_loc
> to GPU, add GPU to new range access_bitmap, to be able to update GPU
> page table after new range migrate to VRAM. The new range preferred_loc
> is default value KFD_IOCTL_SVM_LOCATION_UNDEFINED.
>
> Correct one typo.
>
> Signed-off-by: Philip Yang <Philip.Yang at amd.com>
> ---
>  drivers/gpu/drm/amd/amdkfd/kfd_svm.c | 7 +++----
>  1 file changed, 3 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_svm.c b/drivers/gpu/drm/amd/amdkfd/kfd_svm.c
> index 3b640772d9c5..5a486e0fbf18 100644
> --- a/drivers/gpu/drm/amd/amdkfd/kfd_svm.c
> +++ b/drivers/gpu/drm/amd/amdkfd/kfd_svm.c
> @@ -2243,7 +2243,7 @@ svm_range *svm_range_create_unregistered_range(struct amdgpu_device *adev,
>  
>  	prange = svm_range_new(&p->svms, start, last);
>  	if (!prange) {
> -		pr_debug("Failed to create prange in address [0x%llx]\\n", addr);
> +		pr_debug("Failed to create prange in address [0x%llx]\n", addr);
>  		return NULL;
>  	}
>  	if (kfd_process_gpuid_from_kgd(p, adev, &gpuid, &gpuidx)) {
> @@ -2251,9 +2251,8 @@ svm_range *svm_range_create_unregistered_range(struct amdgpu_device *adev,
>  		svm_range_free(prange);
>  		return NULL;
>  	}
> -	prange->preferred_loc = gpuid;
> -	prange->actual_loc = 0;
> -	/* Gurantee prange is migrate it */
> +
> +	bitmap_set(prange->bitmap_access, gpuidx, 1);

By default, with XNACK enabled, the default should be that all GPUs have
access to memory (but not access in place).

Regards,
  Felix


>  	svm_range_add_to_svms(prange);
>  	svm_range_add_notifier_locked(mm, prange);
>  


More information about the amd-gfx mailing list