Re: [PATCH] drm/amdkfd: fixes for HMM mem allocation

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, Dec 31, 2023 at 9:39 AM Dafna Hirschfeld <dhirschfeld@xxxxxxxxx> wrote:
>
> Few fixes to amdkfd and the doc of
> devm_request_free_mem_region.
>
> Signed-off-by: Dafna Hirschfeld <dhirschfeld@xxxxxxxxx>
> ---
>  drivers/gpu/drm/amd/amdkfd/kfd_migrate.c | 6 +++---
>  kernel/resource.c                        | 2 +-
>  2 files changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_migrate.c b/drivers/gpu/drm/amd/amdkfd/kfd_migrate.c
> index 6c25dab051d5..b8680e0753ca 100644
> --- a/drivers/gpu/drm/amd/amdkfd/kfd_migrate.c
> +++ b/drivers/gpu/drm/amd/amdkfd/kfd_migrate.c
> @@ -1021,7 +1021,7 @@ int kgd2kfd_init_zone_device(struct amdgpu_device *adev)
>         } else {
>                 res = devm_request_free_mem_region(adev->dev, &iomem_resource, size);
>                 if (IS_ERR(res))
> -                       return -ENOMEM;
> +                       return PTR_ERR(res);
>                 pgmap->range.start = res->start;
>                 pgmap->range.end = res->end;
>                 pgmap->type = MEMORY_DEVICE_PRIVATE;
> @@ -1037,10 +1037,10 @@ int kgd2kfd_init_zone_device(struct amdgpu_device *adev)
>         r = devm_memremap_pages(adev->dev, pgmap);
>         if (IS_ERR(r)) {
>                 pr_err("failed to register HMM device memory\n");
> -               /* Disable SVM support capability */
> -               pgmap->type = 0;
>                 if (pgmap->type == MEMORY_DEVICE_PRIVATE)
>                         devm_release_mem_region(adev->dev, res->start, resource_size(res));
> +               /* Disable SVM support capability */
> +               pgmap->type = 0;
>                 return PTR_ERR(r);
>         }
>
> diff --git a/kernel/resource.c b/kernel/resource.c
> index 866ef3663a0b..fe890b874606 100644
> --- a/kernel/resource.c
> +++ b/kernel/resource.c
> @@ -1905,8 +1905,8 @@ get_free_mem_region(struct device *dev, struct resource *base,
>   * devm_request_free_mem_region - find free region for device private memory
>   *
>   * @dev: device struct to bind the resource to
> - * @size: size in bytes of the device memory to add
>   * @base: resource tree to look in
> + * @size: size in bytes of the device memory to add

This change should be a separate patch?  It looks unrelated.

Alex

>   *
>   * This function tries to find an empty range of physical address big enough to
>   * contain the new resource, so that it can later be hotplugged as ZONE_DEVICE
> --
> 2.34.1
>




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux