drm/amdkfd: Rectify the jiffies calculation error with milliseconds v2
authorYong Zhao <yong.zhao@amd.com>
Wed, 20 Sep 2017 22:10:15 +0000 (18:10 -0400)
committerOded Gabbay <oded.gabbay@gmail.com>
Wed, 20 Sep 2017 22:10:15 +0000 (18:10 -0400)
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@amd.com>
Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
Signed-off-by: Oded Gabbay <oded.gabbay@gmail.com>
drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c
drivers/gpu/drm/amd/amdkfd/kfd_priv.h

index 5db82b8..87961fe 100644 (file)
@@ -835,12 +835,12 @@ out:
 
 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;
                }
index c711604..f37fbfd 100644 (file)
@@ -672,7 +672,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 */