From: Daniel Vetter <daniel.vetter@ffwll.ch> To: Intel Graphics Development <intel-gfx@lists.freedesktop.org> Cc: LKML <linux-kernel@vger.kernel.org>, Daniel Vetter <daniel.vetter@ffwll.ch>, Dave Gordon <david.s.gordon@intel.com>, Thomas Gleixner <tglx@linutronix.de>, John Stultz <john.stultz@linaro.org>, Daniel Vetter <daniel.vetter@intel.com> Subject: [PATCH] drm/i915: compute wait_ioctl timeout correctly Date: Tue, 2 Dec 2014 16:36:22 +0100 [thread overview] Message-ID: <1417534582-2977-1-git-send-email-daniel.vetter@ffwll.ch> (raw) In-Reply-To: <1417533733-2289-1-git-send-email-daniel.vetter@ffwll.ch> We've lost the +1 required for correct timeouts in commit 5ed0bdf21a85d78e04f89f15ccf227562177cbd9 Author: Thomas Gleixner <tglx@linutronix.de> Date: Wed Jul 16 21:05:06 2014 +0000 drm: i915: Use nsec based interfaces Use ktime_get_raw_ns() and get rid of the back and forth timespec conversions. Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch> Signed-off-by: John Stultz <john.stultz@linaro.org> So fix this up by reinstating our handrolled _timeout function. While at it bother with handling MAX_JIFFIES. v2: Convert to usecs (we don't care about the accuracy anyway) first to avoid overflow issues Dave Gordon spotted. v3: Drop the explicit MAX_JIFFY_OFFSET check, usecs_to_jiffies should take care of that already. It might be a bit too enthusiastic about it though. Cc: Dave Gordon <david.s.gordon@intel.com> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=82749 Cc: Thomas Gleixner <tglx@linutronix.de> Cc: John Stultz <john.stultz@linaro.org> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com> --- drivers/gpu/drm/i915/i915_drv.h | 8 ++++++++ drivers/gpu/drm/i915/i915_gem.c | 3 ++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h index 049482f5d9ac..4ea14a8c31f7 100644 --- a/drivers/gpu/drm/i915/i915_drv.h +++ b/drivers/gpu/drm/i915/i915_drv.h @@ -3097,6 +3097,14 @@ static inline unsigned long msecs_to_jiffies_timeout(const unsigned int m) return min_t(unsigned long, MAX_JIFFY_OFFSET, j + 1); } +static inline unsigned long nsecs_to_jiffies_timeout(const u64 m) +{ + u64 usecs = div_u64(m + 999, 1000); + unsigned long j = usecs_to_jiffies(usecs); + + return min_t(unsigned long, MAX_JIFFY_OFFSET, j + 1); +} + static inline unsigned long timespec_to_jiffies_timeout(const struct timespec *value) { diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c index 9d362d320d82..04a9f26407ae 100644 --- a/drivers/gpu/drm/i915/i915_gem.c +++ b/drivers/gpu/drm/i915/i915_gem.c @@ -1226,7 +1226,8 @@ int __i915_wait_request(struct drm_i915_gem_request *req, if (i915_gem_request_completed(req, true)) return 0; - timeout_expire = timeout ? jiffies + nsecs_to_jiffies((u64)*timeout) : 0; + timeout_expire = timeout ? + jiffies + nsecs_to_jiffies_timeout((u64)*timeout) : 0; if (INTEL_INFO(dev)->gen >= 6 && ring->id == RCS && can_wait_boost(file_priv)) { gen6_rps_boost(dev_priv); -- 1.9.3
WARNING: multiple messages have this Message-ID (diff)
From: Daniel Vetter <daniel.vetter@ffwll.ch> To: Intel Graphics Development <intel-gfx@lists.freedesktop.org> Cc: Daniel Vetter <daniel.vetter@ffwll.ch>, LKML <linux-kernel@vger.kernel.org>, John Stultz <john.stultz@linaro.org>, Daniel Vetter <daniel.vetter@intel.com>, Thomas Gleixner <tglx@linutronix.de> Subject: [PATCH] drm/i915: compute wait_ioctl timeout correctly Date: Tue, 2 Dec 2014 16:36:22 +0100 [thread overview] Message-ID: <1417534582-2977-1-git-send-email-daniel.vetter@ffwll.ch> (raw) In-Reply-To: <1417533733-2289-1-git-send-email-daniel.vetter@ffwll.ch> We've lost the +1 required for correct timeouts in commit 5ed0bdf21a85d78e04f89f15ccf227562177cbd9 Author: Thomas Gleixner <tglx@linutronix.de> Date: Wed Jul 16 21:05:06 2014 +0000 drm: i915: Use nsec based interfaces Use ktime_get_raw_ns() and get rid of the back and forth timespec conversions. Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch> Signed-off-by: John Stultz <john.stultz@linaro.org> So fix this up by reinstating our handrolled _timeout function. While at it bother with handling MAX_JIFFIES. v2: Convert to usecs (we don't care about the accuracy anyway) first to avoid overflow issues Dave Gordon spotted. v3: Drop the explicit MAX_JIFFY_OFFSET check, usecs_to_jiffies should take care of that already. It might be a bit too enthusiastic about it though. Cc: Dave Gordon <david.s.gordon@intel.com> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=82749 Cc: Thomas Gleixner <tglx@linutronix.de> Cc: John Stultz <john.stultz@linaro.org> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com> --- drivers/gpu/drm/i915/i915_drv.h | 8 ++++++++ drivers/gpu/drm/i915/i915_gem.c | 3 ++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h index 049482f5d9ac..4ea14a8c31f7 100644 --- a/drivers/gpu/drm/i915/i915_drv.h +++ b/drivers/gpu/drm/i915/i915_drv.h @@ -3097,6 +3097,14 @@ static inline unsigned long msecs_to_jiffies_timeout(const unsigned int m) return min_t(unsigned long, MAX_JIFFY_OFFSET, j + 1); } +static inline unsigned long nsecs_to_jiffies_timeout(const u64 m) +{ + u64 usecs = div_u64(m + 999, 1000); + unsigned long j = usecs_to_jiffies(usecs); + + return min_t(unsigned long, MAX_JIFFY_OFFSET, j + 1); +} + static inline unsigned long timespec_to_jiffies_timeout(const struct timespec *value) { diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c index 9d362d320d82..04a9f26407ae 100644 --- a/drivers/gpu/drm/i915/i915_gem.c +++ b/drivers/gpu/drm/i915/i915_gem.c @@ -1226,7 +1226,8 @@ int __i915_wait_request(struct drm_i915_gem_request *req, if (i915_gem_request_completed(req, true)) return 0; - timeout_expire = timeout ? jiffies + nsecs_to_jiffies((u64)*timeout) : 0; + timeout_expire = timeout ? + jiffies + nsecs_to_jiffies_timeout((u64)*timeout) : 0; if (INTEL_INFO(dev)->gen >= 6 && ring->id == RCS && can_wait_boost(file_priv)) { gen6_rps_boost(dev_priv); -- 1.9.3 _______________________________________________ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/intel-gfx
next prev parent reply other threads:[~2014-12-02 16:13 UTC|newest] Thread overview: 48+ messages / expand[flat|nested] mbox.gz Atom feed top 2014-11-28 9:29 [PATCH 1/2] drm/i915: compute wait_ioctl timeout correctly Daniel Vetter 2014-11-28 9:29 ` [PATCH 2/2] drm/i915: Handle inaccurate time conversion issues Daniel Vetter 2014-11-28 11:08 ` Chris Wilson 2014-11-28 13:30 ` Daniel Vetter 2014-11-28 12:13 ` Chris Wilson 2014-11-28 19:09 ` [PATCH 2/2] drm/i915: Handle inaccurate time conversion shuang.he 2014-12-08 12:34 ` [PATCH 2/2] drm/i915: Handle inaccurate time conversion issues Jani Nikula 2014-11-28 10:09 ` [PATCH 1/2] drm/i915: compute wait_ioctl timeout correctly Chris Wilson 2014-11-28 13:46 ` Dave Gordon 2014-12-02 14:56 ` Daniel Vetter 2014-12-02 15:22 ` [PATCH] " Daniel Vetter 2014-12-02 15:22 ` Daniel Vetter 2014-12-02 15:36 ` Daniel Vetter [this message] 2014-12-02 15:36 ` Daniel Vetter 2014-12-02 16:35 ` [Intel-gfx] " Chris Wilson 2014-12-02 16:35 ` Chris Wilson 2014-12-02 16:54 ` [Intel-gfx] " John Stultz 2014-12-03 9:22 ` Daniel Vetter 2014-12-03 9:22 ` Daniel Vetter 2014-12-03 10:28 ` [Intel-gfx] " Imre Deak 2014-12-03 10:28 ` Imre Deak 2014-12-03 14:30 ` [Intel-gfx] " Daniel Vetter 2014-12-03 14:30 ` Daniel Vetter 2014-12-03 19:07 ` [Intel-gfx] " John Stultz 2014-12-03 19:07 ` John Stultz 2014-12-04 10:42 ` [Intel-gfx] " Daniel Vetter 2014-12-04 10:42 ` Daniel Vetter 2014-12-04 17:42 ` [Intel-gfx] " John Stultz 2014-12-04 17:42 ` John Stultz 2014-12-04 17:50 ` [Intel-gfx] " Daniel Vetter 2014-12-04 17:50 ` Daniel Vetter 2014-12-04 18:16 ` [Intel-gfx] " John Stultz 2014-12-04 18:16 ` John Stultz 2014-12-04 18:51 ` [Intel-gfx] " Daniel Vetter 2014-12-04 18:51 ` Daniel Vetter 2014-12-04 20:35 ` [Intel-gfx] " John Stultz 2014-12-04 20:35 ` John Stultz 2014-12-05 9:16 ` [Intel-gfx] " Daniel Vetter 2014-12-05 9:16 ` Daniel Vetter 2014-12-03 5:21 ` shuang.he 2014-12-03 5:51 ` shuang.he 2014-12-04 10:12 ` Daniel Vetter 2014-12-04 10:12 ` Daniel Vetter 2014-12-04 17:03 ` shuang.he 2014-12-04 17:45 ` John Stultz 2014-12-04 17:45 ` John Stultz 2014-12-08 12:34 ` [Intel-gfx] " Jani Nikula 2014-12-08 12:34 ` Jani Nikula
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=1417534582-2977-1-git-send-email-daniel.vetter@ffwll.ch \ --to=daniel.vetter@ffwll.ch \ --cc=daniel.vetter@intel.com \ --cc=david.s.gordon@intel.com \ --cc=intel-gfx@lists.freedesktop.org \ --cc=john.stultz@linaro.org \ --cc=linux-kernel@vger.kernel.org \ --cc=tglx@linutronix.de \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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.