From: deepak.s@linux.intel.com
To: intel-gfx@lists.freedesktop.org
Subject: [RFC] drm/i915: _wait_for might be called when irq is off
Date: Thu, 2 Apr 2015 19:21:40 +0530 [thread overview]
Message-ID: <1427982700-24901-1-git-send-email-deepak.s@linux.intel.com> (raw)
From: Deepak S <deepak.s@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@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
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
next reply other threads:[~2015-04-02 13:54 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-02 13:51 deepak.s [this message]
2015-04-02 15:27 ` [RFC] drm/i915: _wait_for might be called when irq is off Chris Wilson
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=1427982700-24901-1-git-send-email-deepak.s@linux.intel.com \
--to=deepak.s@linux.intel.com \
--cc=intel-gfx@lists.freedesktop.org \
/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: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox