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

Jan Vesely jan.vesely at rutgers.edu
Sat Sep 16 00:09:04 UTC 2017


On Fri, 2017-09-15 at 19:42 -0400, Felix Kuehling wrote:
> From: Yong Zhao <yong.zhao at amd.com>
> 
> The timeout in milliseconds should not be regarded as jiffies. This
> commit fixed that.
> 
> 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 | 8 +++++---
>  drivers/gpu/drm/amd/amdkfd/kfd_priv.h                 | 2 +-
>  2 files changed, 6 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..3db6a31 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,14 @@ 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 long timeout_ms)
>  {
> -	timeout += jiffies;
> +	unsigned long end_jiffies;
> +
> +	end_jiffies = (timeout_ms * HZ / 1000) + jiffies;

msecs_to_jiffies? (jiffies.h)

Jan

>  
>  	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..f8d6a8e 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 long timeout_ms);
>  
>  /* Packet Manager */
>  
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: This is a digitally signed message part
URL: <https://lists.freedesktop.org/archives/amd-gfx/attachments/20170915/69b153ed/attachment.sig>


More information about the amd-gfx mailing list