From patchwork Wed Sep 7 23:12:42 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ben Widawsky X-Patchwork-Id: 1128562 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by demeter1.kernel.org (8.14.4/8.14.4) with ESMTP id p87NDK1u020306 for ; Wed, 7 Sep 2011 23:13:42 GMT Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id B18BFA187D for ; Wed, 7 Sep 2011 16:13:20 -0700 (PDT) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from cloud01.chad-versace.us (184-106-247-128.static.cloud-ips.com [184.106.247.128]) by gabe.freedesktop.org (Postfix) with ESMTP id B8BC69E9AB for ; Wed, 7 Sep 2011 16:12:28 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by cloud01.chad-versace.us (Postfix) with ESMTP id 27C7C1D4078; Wed, 7 Sep 2011 23:15:50 +0000 (UTC) X-Virus-Scanned: amavisd-new at static.cloud-ips.com X-Spam-Flag: NO X-Spam-Score: -1 X-Spam-Level: X-Spam-Status: No, score=-1 tagged_above=-100 required=3.5 tests=[ALL_TRUSTED=-1] autolearn=ham Received: from cloud01.chad-versace.us ([127.0.0.1]) by localhost (cloud01.static.cloud-ips.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id SFVK6dgSV1HR; Wed, 7 Sep 2011 23:15:43 +0000 (UTC) Received: from localhost.localdomain (unknown [50.0.61.98]) by cloud01.chad-versace.us (Postfix) with ESMTPSA id 7B1FD1D4094; Wed, 7 Sep 2011 23:15:43 +0000 (UTC) From: Ben Widawsky To: intel-gfx@lists.freedesktop.org Date: Wed, 7 Sep 2011 16:12:42 -0700 Message-Id: <1315437162-14312-2-git-send-email-ben@bwidawsk.net> X-Mailer: git-send-email 1.7.6.1 In-Reply-To: <1315437162-14312-1-git-send-email-ben@bwidawsk.net> References: <1315437162-14312-1-git-send-email-ben@bwidawsk.net> Cc: Ben Widawsky Subject: [Intel-gfx] [PATCH 2/2] drm/i915: tracepoints for semaphores X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: intel-gfx-bounces+patchwork-intel-gfx=patchwork.kernel.org@lists.freedesktop.org Errors-To: intel-gfx-bounces+patchwork-intel-gfx=patchwork.kernel.org@lists.freedesktop.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Wed, 07 Sep 2011 23:13:42 +0000 (UTC) The tracepoints give enough info to figure the updates and compares (document terminology for signals and waits) and dependencies therein of the semaphore mailboxes. Here are arguments to perf to get interesting info (mostly copied from Chris): record -f -g -c 1 -e i915:intel_ringbuffer_add_request -e i915:intel_ringbuffer_consume_semaphore -a Cc: Chris Wilson Signed-off-by: Ben Widawsky --- drivers/gpu/drm/i915/i915_trace.h | 61 +++++++++++++++++++++++++++++++ drivers/gpu/drm/i915/intel_ringbuffer.c | 4 ++ 2 files changed, 65 insertions(+), 0 deletions(-) diff --git a/drivers/gpu/drm/i915/i915_trace.h b/drivers/gpu/drm/i915/i915_trace.h index d623fef..493a0d3 100644 --- a/drivers/gpu/drm/i915/i915_trace.h +++ b/drivers/gpu/drm/i915/i915_trace.h @@ -410,6 +410,67 @@ TRACE_EVENT(i915_reg_rw, (u32)(__entry->val >> 32)) ); +#define SEMAPHORE_REG_NAME(x) (\ + (x == RENDER_RING_BASE + 0x40) ? ("RVSYNC") : \ + ((x == RENDER_RING_BASE + 0x44) ? ("RBSYNC") : \ + ((x == GEN6_BSD_RING_BASE + 0x40) ? ("VRSYNC") : \ + ((x == GEN6_BSD_RING_BASE + 0x44) ? ("VBSYNC") : \ + ((x == BLT_RING_BASE + 0x40) ? ("BVSYNC") : \ + ((x == BLT_RING_BASE + 0x44) ? ("BRSYNC") : \ + ("UNKNOWN"))))))) + +#define RING_NAME(x) (\ + (x == 1) ? ("rcs") : \ + ((x == 2) ? ("vcs") : \ + ((x == 4) ? ("bcs") : \ + ("unk")))) + +TRACE_EVENT(intel_ringbuffer_add_request, + TP_PROTO(struct intel_ring_buffer *ring, + u32 seqno, + u32 reg1, + u32 reg2), + TP_ARGS(ring, seqno, reg1, reg2), + TP_STRUCT__entry( + __field(int, id) + __field(u32, seqno) + __field(u32, reg1) + __field(u32, reg2) + ), + TP_fast_assign( + __entry->id = ring->id; + __entry->seqno = seqno; + __entry->reg1 = reg1; + __entry->reg2 = reg2; + ), + TP_printk("ring = %s, seqno = %u, signal mbox 1 = %s, signal mbox 2 = %s", + RING_NAME(__entry->id), __entry->seqno, + SEMAPHORE_REG_NAME(__entry->reg1), + SEMAPHORE_REG_NAME(__entry->reg2)) +); + +TRACE_EVENT(intel_ringbuffer_consume_semaphore, + TP_PROTO(struct intel_ring_buffer *updater, + struct intel_ring_buffer *comparer, + u32 seqno), + TP_ARGS(updater, comparer, seqno), + TP_STRUCT__entry( + __field(int, src) + __field(int, dest) + __field(u32, seqno) + ), + TP_fast_assign( + __entry->src = updater->id; + __entry->dest = comparer->id; + __entry->seqno = seqno; + ), + /* It's not easy to macro the consuming mbox register */ + TP_printk("signaller = %s, waiter = %s, seqno = %u", + RING_NAME(__entry->src), + RING_NAME(__entry->dest), + __entry->seqno) +); + #endif /* _I915_TRACE_H_ */ /* This part must be outside protection */ diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.c b/drivers/gpu/drm/i915/intel_ringbuffer.c index 8f902a1..f816070 100644 --- a/drivers/gpu/drm/i915/intel_ringbuffer.c +++ b/drivers/gpu/drm/i915/intel_ringbuffer.c @@ -358,6 +358,8 @@ gen6_add_request(struct intel_ring_buffer *ring, intel_ring_emit(ring, MI_USER_INTERRUPT); intel_ring_advance(ring); + trace_intel_ringbuffer_add_request(ring, seqno, mbox1_reg, mbox2_reg); + return seqno; } @@ -420,6 +422,8 @@ intel_ring_sync(struct intel_ring_buffer *waiter, intel_ring_emit(waiter, MI_NOOP); intel_ring_advance(waiter); + trace_intel_ringbuffer_consume_semaphore(signaller, waiter, seqno); + return 0; }