All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
To: Intel-gfx@lists.freedesktop.org
Subject: [PATCH 5/5] drm/i915: Only grab and calculate timestamps when needed
Date: Tue, 10 Nov 2015 10:59:45 +0000	[thread overview]
Message-ID: <1447153185-5404-6-git-send-email-tvrtko.ursulin@linux.intel.com> (raw)
In-Reply-To: <1447153185-5404-1-git-send-email-tvrtko.ursulin@linux.intel.com>

From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>

Tiny cleanup to avoid grabbing a timestamp and calculating the
timeout when it is not going to be used. If anything makes the
profile correctly show busy wait spends time in get seqno and
not in ktime_get.

Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
---
 drivers/gpu/drm/i915/i915_gem.c | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index f1e3fdeea41f..d85c63dc36ac 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -1199,7 +1199,7 @@ int __i915_wait_request(struct drm_i915_gem_request *req,
 		ACCESS_ONCE(dev_priv->gpu_error.test_irq_rings) & intel_ring_flag(ring);
 	DEFINE_WAIT(wait);
 	unsigned long timeout_expire;
-	s64 before, now;
+	s64 before;
 	int ret;
 
 	WARN(!intel_irqs_enabled(dev_priv), "IRQs disabled");
@@ -1210,15 +1210,17 @@ 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_timeout((u64)*timeout) : 0;
-
 	if (INTEL_INFO(dev_priv)->gen >= 6)
 		gen6_rps_boost(dev_priv, rps, req->emitted_jiffies);
 
 	/* Record current time in case interrupted by signal, or wedged */
 	trace_i915_gem_request_wait_begin(req);
-	before = ktime_get_raw_ns();
+	if (timeout) {
+		before = ktime_get_raw_ns();
+		timeout_expire = jiffies + nsecs_to_jiffies_timeout((u64)*timeout);
+	} else {
+		timeout_expire = 0;
+	}
 
 	/* Optimistic spin for the next jiffie before touching IRQs */
 	ret = __i915_spin_request(req);
@@ -1284,11 +1286,10 @@ int __i915_wait_request(struct drm_i915_gem_request *req,
 	finish_wait(&ring->irq_queue, &wait);
 
 out:
-	now = ktime_get_raw_ns();
 	trace_i915_gem_request_wait_end(req);
 
 	if (timeout) {
-		s64 tres = *timeout - (now - before);
+		s64 tres = *timeout - (ktime_get_raw_ns() - before);
 
 		*timeout = tres < 0 ? 0 : tres;
 
-- 
1.9.1

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

  parent reply	other threads:[~2015-11-10 10:59 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-10 10:59 [RFC 0/5] LRC irq handler cleanups Tvrtko Ursulin
2015-11-10 10:59 ` [PATCH 1/5] drm/i915: Avoid invariant conditionals in lrc interrupt handler Tvrtko Ursulin
2015-11-10 10:59 ` [PATCH 2/5] drm/i915: Move LRCA check out of the hot path Tvrtko Ursulin
2015-11-10 10:59 ` [PATCH 3/5] drm/i915: Cache LRCA in the context Tvrtko Ursulin
2015-11-10 10:59 ` [PATCH 4/5] drm/i915: Grab one forcewake across the whole LRC irq handler Tvrtko Ursulin
2015-11-10 10:59 ` Tvrtko Ursulin [this message]
2015-11-10 11:36 ` [RFC 0/5] LRC irq handler cleanups Chris Wilson
2015-11-10 12:09   ` Tvrtko Ursulin

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=1447153185-5404-6-git-send-email-tvrtko.ursulin@linux.intel.com \
    --to=tvrtko.ursulin@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 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.