All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/i915: Squelch any ktime/jiffie rounding errors for wait-ioctl
@ 2017-02-16 12:54 ` Chris Wilson
  0 siblings, 0 replies; 6+ messages in thread
From: Chris Wilson @ 2017-02-16 12:54 UTC (permalink / raw)
  To: intel-gfx
  Cc: Chris Wilson, Matthew Auld, Joonas Lahtinen, # v4 . 10-rc1+, stable

We wait upon jiffies, but report the time elapsed using a
high-resolution timer. This discrepancy can lead to us timing out the
wait prior to us reporting the elapsed time as complete.

This restores the squelching lost in commit e95433c73a11 ("drm/i915:
Rearrange i915_wait_request() accounting with callers").

Fixes: e95433c73a11 ("drm/i915: Rearrange i915_wait_request() accounting with callers")
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Matthew Auld <matthew.william.auld@gmail.com>
Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Cc: <drm-intel-fixes@lists.freedesktop.org> # v4.10-rc1+
Cc: stable@vger.kernel.org
---
 drivers/gpu/drm/i915/i915_gem.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index 98c483cf805c..6a159ed7ed08 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -3116,6 +3116,16 @@ i915_gem_wait_ioctl(struct drm_device *dev, void *data, struct drm_file *file)
 		args->timeout_ns -= ktime_to_ns(ktime_sub(ktime_get(), start));
 		if (args->timeout_ns < 0)
 			args->timeout_ns = 0;
+
+		/*
+		 * Apparently ktime isn't accurate enough and occasionally has a
+		 * bit of mismatch in the jiffies<->nsecs<->ktime loop. So patch
+		 * things up to make the test happy. We allow up to 1 jiffy.
+		 *
+		 * This is a regrssion from the timespec->ktime conversion.
+		 */
+		if (ret == -ETIME && !nsecs_to_jiffies(args->timeout_ns))
+			args->timeout_ns = 0;
 	}
 
 	i915_gem_object_put(obj);
-- 
2.11.0

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

* [PATCH] drm/i915: Squelch any ktime/jiffie rounding errors for wait-ioctl
@ 2017-02-16 12:54 ` Chris Wilson
  0 siblings, 0 replies; 6+ messages in thread
From: Chris Wilson @ 2017-02-16 12:54 UTC (permalink / raw)
  To: intel-gfx; +Cc: # v4 . 10-rc1+, stable

We wait upon jiffies, but report the time elapsed using a
high-resolution timer. This discrepancy can lead to us timing out the
wait prior to us reporting the elapsed time as complete.

This restores the squelching lost in commit e95433c73a11 ("drm/i915:
Rearrange i915_wait_request() accounting with callers").

Fixes: e95433c73a11 ("drm/i915: Rearrange i915_wait_request() accounting with callers")
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Matthew Auld <matthew.william.auld@gmail.com>
Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Cc: <drm-intel-fixes@lists.freedesktop.org> # v4.10-rc1+
Cc: stable@vger.kernel.org
---
 drivers/gpu/drm/i915/i915_gem.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index 98c483cf805c..6a159ed7ed08 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -3116,6 +3116,16 @@ i915_gem_wait_ioctl(struct drm_device *dev, void *data, struct drm_file *file)
 		args->timeout_ns -= ktime_to_ns(ktime_sub(ktime_get(), start));
 		if (args->timeout_ns < 0)
 			args->timeout_ns = 0;
+
+		/*
+		 * Apparently ktime isn't accurate enough and occasionally has a
+		 * bit of mismatch in the jiffies<->nsecs<->ktime loop. So patch
+		 * things up to make the test happy. We allow up to 1 jiffy.
+		 *
+		 * This is a regrssion from the timespec->ktime conversion.
+		 */
+		if (ret == -ETIME && !nsecs_to_jiffies(args->timeout_ns))
+			args->timeout_ns = 0;
 	}
 
 	i915_gem_object_put(obj);
-- 
2.11.0

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* Re: [PATCH] drm/i915: Squelch any ktime/jiffie rounding errors for wait-ioctl
  2017-02-16 12:54 ` Chris Wilson
@ 2017-02-16 13:42   ` Joonas Lahtinen
  -1 siblings, 0 replies; 6+ messages in thread
From: Joonas Lahtinen @ 2017-02-16 13:42 UTC (permalink / raw)
  To: Chris Wilson, intel-gfx; +Cc: Matthew Auld, # v4 . 10-rc1+, stable

On to, 2017-02-16 at 12:54 +0000, Chris Wilson wrote:
> We wait upon jiffies, but report the time elapsed using a
> high-resolution timer. This discrepancy can lead to us timing out the
> wait prior to us reporting the elapsed time as complete.
> 
> This restores the squelching lost in commit e95433c73a11 ("drm/i915:
> Rearrange i915_wait_request() accounting with callers").
> 
> Fixes: e95433c73a11 ("drm/i915: Rearrange i915_wait_request() accounting with callers")
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Matthew Auld <matthew.william.auld@gmail.com>
> Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
> Cc: <drm-intel-fixes@lists.freedesktop.org> # v4.10-rc1+
> Cc: stable@vger.kernel.org

Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>

Regards, Joonas
-- 
Joonas Lahtinen
Open Source Technology Center
Intel Corporation

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

* Re: [PATCH] drm/i915: Squelch any ktime/jiffie rounding errors for wait-ioctl
@ 2017-02-16 13:42   ` Joonas Lahtinen
  0 siblings, 0 replies; 6+ messages in thread
From: Joonas Lahtinen @ 2017-02-16 13:42 UTC (permalink / raw)
  To: Chris Wilson, intel-gfx; +Cc: # v4 . 10-rc1+, stable

On to, 2017-02-16 at 12:54 +0000, Chris Wilson wrote:
> We wait upon jiffies, but report the time elapsed using a
> high-resolution timer. This discrepancy can lead to us timing out the
> wait prior to us reporting the elapsed time as complete.
> 
> This restores the squelching lost in commit e95433c73a11 ("drm/i915:
> Rearrange i915_wait_request() accounting with callers").
> 
> Fixes: e95433c73a11 ("drm/i915: Rearrange i915_wait_request() accounting with callers")
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Matthew Auld <matthew.william.auld@gmail.com>
> Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
> Cc: <drm-intel-fixes@lists.freedesktop.org> # v4.10-rc1+
> Cc: stable@vger.kernel.org

Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>

Regards, Joonas
-- 
Joonas Lahtinen
Open Source Technology Center
Intel Corporation
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* ✓ Fi.CI.BAT: success for drm/i915: Squelch any ktime/jiffie rounding errors for wait-ioctl
  2017-02-16 12:54 ` Chris Wilson
  (?)
  (?)
@ 2017-02-16 17:22 ` Patchwork
  -1 siblings, 0 replies; 6+ messages in thread
From: Patchwork @ 2017-02-16 17:22 UTC (permalink / raw)
  To: Chris Wilson; +Cc: intel-gfx

== Series Details ==

Series: drm/i915: Squelch any ktime/jiffie rounding errors for wait-ioctl
URL   : https://patchwork.freedesktop.org/series/19780/
State : success

== Summary ==

Series 19780v1 drm/i915: Squelch any ktime/jiffie rounding errors for wait-ioctl
https://patchwork.freedesktop.org/api/1.0/series/19780/revisions/1/mbox/

fi-bdw-5557u     total:252  pass:241  dwarn:0   dfail:0   fail:0   skip:11 
fi-bsw-n3050     total:252  pass:213  dwarn:0   dfail:0   fail:0   skip:39 
fi-bxt-j4205     total:252  pass:233  dwarn:0   dfail:0   fail:0   skip:19 
fi-bxt-t5700     total:83   pass:70   dwarn:0   dfail:0   fail:0   skip:12 
fi-byt-j1900     total:252  pass:225  dwarn:0   dfail:0   fail:0   skip:27 
fi-byt-n2820     total:252  pass:221  dwarn:0   dfail:0   fail:0   skip:31 
fi-hsw-4770      total:252  pass:236  dwarn:0   dfail:0   fail:0   skip:16 
fi-hsw-4770r     total:252  pass:236  dwarn:0   dfail:0   fail:0   skip:16 
fi-ilk-650       total:252  pass:202  dwarn:0   dfail:0   fail:0   skip:50 
fi-ivb-3520m     total:252  pass:234  dwarn:0   dfail:0   fail:0   skip:18 
fi-ivb-3770      total:252  pass:234  dwarn:0   dfail:0   fail:0   skip:18 
fi-kbl-7500u     total:252  pass:234  dwarn:0   dfail:0   fail:0   skip:18 
fi-skl-6260u     total:252  pass:242  dwarn:0   dfail:0   fail:0   skip:10 
fi-skl-6700hq    total:252  pass:235  dwarn:0   dfail:0   fail:0   skip:17 
fi-skl-6700k     total:252  pass:230  dwarn:4   dfail:0   fail:0   skip:18 
fi-skl-6770hq    total:252  pass:242  dwarn:0   dfail:0   fail:0   skip:10 
fi-snb-2520m     total:252  pass:224  dwarn:0   dfail:0   fail:0   skip:28 
fi-snb-2600      total:252  pass:223  dwarn:0   dfail:0   fail:0   skip:29 

b29710e319e4b58d994065f5e776f6f66674d7c9 drm-tip: 2017y-02m-16d-15h-35m-40s UTC integration manifest
c891169 drm/i915: Squelch any ktime/jiffie rounding errors for wait-ioctl

== Logs ==

For more details see: https://intel-gfx-ci.01.org/CI/Patchwork_3856/
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* Re: [PATCH] drm/i915: Squelch any ktime/jiffie rounding errors for wait-ioctl
  2017-02-16 13:42   ` Joonas Lahtinen
  (?)
@ 2017-02-16 20:59   ` Chris Wilson
  -1 siblings, 0 replies; 6+ messages in thread
From: Chris Wilson @ 2017-02-16 20:59 UTC (permalink / raw)
  To: Joonas Lahtinen; +Cc: intel-gfx, Matthew Auld, # v4 . 10-rc1+, stable

On Thu, Feb 16, 2017 at 03:42:20PM +0200, Joonas Lahtinen wrote:
> On to, 2017-02-16 at 12:54 +0000, Chris Wilson wrote:
> > We wait upon jiffies, but report the time elapsed using a
> > high-resolution timer. This discrepancy can lead to us timing out the
> > wait prior to us reporting the elapsed time as complete.
> > 
> > This restores the squelching lost in commit e95433c73a11 ("drm/i915:
> > Rearrange i915_wait_request() accounting with callers").
> > 
> > Fixes: e95433c73a11 ("drm/i915: Rearrange i915_wait_request() accounting with callers")
> > Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> > Cc: Matthew Auld <matthew.william.auld@gmail.com>
> > Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
> > Cc: <drm-intel-fixes@lists.freedesktop.org> # v4.10-rc1+
> > Cc: stable@vger.kernel.org
> 
> Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>

Thanks, pushed.
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre

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

end of thread, other threads:[~2017-02-16 20:59 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-02-16 12:54 [PATCH] drm/i915: Squelch any ktime/jiffie rounding errors for wait-ioctl Chris Wilson
2017-02-16 12:54 ` Chris Wilson
2017-02-16 13:42 ` Joonas Lahtinen
2017-02-16 13:42   ` Joonas Lahtinen
2017-02-16 20:59   ` Chris Wilson
2017-02-16 17:22 ` ✓ Fi.CI.BAT: success for " Patchwork

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.