public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Ben Widawsky <ben@bwidawsk.net>
To: intel-gfx@lists.freedesktop.org
Cc: Ben Widawsky <ben@bwidawsk.net>
Subject: [PATCH 2/5] drm/i915: make waiting trace events more useful
Date: Sun, 29 Apr 2012 15:22:31 -0700	[thread overview]
Message-ID: <1335738156-27706-3-git-send-email-ben@bwidawsk.net> (raw)
In-Reply-To: <1335738156-27706-1-git-send-email-ben@bwidawsk.net>

With the new timeout parameter it is somewhat more useful to get trace
events for each iteration of the loop with values we care about.

Signed-off-by: Ben Widawsky <ben@bwidawsk.net>
---
 drivers/gpu/drm/i915/i915_gem.c   |    7 +++---
 drivers/gpu/drm/i915/i915_trace.h |   45 +++++++++++++++++++++++++++++++------
 2 files changed, 42 insertions(+), 10 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index 3c7e632..19ef8bd 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -1841,8 +1841,6 @@ static int __wait_seqno(struct intel_ring_buffer *ring, u32 seqno,
 	if (i915_seqno_passed(ring->get_seqno(ring), seqno))
 		return 0;
 
-	trace_i915_gem_request_wait_begin(ring, seqno);
-
 	if (timeout == NULL) {
 		timeout = &dummy_time;
 		wait_forever = true;
@@ -1859,6 +1857,8 @@ static int __wait_seqno(struct intel_ring_buffer *ring, u32 seqno,
 	(i915_seqno_passed(ring->get_seqno(ring), seqno) || \
 	atomic_read(&dev_priv->mm.wedged))
 	do {
+		trace_i915_gem_seqno_wait_begin(ring, seqno, timeout_jiffies);
+
 		if (interruptible)
 			end = wait_event_interruptible_timeout(ring->irq_queue,
 							       EXIT_COND,
@@ -1869,12 +1869,13 @@ static int __wait_seqno(struct intel_ring_buffer *ring, u32 seqno,
 
 		if (atomic_read(&dev_priv->mm.wedged))
 			end = -EAGAIN;
+
+		trace_i915_gem_seqno_wait_end(ring, seqno, end);
 	} while(end == 0 && wait_forever);
 
 	jiffies_to_timespec(jiffies - before, &temp);
 
 	ring->irq_put(ring);
-	trace_i915_gem_request_wait_end(ring, seqno);
 #undef EXIT_COND
 
 	jiffies_to_timespec(end, timeout);
diff --git a/drivers/gpu/drm/i915/i915_trace.h b/drivers/gpu/drm/i915/i915_trace.h
index dac7bba..2a4f535 100644
--- a/drivers/gpu/drm/i915/i915_trace.h
+++ b/drivers/gpu/drm/i915/i915_trace.h
@@ -311,16 +311,47 @@ DEFINE_EVENT(i915_gem_request, i915_gem_request_retire,
 	    TP_ARGS(ring, seqno)
 );
 
-DEFINE_EVENT(i915_gem_request, i915_gem_request_wait_begin,
-	    TP_PROTO(struct intel_ring_buffer *ring, u32 seqno),
-	    TP_ARGS(ring, seqno)
-);
+TRACE_EVENT(i915_gem_seqno_wait_begin,
+	    TP_PROTO(struct intel_ring_buffer *ring, u32 seqno, unsigned long timeout),
+	    TP_ARGS(ring, seqno, timeout),
 
-DEFINE_EVENT(i915_gem_request, i915_gem_request_wait_end,
-	    TP_PROTO(struct intel_ring_buffer *ring, u32 seqno),
-	    TP_ARGS(ring, seqno)
+	    TP_STRUCT__entry(
+		    __field(struct intel_ring_buffer *, ring)
+		    __field(u32, seqno)
+		    __field(unsigned long, timeout)
+		    ),
+
+	    TP_fast_assign(
+		    __entry->ring = ring;
+		    __entry->seqno = seqno;
+		    __entry->timeout = timeout;
+		    ),
+
+	    TP_printk("ring=%p, seqno=%u, timeout=%lu", __entry->ring,
+							__entry->seqno,
+							__entry->timeout)
 );
 
+TRACE_EVENT(i915_gem_seqno_wait_end,
+	    TP_PROTO(struct intel_ring_buffer *ring, u32 seqno, long ret),
+	    TP_ARGS(ring, seqno, ret),
+
+	    TP_STRUCT__entry(
+		    __field(struct intel_ring_buffer *, ring)
+		    __field(u32, seqno)
+		    __field(long, ret)
+		    ),
+
+	    TP_fast_assign(
+		    __entry->ring = ring;
+		    __entry->seqno = seqno;
+		    __entry->ret = ret;
+		    ),
+
+	    TP_printk("ring=%p, seqno=%u, ret=%ld", __entry->ring,
+						    __entry->seqno,
+						    __entry->ret)
+);
 DECLARE_EVENT_CLASS(i915_ring,
 	    TP_PROTO(struct intel_ring_buffer *ring),
 	    TP_ARGS(ring),
-- 
1.7.10

  parent reply	other threads:[~2012-04-29 22:24 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-29 22:22 [PATCH 0/5 v3] timed BO wait Ben Widawsky
2012-04-29 22:22 ` [PATCH 1/5 v2] drm/i915: timeout parameter for seqno wait Ben Widawsky
2012-05-01  1:39   ` [PATCH 1/5] " Ben Widawsky
2012-05-02 21:47     ` Daniel Vetter
2012-05-03  4:32       ` Ben Widawsky
2012-04-29 22:22 ` Ben Widawsky [this message]
2012-05-01  1:40   ` [PATCH 2/5] drm/i915: make waiting trace events more useful Ben Widawsky
2012-05-02 21:12     ` Daniel Vetter
2012-05-02 21:22       ` Chris Wilson
2012-05-02 21:36         ` Daniel Vetter
2012-05-02 21:56           ` Daniel Vetter
2012-04-29 22:22 ` [PATCH 3/5 v2] drm/i915: extract some common olr+wedge code Ben Widawsky
2012-05-02 21:08   ` Daniel Vetter
2012-04-29 22:22 ` [PATCH 4/5 v3] drm/i915: wait render timeout ioctl Ben Widawsky
2012-05-01  1:41   ` [PATCH 4/5] " Ben Widawsky
2012-05-01 17:19     ` Eric Anholt
2012-05-01 18:08       ` Ben Widawsky
2012-05-02 21:26     ` Daniel Vetter
2012-04-29 22:22 ` [PATCH 5/5] drm/i915: s/i915_wait_reqest/i915_wait_seqno/g Ben Widawsky
2012-04-29 22:22 ` [PATCH] intel: add a timed wait function Ben Widawsky
2012-04-29 22:22 ` [PATCH] tests/wait render timeout test Ben Widawsky
2012-05-03  5:49 ` [PATCH 0/5 v3] timed BO wait Ben Widawsky

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=1335738156-27706-3-git-send-email-ben@bwidawsk.net \
    --to=ben@bwidawsk.net \
    --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