[PATCH 1/2] amdgpu: fix overflow for timeout calculation

Christian König deathsimple at vodafone.de
Sat Nov 21 03:07:22 PST 2015


On 21.11.2015 11:48, Ernst Sjöstrand wrote:
> I guess the patches should be for 
> drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c instead?

No, why do you think so? This is a libdrm patch, not a kernel patch.

Regards,
Christian.

>
> Regards
> //Ernst
>
> 2015-11-21 1:24 GMT+01:00 Alex Deucher <alexdeucher at gmail.com 
> <mailto:alexdeucher at gmail.com>>:
>
>     From: Jammy Zhou <Jammy.Zhou at amd.com <mailto:Jammy.Zhou at amd.com>>
>
>     Set the timeout to AMDGPU_TIMEOUT_INFINITE when overflow happens
>
>     Signed-off-by: Jammy Zhou <Jammy.Zhou at amd.com
>     <mailto:Jammy.Zhou at amd.com>>
>     Reviewed-by: Christian König <christian.koenig at amd.com
>     <mailto:christian.koenig at 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, &current);
>                     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 at lists.freedesktop.org
>     <mailto:dri-devel at lists.freedesktop.org>
>     http://lists.freedesktop.org/mailman/listinfo/dri-devel
>
>
>
>
> _______________________________________________
> dri-devel mailing list
> dri-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/dri-devel/attachments/20151121/9eeb67e7/attachment.html>


More information about the dri-devel mailing list