Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1269030

Re: __i915_spin_request() sucks

From Jens Axboe <axboe@kernel.dk>
Newsgroups linux.kernel
Subject Re: __i915_spin_request() sucks
Date 2015-11-13 16:40 +0100
Message-ID <quoCf-8cf-47@gated-at.bofh.it> (permalink)
References <qu6P0-5ho-27@gated-at.bofh.it> <qu6YF-5kL-3@gated-at.bofh.it> <qu8nM-6oo-35@gated-at.bofh.it> <qu90u-6Bs-13@gated-at.bofh.it> <quiGu-4vC-19@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Previous patch was obvious pre-coffee crap, this should work for using
ktime to spin max 1usec.

diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index 5cf4a1998273..21192e55c33c 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -1148,17 +1148,18 @@ static bool missed_irq(struct drm_i915_private *dev_priv,
 
 static int __i915_spin_request(struct drm_i915_gem_request *req)
 {
-	unsigned long timeout;
+	ktime_t timeout;
 
 	if (i915_gem_request_get_ring(req)->irq_refcount)
 		return -EBUSY;
 
-	timeout = jiffies + 1;
+	timeout = ktime_get();
+	ktime_add_us(timeout, 1);
 	while (!need_resched()) {
 		if (i915_gem_request_completed(req, true))
 			return 0;
 
-		if (time_after_eq(jiffies, timeout))
+		if (ktime_after(ktime_get(), timeout))
 			break;
 
 		cpu_relax_lowlatency();

-- 
Jens Axboe

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

__i915_spin_request() sucks Jens Axboe <axboe@kernel.dk> - 2015-11-12 21:40 +0100
  Re: __i915_spin_request() sucks Jens Axboe <axboe@kernel.dk> - 2015-11-12 21:50 +0100
    Re: __i915_spin_request() sucks Chris Wilson <chris@chris-wilson.co.uk> - 2015-11-12 23:20 +0100
      Re: __i915_spin_request() sucks Jens Axboe <axboe@kernel.dk> - 2015-11-13 00:00 +0100
        Re: __i915_spin_request() sucks Jens Axboe <axboe@kernel.dk> - 2015-11-13 00:00 +0100
        Re: __i915_spin_request() sucks Chris Wilson <chris@chris-wilson.co.uk> - 2015-11-13 10:20 +0100
          Re: __i915_spin_request() sucks Jens Axboe <axboe@kernel.dk> - 2015-11-13 16:20 +0100
          Re: __i915_spin_request() sucks Jens Axboe <axboe@kernel.dk> - 2015-11-13 16:40 +0100
            Re: __i915_spin_request() sucks Mike Galbraith <umgwanakikbuti@gmail.com> - 2015-11-13 17:20 +0100
              Re: __i915_spin_request() sucks Jens Axboe <axboe@kernel.dk> - 2015-11-13 17:30 +0100
                Re: __i915_spin_request() sucks Chris Wilson <chris@chris-wilson.co.uk> - 2015-11-13 23:20 +0100
                Re: __i915_spin_request() sucks Jens Axboe <axboe@kernel.dk> - 2015-11-13 23:20 +0100

csiph-web