All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/4] drm/i915: add msecs_to_jiffies_timeout to guarantee minimum duration
@ 2013-05-21 17:03 Imre Deak
  2013-05-21 17:03 ` [PATCH 2/4] drm/i915: use msecs_to_jiffies_timeout instead of open coding the same Imre Deak
                   ` (3 more replies)
  0 siblings, 4 replies; 11+ messages in thread
From: Imre Deak @ 2013-05-21 17:03 UTC (permalink / raw)
  To: intel-gfx

We need this to avoid premature timeouts whenever scheduling a timeout
based on the current jiffies value. For an explanation see [1].
The following patches will take the helper into use.

Once the more generic solution proposed in the thread at [1] is accepted
this patch can be reverted while keeping the follow-up patches.

[1] http://marc.info/?l=linux-kernel&m=136854294730957&w=2

Signed-off-by: Imre Deak <imre.deak@intel.com>
---
 drivers/gpu/drm/i915/i915_drv.h | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index 639ec0b..78b6c56 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -1981,4 +1981,19 @@ static inline void __user *to_user_ptr(u64 address)
 	return (void __user *)(uintptr_t)address;
 }
 
+static inline unsigned long msecs_to_jiffies_timeout(const unsigned int m)
+{
+	unsigned long j = msecs_to_jiffies(m);
+
+	return min_t(unsigned long, MAX_JIFFY_OFFSET, j + 1);
+}
+
+static inline unsigned long
+timespec_to_jiffies_timeout(const struct timespec *value)
+{
+	unsigned long j = timespec_to_jiffies(value);
+
+	return min_t(unsigned long, MAX_JIFFY_OFFSET, j + 1);
+}
+
 #endif
-- 
1.8.1.2

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

end of thread, other threads:[~2013-05-22 11:52 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-05-21 17:03 [PATCH 1/4] drm/i915: add msecs_to_jiffies_timeout to guarantee minimum duration Imre Deak
2013-05-21 17:03 ` [PATCH 2/4] drm/i915: use msecs_to_jiffies_timeout instead of open coding the same Imre Deak
2013-05-21 17:20   ` Daniel Vetter
2013-05-21 18:00     ` Imre Deak
2013-05-21 18:20       ` Daniel Vetter
2013-05-21 17:03 ` [PATCH 3/4] drm/i915: avoid premature timeouts in __wait_seqno() Imre Deak
2013-05-21 17:03 ` [PATCH 4/4] drm/i915: avoid premature DP AUX timeouts Imre Deak
2013-05-22  7:48 ` [PATCH 1/4] drm/i915: add msecs_to_jiffies_timeout to guarantee minimum duration Jani Nikula
2013-05-22  9:46   ` Daniel Vetter
2013-05-22  9:57     ` Imre Deak
2013-05-22 11:51       ` Daniel Vetter

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.