From: Alex Deucher <alexdeucher@gmail.com>
To: dri-devel@lists.freedesktop.org
Subject: [PATCH 1/2] amdgpu: fix overflow for timeout calculation
Date: Fri, 20 Nov 2015 19:24:13 -0500 [thread overview]
Message-ID: <1448065454-6805-1-git-send-email-alexander.deucher@amd.com> (raw)
From: Jammy Zhou <Jammy.Zhou@amd.com>
Set the timeout to AMDGPU_TIMEOUT_INFINITE when overflow happens
Signed-off-by: Jammy Zhou <Jammy.Zhou@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
---
amdgpu/amdgpu_cs.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/amdgpu/amdgpu_cs.c b/amdgpu/amdgpu_cs.c
index 4da9821..aa594c4 100644
--- a/amdgpu/amdgpu_cs.c
+++ b/amdgpu/amdgpu_cs.c
@@ -289,12 +289,16 @@ drm_private uint64_t amdgpu_cs_calculate_timeout(uint64_t timeout)
if (timeout != AMDGPU_TIMEOUT_INFINITE) {
struct timespec current;
+ uint64_t current_ns;
r = clock_gettime(CLOCK_MONOTONIC, ¤t);
if (r)
return r;
- timeout += ((uint64_t)current.tv_sec) * 1000000000ull;
- timeout += current.tv_nsec;
+ current_ns = ((uint64_t)current.tv_sec) * 1000000000ull;
+ current_ns += current.tv_nsec;
+ timeout += current_ns;
+ if (timeout < current_ns)
+ timeout = AMDGPU_TIMEOUT_INFINITE;
}
return timeout;
}
--
1.8.3.1
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel
next reply other threads:[~2015-11-21 0:24 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-11-21 0:24 Alex Deucher [this message]
2015-11-21 0:24 ` [PATCH 2/2] amdgpu: Make amdgpu_cs_calculate_timeout() return something sensible on error Alex Deucher
2015-11-21 10:48 ` [PATCH 1/2] amdgpu: fix overflow for timeout calculation Ernst Sjöstrand
2015-11-21 11:07 ` Christian König
2015-11-21 11:25 ` Ernst Sjöstrand
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1448065454-6805-1-git-send-email-alexander.deucher@amd.com \
--to=alexdeucher@gmail.com \
--cc=dri-devel@lists.freedesktop.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox