[Intel-gfx] [PATCH] drm/i915: Add a tracepoint for using a semaphore

Chris Wilson chris at chris-wilson.co.uk
Mon Aug 26 14:46:21 CEST 2013


So that we can find the callers who introduce a ring stall. A single
ring stall is not too unwelcome, the right issue becomes when they start
to interlock and prevent any concurrent work. That, however, is a little
tricker to detect with a mere tracepoint!

Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
---
 drivers/gpu/drm/i915/i915_gem.c   |  2 ++
 drivers/gpu/drm/i915/i915_trace.h | 19 +++++++++++++++++++
 2 files changed, 21 insertions(+)

diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index 85537d1..0122278 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -2698,6 +2698,8 @@ i915_gem_object_sync(struct drm_i915_gem_object *obj,
 	if (ret)
 		return ret;
 
+	trace_i915_gem_object_sync(obj, to);
+
 	ret = to->sync_to(to, from, seqno);
 	if (!ret)
 		/* We use last_read_seqno because sync_to()
diff --git a/drivers/gpu/drm/i915/i915_trace.h b/drivers/gpu/drm/i915/i915_trace.h
index feaacbb..728c43b 100644
--- a/drivers/gpu/drm/i915/i915_trace.h
+++ b/drivers/gpu/drm/i915/i915_trace.h
@@ -33,6 +33,25 @@ TRACE_EVENT(i915_gem_object_create,
 	    TP_printk("obj=%p, size=%u", __entry->obj, __entry->size)
 );
 
+TRACE_EVENT(i915_gem_object_sync,
+	    TP_PROTO(struct drm_i915_gem_object *obj, struct intel_ring_buffer *to),
+	    TP_ARGS(obj, to),
+
+	    TP_STRUCT__entry(
+			     __field(struct drm_i915_gem_object *, obj)
+			     __field(u32, sync_from)
+			     __field(u32, sync_to)
+			     ),
+
+	    TP_fast_assign(
+			   __entry->obj = obj;
+			   __entry->sync_from = obj->ring->id;
+			   __entry->sync_to = to->id;
+			   ),
+
+	    TP_printk("obj=%p, sync-from=%u, sync-to=%u", __entry->obj, __entry->sync_from, __entry->sync_to)
+);
+
 TRACE_EVENT(i915_vma_bind,
 	    TP_PROTO(struct i915_vma *vma, bool mappable),
 	    TP_ARGS(vma, mappable),
-- 
1.8.4.rc3




More information about the Intel-gfx mailing list