Re: [Intel-gfx] [PATCH] drm/i915: Squelch any ktime/jiffie rounding errors for wait-ioctl
On Thu, Feb 16, 2017 at 03:42:20PM +0200, Joonas Lahtinen wrote: > On to, 2017-02-16 at 12:54 +, 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 > > Cc: Matthew Auld > > Cc: Joonas Lahtinen > > Cc: # v4.10-rc1+ > > Cc: sta...@vger.kernel.org > > Reviewed-by: Joonas Lahtinen Thanks, pushed. -Chris -- Chris Wilson, Intel Open Source Technology Centre ___ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [Intel-gfx] [PATCH] drm/i915: Squelch any ktime/jiffie rounding errors for wait-ioctl
On to, 2017-02-16 at 12:54 +, 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 > Cc: Matthew Auld > Cc: Joonas Lahtinen > Cc: # v4.10-rc1+ > Cc: sta...@vger.kernel.org Reviewed-by: Joonas Lahtinen 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
[Intel-gfx] [PATCH] drm/i915: Squelch any ktime/jiffie rounding errors for wait-ioctl
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 Cc: Matthew Auld Cc: Joonas Lahtinen Cc: # v4.10-rc1+ Cc: sta...@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