[Intel-gfx] [RFC] drm/i915: _wait_for might be called when irq is off
deepak.s at linux.intel.com
deepak.s at linux.intel.com
Thu Apr 2 06:51:40 PDT 2015
From: Deepak S <deepak.s at linux.intel.com>
Sometimes, i915 might call _wait_for when irq is disabled.
If the cpu is the main cpu to process jiffies, jiffies
wouldn't be increased as this cpu disables irq. Then,
time_after(jiffies, timeout__) becomes meaningless. If
gunit doesn't work now, kernel wouldn't exit as the timeout
doesn't work.
The patch fixes it by using sched_clock instead of jiffies.
Signed-off-by: Deepak S <deepak.s at linux.intel.com>
---
drivers/gpu/drm/i915/intel_drv.h | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
index 6036e3b..2c6ebce 100644
--- a/drivers/gpu/drm/i915/intel_drv.h
+++ b/drivers/gpu/drm/i915/intel_drv.h
@@ -49,10 +49,12 @@
* we've never had a chance to check the condition before the timeout.
*/
#define _wait_for(COND, MS, W) ({ \
- unsigned long timeout__ = jiffies + msecs_to_jiffies(MS) + 1; \
+ u64 timeout_ = sched_clock() + MS * ((u64) NSEC_PER_MSEC); \
+ u64 clock; \
int ret__ = 0; \
while (!(COND)) { \
- if (time_after(jiffies, timeout__)) { \
+ clock = sched_clock(); \
+ if (clock >= timeout_) { \
if (!(COND)) \
ret__ = -ETIMEDOUT; \
break; \
--
1.9.1
More information about the Intel-gfx
mailing list