[PATCH] drm/amdkfd: Fix error handling for missing PASID in 'kfd_process_device_init_vm'
Felix Kuehling
felix.kuehling at amd.com
Tue Feb 18 18:37:31 UTC 2025
On 2025-02-17 01:37, Srinivasan Shanmugam wrote:
> In the kfd_process_device_init_vm function, a valid error code is now
> returned when the associated Process Address Space ID (PASID) is not
> present.
>
> If the address space virtual memory (avm) does not have an associated
> PASID, the function sets the ret variable to -EINVAL before proceeding
> to the error handling section. This ensures that the calling function,
> such as kfd_ioctl_acquire_vm, can appropriately handle the error,
> thereby preventing any issues during virtual memory initialization.
>
> Fixes the below:
> drivers/gpu/drm/amd/amdgpu/../amdkfd/kfd_process.c:1694 kfd_process_device_init_vm()
> warn: missing error code 'ret'
>
> drivers/gpu/drm/amd/amdgpu/../amdkfd/kfd_process.c
> 1647 int kfd_process_device_init_vm(struct kfd_process_device *pdd,
> 1648 struct file *drm_file)
> 1649 {
> ...
> 1690
> 1691 if (unlikely(!avm->pasid)) {
> 1692 dev_warn(pdd->dev->adev->dev, "WARN: vm %p has no pasid associated",
> 1693 avm);
> --> 1694 goto err_get_pasid;
>
> ret = -EINVAL?
>
> 1695 }
>
> Fixes: 77b5e447427c ("drm/amdkfd: Have kfd driver use same PASID values from graphic driver")
> Reported by: Dan Carpenter <dan.carpenter at linaro.org>
> Cc: Xiaogang Chen <xiaogang.chen at amd.com>
> Cc: Felix Kuehling <felix.kuehling at amd.com>
> Cc: Christian König <christian.koenig at amd.com>
> Cc: Alex Deucher <alexander.deucher at amd.com>
> Signed-off-by: Srinivasan Shanmugam <srinivasan.shanmugam at amd.com>
Reviewed-by: Felix Kuehling <felix.kuehling at amd.com>
> ---
> drivers/gpu/drm/amd/amdkfd/kfd_process.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_process.c b/drivers/gpu/drm/amd/amdkfd/kfd_process.c
> index f45e33f79d36..1067afdb456e 100644
> --- a/drivers/gpu/drm/amd/amdkfd/kfd_process.c
> +++ b/drivers/gpu/drm/amd/amdkfd/kfd_process.c
> @@ -1691,6 +1691,7 @@ int kfd_process_device_init_vm(struct kfd_process_device *pdd,
> if (unlikely(!avm->pasid)) {
> dev_warn(pdd->dev->adev->dev, "WARN: vm %p has no pasid associated",
> avm);
> + ret = -EINVAL;
> goto err_get_pasid;
> }
>
More information about the amd-gfx
mailing list