Commit 8c72c3d7 authored by Yong Zhao's avatar Yong Zhao Committed by Oded Gabbay

drm/amdkfd: Rectify the jiffies calculation error with milliseconds v2

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: default avatarYong Zhao <yong.zhao@amd.com>
Signed-off-by: default avatarFelix Kuehling <Felix.Kuehling@amd.com>
Signed-off-by: default avatarOded Gabbay <oded.gabbay@gmail.com>
parent 733fa1f7
...@@ -835,12 +835,12 @@ static int create_queue_cpsch(struct device_queue_manager *dqm, struct queue *q, ...@@ -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, int amdkfd_fence_wait_timeout(unsigned int *fence_addr,
unsigned int fence_value, 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) { 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"); pr_err("qcm fence wait loop timeout expired\n");
return -ETIME; return -ETIME;
} }
......
...@@ -672,7 +672,7 @@ struct kernel_queue *pqm_get_kernel_queue(struct process_queue_manager *pqm, ...@@ -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, int amdkfd_fence_wait_timeout(unsigned int *fence_addr,
unsigned int fence_value, unsigned int fence_value,
unsigned long timeout); unsigned int timeout_ms);
/* Packet Manager */ /* Packet Manager */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment