[Intel-gfx] [PATCH 3/3] drm/i915: Trace point callbacks for validation

oscar.mateo at intel.com oscar.mateo at intel.com
Wed Jun 18 18:16:41 CEST 2014


From: Daniele Ceraolo Spurio <daniele.ceraolospurio at intel.com>

These callbacks can be assigned to specific functions inside an external
validation kernel module. This module can then extract run-time information
to make sure everything is working as expected.

Specifically, these two callbacks extract information about ifull PPGGT and
batch dispatch.

Signed-off-by: Oscar Mateo <oscar.mateo at intel.com>
---
 drivers/gpu/drm/i915/i915_gem_context.c    |  3 +++
 drivers/gpu/drm/i915/i915_gem_execbuffer.c |  3 +++
 drivers/gpu/drm/i915/i915_trace.h          | 21 +++++++++++++++++++++
 3 files changed, 27 insertions(+)

diff --git a/drivers/gpu/drm/i915/i915_gem_context.c b/drivers/gpu/drm/i915/i915_gem_context.c
index bdfe3f5..42b583d 100644
--- a/drivers/gpu/drm/i915/i915_gem_context.c
+++ b/drivers/gpu/drm/i915/i915_gem_context.c
@@ -89,6 +89,9 @@
 #include <drm/i915_drm.h>
 #include "i915_drv.h"
 
+i915_ppgtt_validation_callback_t ppgtt_validation_callback = NULL;
+EXPORT_SYMBOL_GPL(ppgtt_validation_callback);
+
 /* This is a HW constraint. The value below is the largest known requirement
  * I've seen in a spec to date, and that was a workaround for a non-shipping
  * part. It should be safe to decrease this, but it's more future proof as is.
diff --git a/drivers/gpu/drm/i915/i915_gem_execbuffer.c b/drivers/gpu/drm/i915/i915_gem_execbuffer.c
index b273257..14984585 100644
--- a/drivers/gpu/drm/i915/i915_gem_execbuffer.c
+++ b/drivers/gpu/drm/i915/i915_gem_execbuffer.c
@@ -33,6 +33,9 @@
 #include "intel_drv.h"
 #include <linux/dma_remapping.h>
 
+i915_gem_ring_dispatch_callback_t i915_gem_ring_dispatch_validation_callback = NULL;
+EXPORT_SYMBOL_GPL(i915_gem_ring_dispatch_validation_callback);
+
 #define  __EXEC_OBJECT_HAS_PIN (1<<31)
 #define  __EXEC_OBJECT_HAS_FENCE (1<<30)
 #define  __EXEC_OBJECT_NEEDS_BIAS (1<<28)
diff --git a/drivers/gpu/drm/i915/i915_trace.h b/drivers/gpu/drm/i915/i915_trace.h
index 756be7e..2511618 100644
--- a/drivers/gpu/drm/i915/i915_trace.h
+++ b/drivers/gpu/drm/i915/i915_trace.h
@@ -15,6 +15,17 @@
 #define TRACE_SYSTEM_STRING __stringify(TRACE_SYSTEM)
 #define TRACE_INCLUDE_FILE i915_trace
 
+/* validation callbacks */
+
+typedef void (*i915_ppgtt_validation_callback_t)(unsigned int action_code,
+						 struct i915_hw_ppgtt *ppgtt);
+extern i915_ppgtt_validation_callback_t ppgtt_validation_callback;
+
+typedef void (*i915_gem_ring_dispatch_callback_t)(struct intel_engine_cs *ring,
+						  u32 seqno, u32 flags,
+						  struct intel_context *ctx);
+extern i915_gem_ring_dispatch_callback_t i915_gem_ring_dispatch_validation_callback;
+
 /* pipe updates */
 
 TRACE_EVENT(i915_pipe_update_start,
@@ -368,6 +379,10 @@ TRACE_EVENT(i915_gem_ring_dispatch,
 			   __entry->seqno = seqno;
 			   __entry->flags = flags;
 			   i915_trace_irq_get(ring, seqno);
+
+			   if (i915_gem_ring_dispatch_validation_callback)
+				   i915_gem_ring_dispatch_validation_callback(ring,
+						   seqno, flags, ctx);
 			   ),
 
 	    TP_printk("dev=%u, ring=%u, seqno=%u, flags=%x",
@@ -601,6 +616,9 @@ TRACE_EVENT(ppgtt_init,
 	TP_fast_assign(
 		__entry->trace_ppgtt = ppgtt;
 		__entry->ppgtt_op_code = 0;
+
+		if (ppgtt_validation_callback)
+			ppgtt_validation_callback(0, ppgtt);
 	),
 
 	TP_printk("ppgtt op: %u", __entry->ppgtt_op_code)
@@ -620,6 +638,9 @@ TRACE_EVENT(ppgtt_release,
 	TP_fast_assign(
 		__entry->trace_ppgtt = ppgtt;
 		__entry->ppgtt_op_code = 1;
+
+		if (ppgtt_validation_callback)
+			ppgtt_validation_callback(1, ppgtt);
 	),
 
 	TP_printk("ppgtt op: %u", __entry->ppgtt_op_code)
-- 
1.9.0




More information about the Intel-gfx mailing list