[PATCH 03/11] drm/amdkfd: Rectify the jiffies calculation error with milliseconds
Felix Kuehling
Felix.Kuehling at amd.com
Fri Sep 15 23:42:54 UTC 2017
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;
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 */
--
2.7.4
More information about the amd-gfx
mailing list