From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ville =?iso-8859-1?Q?Syrj=E4l=E4?= Subject: Re: [PATCH] drm/i915: Always normalize return timeout for wait_timeout_ioctl Date: Tue, 9 Apr 2013 12:26:55 +0300 Message-ID: <20130409092655.GL4469@intel.com> References: <20130409090740.GT2228@phenom.ffwll.local> <1365498803-16510-1-git-send-email-chris@chris-wilson.co.uk> Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Return-path: Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by gabe.freedesktop.org (Postfix) with ESMTP id 99EE2E6031 for ; Tue, 9 Apr 2013 02:26:59 -0700 (PDT) Content-Disposition: inline In-Reply-To: <1365498803-16510-1-git-send-email-chris@chris-wilson.co.uk> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: intel-gfx-bounces+gcfxdi-intel-gfx=m.gmane.org@lists.freedesktop.org Errors-To: intel-gfx-bounces+gcfxdi-intel-gfx=m.gmane.org@lists.freedesktop.org To: Chris Wilson Cc: intel-gfx@lists.freedesktop.org, Ben Widawsky List-Id: intel-gfx@lists.freedesktop.org On Tue, Apr 09, 2013 at 10:13:23AM +0100, Chris Wilson wrote: > As we recompute the remaining timeout after waiting, there is a > potential for that timeout to be less than zero and so need sanitizing. > The timeout is always returned to userspace and validated, so we should > always perform the sanitation. > = > Cc: Ville Syrj=E4l=E4 > Cc: Ben Widawsky > Signed-off-by: Chris Wilson > --- > drivers/gpu/drm/i915/i915_gem.c | 3 +-- > 1 file changed, 1 insertion(+), 2 deletions(-) > = > diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_= gem.c > index 63c05dd..fcf8492 100644 > --- a/drivers/gpu/drm/i915/i915_gem.c > +++ b/drivers/gpu/drm/i915/i915_gem.c > @@ -1045,6 +1045,7 @@ static int __wait_seqno(struct intel_ring_buffer *r= ing, u32 seqno, > if (timeout) { > struct timespec sleep_time =3D timespec_sub(now, before); > *timeout =3D timespec_sub(*timeout, sleep_time); > + set_normalized_timespec(timeout, 0, 0); This will just set timeout =3D {0,0}, no? And timespec_sub() should already return a normalized timespec, so I guess the warning would just trigger when sleep_time > timeout. So we should maybe just check for that case, and only then set timeout=3D{0,0}? > } > = > switch (end) { > @@ -1053,8 +1054,6 @@ static int __wait_seqno(struct intel_ring_buffer *r= ing, u32 seqno, > case -ERESTARTSYS: /* Signal */ > return (int)end; > case 0: /* Timeout */ > - if (timeout) > - set_normalized_timespec(timeout, 0, 0); > return -ETIME; > default: /* Completed */ > WARN_ON(end < 0); /* We're not aware of other errors */ > -- = > 1.7.10.4 -- = Ville Syrj=E4l=E4 Intel OTC