From mboxrd@z Thu Jan 1 00:00:00 1970 From: =?UTF-8?Q?Christian_K=c3=b6nig?= Subject: Re: [PATCH 1/2] amdgpu: fix overflow for timeout calculation Date: Sat, 21 Nov 2015 12:07:22 +0100 Message-ID: <5650506A.1050401@vodafone.de> References: <1448065454-6805-1-git-send-email-alexander.deucher@amd.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============0567738530==" Return-path: Received: from pegasos-out.vodafone.de (pegasos-out.vodafone.de [80.84.1.38]) by gabe.freedesktop.org (Postfix) with ESMTP id 357356E032 for ; Sat, 21 Nov 2015 03:07:31 -0800 (PST) Received: from localhost (localhost.localdomain [127.0.0.1]) by pegasos-out.vodafone.de (Rohrpostix2 Daemon) with ESMTP id 82D4C4CAA94 for ; Sat, 21 Nov 2015 12:07:29 +0100 (CET) Received: from pegasos-out.vodafone.de ([127.0.0.1]) by localhost (rohrpostix2.prod.vfnet.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id N7j1YrSZSF6N for ; Sat, 21 Nov 2015 12:07:27 +0100 (CET) In-Reply-To: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" To: =?UTF-8?Q?Ernst_Sj=c3=b6strand?= , Alex Deucher Cc: dri-devel@lists.freedesktop.org List-Id: dri-devel@lists.freedesktop.org This is a multi-part message in MIME format. --===============0567738530== Content-Type: multipart/alternative; boundary="------------080207050900070402070202" This is a multi-part message in MIME format. --------------080207050900070402070202 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: quoted-printable On 21.11.2015 11:48, Ernst Sj=C3=B6strand wrote: > I guess the patches should be for=20 > 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 >: > > From: Jammy Zhou > > > Set the timeout to AMDGPU_TIMEOUT_INFINITE when overflow happens > > Signed-off-by: Jammy Zhou > > Reviewed-by: Christian K=C3=B6nig > > --- > 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 !=3D AMDGPU_TIMEOUT_INFINITE) { > struct timespec current; > + uint64_t current_ns; > r =3D clock_gettime(CLOCK_MONOTONIC, ¤t); > if (r) > return r; > > - timeout +=3D ((uint64_t)current.tv_sec) * 100000000= 0ull; > - timeout +=3D current.tv_nsec; > + current_ns =3D ((uint64_t)current.tv_sec) * > 1000000000ull; > + current_ns +=3D current.tv_nsec; > + timeout +=3D current_ns; > + if (timeout < current_ns) > + timeout =3D 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 list > dri-devel@lists.freedesktop.org > http://lists.freedesktop.org/mailman/listinfo/dri-devel --------------080207050900070402070202 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: quoted-printable
On 21.11.2015 11:48, Ernst Sj=C3=B6str= and 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.<= br>
Regards,
Christian.


Regards
//Ernst

2015-11-21 1:24 GMT+01:00 Alex Deucher <ale= xdeucher@gmail.com>:
From: Jammy Zhou <Jammy.Zhou@amd.com&g= t;

Set the timeout to AMDGPU_TIMEOUT_INFINITE when overflow happens

Signed-off-by: Jammy Zhou <Jammy.Zhou@amd.com&g= t;
Reviewed-by: Christian K=C3=B6nig <christian.koenig@a= md.com>
---
=C2=A0amdgpu/amdgpu_cs.c | 8 ++++++--
=C2=A01 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)

=C2=A0 =C2=A0 =C2=A0 =C2=A0 if (timeout !=3D AMDGPU_TIMEOUT_I= NFINITE) {
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 struc= t timespec current;
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0uint6= 4_t current_ns;
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 r =3D= clock_gettime(CLOCK_MONOTONIC, &current);
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 if (r= )
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 return r;

-=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0timeo= ut +=3D ((uint64_t)current.tv_sec) * 1000000000ull;
-=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0timeo= ut +=3D current.tv_nsec;
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0curre= nt_ns =3D ((uint64_t)current.tv_sec) * 1000000000ull;
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0curre= nt_ns +=3D current.tv_nsec;
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0timeo= ut +=3D current_ns;
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0if (t= imeout < current_ns)
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0timeout =3D AMDGPU_TIMEOUT_INFINITE;
=C2=A0 =C2=A0 =C2=A0 =C2=A0 }
=C2=A0 =C2=A0 =C2=A0 =C2=A0 return timeout;
=C2=A0}
--
1.8.3.1

_______________________________________________
dri-devel mailing list
dri-dev= el@lists.freedesktop.org
http://lists.freed= esktop.org/mailman/listinfo/dri-devel



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

--------------080207050900070402070202-- --===============0567738530== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Disposition: inline X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX18KZHJpLWRldmVs IG1haWxpbmcgbGlzdApkcmktZGV2ZWxAbGlzdHMuZnJlZWRlc2t0b3Aub3JnCmh0dHA6Ly9saXN0 cy5mcmVlZGVza3RvcC5vcmcvbWFpbG1hbi9saXN0aW5mby9kcmktZGV2ZWwK --===============0567738530==--