[PATCH 03/10] drm/amdkfd: Rectify the jiffies calculation error with milliseconds v2

Oded Gabbay oded.gabbay at gmail.com
Sun Sep 24 10:32:32 UTC 2017


On Thu, Sep 21, 2017 at 1:10 AM, Felix Kuehling <Felix.Kuehling at amd.com> wrote:
> From: Yong Zhao <yong.zhao at amd.com>
>
> The timeout in milliseconds should not be regarded as jiffies. This
> commit fixed that.
>
> v2:
> - use msecs_to_jiffies
> - change timeout_ms parameter to unsigned int to match msecs_to_jiffies
>
> Signed-off-by: Yong Zhao <yong.zhao at amd.com>
> Signed-off-by: Felix Kuehling <Felix.Kuehling at amd.com>
> ---
>  drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c | 6 +++---
>  drivers/gpu/drm/amd/amdkfd/kfd_priv.h                 | 2 +-
>  2 files changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c b/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c
> index 5db82b8..87961fe 100644
> --- a/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c
> +++ b/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c
> @@ -835,12 +835,12 @@ static int create_queue_cpsch(struct device_queue_manager *dqm, struct queue *q,
>
>  int amdkfd_fence_wait_timeout(unsigned int *fence_addr,
>                                 unsigned int fence_value,
> -                               unsigned long timeout)
> +                               unsigned int timeout_ms)
>  {
> -       timeout += jiffies;
> +       unsigned long end_jiffies = msecs_to_jiffies(timeout_ms) + jiffies;
>
>         while (*fence_addr != fence_value) {
> -               if (time_after(jiffies, timeout)) {
> +               if (time_after(jiffies, end_jiffies)) {
>                         pr_err("qcm fence wait loop timeout expired\n");
>                         return -ETIME;
>                 }
> diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_priv.h b/drivers/gpu/drm/amd/amdkfd/kfd_priv.h
> index ef582cc..1c341b3 100644
> --- a/drivers/gpu/drm/amd/amdkfd/kfd_priv.h
> +++ b/drivers/gpu/drm/amd/amdkfd/kfd_priv.h
> @@ -669,7 +669,7 @@ struct kernel_queue *pqm_get_kernel_queue(struct process_queue_manager *pqm,
>
>  int amdkfd_fence_wait_timeout(unsigned int *fence_addr,
>                                 unsigned int fence_value,
> -                               unsigned long timeout);
> +                               unsigned int timeout_ms);
>
>  /* Packet Manager */
>
> --
> 2.7.4
>

This patch is:
Reviewed-by: Oded Gabbay <oded.gabbay at gmail.com>


More information about the amd-gfx mailing list