All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] amdgpu: fix overflow for timeout calculation
@ 2015-11-21  0:24 Alex Deucher
  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
  0 siblings, 2 replies; 5+ messages in thread
From: Alex Deucher @ 2015-11-21  0:24 UTC (permalink / raw)
  To: dri-devel

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, &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@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 2/2] amdgpu: Make amdgpu_cs_calculate_timeout() return something sensible on error
  2015-11-21  0:24 [PATCH 1/2] amdgpu: fix overflow for timeout calculation Alex Deucher
@ 2015-11-21  0:24 ` Alex Deucher
  2015-11-21 10:48 ` [PATCH 1/2] amdgpu: fix overflow for timeout calculation Ernst Sjöstrand
  1 sibling, 0 replies; 5+ messages in thread
From: Alex Deucher @ 2015-11-21  0:24 UTC (permalink / raw)
  To: dri-devel; +Cc: Tom St Denis

From: Tom St Denis <tom.stdenis@amd.com>

Signed-off-by: Tom St Denis <tom.stdenis@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
---
 amdgpu/amdgpu_cs.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/amdgpu/amdgpu_cs.c b/amdgpu/amdgpu_cs.c
index aa594c4..6747158 100644
--- a/amdgpu/amdgpu_cs.c
+++ b/amdgpu/amdgpu_cs.c
@@ -291,8 +291,10 @@ drm_private uint64_t amdgpu_cs_calculate_timeout(uint64_t timeout)
 		struct timespec current;
 		uint64_t current_ns;
 		r = clock_gettime(CLOCK_MONOTONIC, &current);
-		if (r)
-			return r;
+		if (r) {
+			fprintf(stderr, "clock_gettime() returned error (%d)!", errno);
+			return AMDGPU_TIMEOUT_INFINITE;
+		}
 
 		current_ns = ((uint64_t)current.tv_sec) * 1000000000ull;
 		current_ns += current.tv_nsec;
-- 
1.8.3.1

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/2] amdgpu: fix overflow for timeout calculation
  2015-11-21  0:24 [PATCH 1/2] amdgpu: fix overflow for timeout calculation Alex Deucher
  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 ` Ernst Sjöstrand
  2015-11-21 11:07   ` Christian König
  1 sibling, 1 reply; 5+ messages in thread
From: Ernst Sjöstrand @ 2015-11-21 10:48 UTC (permalink / raw)
  To: Alex Deucher; +Cc: dri-devel


[-- Attachment #1.1: Type: text/plain, Size: 1643 bytes --]

I guess the patches should be for drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
instead?

Regards
//Ernst

2015-11-21 1:24 GMT+01:00 Alex Deucher <alexdeucher@gmail.com>:

> 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, &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@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel
>

[-- Attachment #1.2: Type: text/html, Size: 2551 bytes --]

[-- Attachment #2: Type: text/plain, Size: 159 bytes --]

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/2] amdgpu: fix overflow for timeout calculation
  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
  0 siblings, 1 reply; 5+ messages in thread
From: Christian König @ 2015-11-21 11:07 UTC (permalink / raw)
  To: Ernst Sjöstrand, Alex Deucher; +Cc: dri-devel


[-- Attachment #1.1: Type: text/plain, Size: 2317 bytes --]

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@gmail.com 
> <mailto:alexdeucher@gmail.com>>:
>
>     From: Jammy Zhou <Jammy.Zhou@amd.com <mailto:Jammy.Zhou@amd.com>>
>
>     Set the timeout to AMDGPU_TIMEOUT_INFINITE when overflow happens
>
>     Signed-off-by: Jammy Zhou <Jammy.Zhou@amd.com
>     <mailto:Jammy.Zhou@amd.com>>
>     Reviewed-by: Christian König <christian.koenig@amd.com
>     <mailto: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, &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@lists.freedesktop.org
>     <mailto:dri-devel@lists.freedesktop.org>
>     http://lists.freedesktop.org/mailman/listinfo/dri-devel
>
>
>
>
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel


[-- Attachment #1.2: Type: text/html, Size: 4768 bytes --]

[-- Attachment #2: Type: text/plain, Size: 159 bytes --]

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/2] amdgpu: fix overflow for timeout calculation
  2015-11-21 11:07   ` Christian König
@ 2015-11-21 11:25     ` Ernst Sjöstrand
  0 siblings, 0 replies; 5+ messages in thread
From: Ernst Sjöstrand @ 2015-11-21 11:25 UTC (permalink / raw)
  To: Christian König; +Cc: dri-devel


[-- Attachment #1.1: Type: text/plain, Size: 2171 bytes --]

Doh, I didn't get that! Sorry.

Regards
//Ernst

2015-11-21 12:07 GMT+01:00 Christian König <deathsimple@vodafone.de>:

> 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@gmail.com>:
>
>> 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, &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@lists.freedesktop.org
>> http://lists.freedesktop.org/mailman/listinfo/dri-devel
>>
>
>
>
> _______________________________________________
> dri-devel mailing listdri-devel@lists.freedesktop.orghttp://lists.freedesktop.org/mailman/listinfo/dri-devel
>
>
>

[-- Attachment #1.2: Type: text/html, Size: 4681 bytes --]

[-- Attachment #2: Type: text/plain, Size: 159 bytes --]

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2015-11-21 11:25 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-11-21  0:24 [PATCH 1/2] amdgpu: fix overflow for timeout calculation Alex Deucher
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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.