diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2017-02-16 07:54:41 -0500 |
---|---|---|
committer | Jani Nikula <jani.nikula@intel.com> | 2017-03-09 03:42:44 -0500 |
commit | 89cf83d4e065ff9fbd2ddc674489c8058eeca758 (patch) | |
tree | fba0a44e7da9598715bcf7b045a087f915e77d92 | |
parent | 70647f9163aa4fc7090b0d6795d026ebe3897928 (diff) |
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 <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
Link: http://patchwork.freedesktop.org/patch/msgid/20170216125441.30923-1-chris@chris-wilson.co.uk
Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
(cherry picked from commit c1d2061b28c2aa25ec39b60d9c248e6beebd7315)
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
-rw-r--r-- | drivers/gpu/drm/i915/i915_gem.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c index 6908123162d1..c45af09555dc 100644 --- a/drivers/gpu/drm/i915/i915_gem.c +++ b/drivers/gpu/drm/i915/i915_gem.c | |||
@@ -3029,6 +3029,16 @@ i915_gem_wait_ioctl(struct drm_device *dev, void *data, struct drm_file *file) | |||
3029 | args->timeout_ns -= ktime_to_ns(ktime_sub(ktime_get(), start)); | 3029 | args->timeout_ns -= ktime_to_ns(ktime_sub(ktime_get(), start)); |
3030 | if (args->timeout_ns < 0) | 3030 | if (args->timeout_ns < 0) |
3031 | args->timeout_ns = 0; | 3031 | args->timeout_ns = 0; |
3032 | |||
3033 | /* | ||
3034 | * Apparently ktime isn't accurate enough and occasionally has a | ||
3035 | * bit of mismatch in the jiffies<->nsecs<->ktime loop. So patch | ||
3036 | * things up to make the test happy. We allow up to 1 jiffy. | ||
3037 | * | ||
3038 | * This is a regression from the timespec->ktime conversion. | ||
3039 | */ | ||
3040 | if (ret == -ETIME && !nsecs_to_jiffies(args->timeout_ns)) | ||
3041 | args->timeout_ns = 0; | ||
3032 | } | 3042 | } |
3033 | 3043 | ||
3034 | i915_gem_object_put(obj); | 3044 | i915_gem_object_put(obj); |