Skip to contentSkip to conversation

drm/i915: Add ppgtt init/release trace points

PATCH In review [email protected] 3 participants 7 messages Jun 18, 2014 – Jun 19, 2014

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/3 drm/i915: Add ppgtt init/release trace points

From: Daniele Ceraolo Spurio <[email protected]>

These tracepoints are useful for observing the creation and destruction of Full PPGTTs.

---
 drivers/gpu/drm/i915/i915_gem_context.c |  5 +++++
 drivers/gpu/drm/i915/i915_trace.h       | 38 +++++++++++++++++++++++++++++++++
 2 files changed, 43 insertions(+)
drivers/gpu/drm/i915/i915_gem_context.c +5 -0
index 5a62a19..bdfe3f5 100644
@@ -136,6 +136,8 @@ static void ppgtt_release(struct kref *kref)
 	struct i915_hw_ppgtt *ppgtt =
 		container_of(kref, struct i915_hw_ppgtt, ref);
 
+	trace_ppgtt_release(ppgtt);
+
 	do_ppgtt_cleanup(ppgtt);
 	kfree(ppgtt);
 }
@@ -215,6 +217,9 @@ create_vm_for_ctx(struct drm_device *dev, struct intel_context *ctx)
 	}
 
 	ppgtt->ctx = ctx;
+
+	trace_ppgtt_init(ppgtt);
+
 	return ppgtt;
 }
 
drivers/gpu/drm/i915/i915_trace.h +38 -0
index f5aa006..2d206d8 100644
@@ -587,6 +587,44 @@ TRACE_EVENT(intel_gpu_freq_change,
 	    TP_printk("new_freq=%u", __entry->freq)
 );
 
+TRACE_EVENT(ppgtt_init,
+
+	TP_PROTO(struct i915_hw_ppgtt *ppgtt),
+
+	TP_ARGS(ppgtt),
+
+	TP_STRUCT__entry(
+		__field(struct i915_hw_ppgtt*, trace_ppgtt)
+		__field(unsigned int, ppgtt_op_code)
+	),
+
+	TP_fast_assign(
+		__entry->trace_ppgtt = ppgtt;
+		__entry->ppgtt_op_code = 0;
+	),
+
+	TP_printk("ppgtt op: %u", __entry->ppgtt_op_code)
+);
+
+TRACE_EVENT(ppgtt_release,
+
+	TP_PROTO(struct i915_hw_ppgtt *ppgtt),
+
+	TP_ARGS(ppgtt),
+
+	TP_STRUCT__entry(
+		__field(struct i915_hw_ppgtt*, trace_ppgtt)
+		__field(unsigned int, ppgtt_op_code)
+	),
+
+	TP_fast_assign(
+		__entry->trace_ppgtt = ppgtt;
+		__entry->ppgtt_op_code = 1;
+	),
+
+	TP_printk("ppgtt op: %u", __entry->ppgtt_op_code)
+);
+
 #endif /* _I915_TRACE_H_ */
 
 /* This part must be outside protection */
Signature · 1 line
1.9.0
#1 lore raw

PATCH 2/3 drm/i915: Add ctx param to i915_gem_ring_dispatch trace point

From: Daniele Ceraolo Spurio <[email protected]>

The context used top execute a batchbuffer is becoming increasingly important.

---
 drivers/gpu/drm/i915/i915_gem_execbuffer.c | 2 +-
 drivers/gpu/drm/i915/i915_trace.h          | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/i915_gem_execbuffer.c +1 -1
index 93d7f72..b273257 100644
@@ -1374,7 +1374,7 @@ i915_gem_do_execbuffer(struct drm_device *dev, void *data,
 			goto err;
 	}
 
-	trace_i915_gem_ring_dispatch(ring, intel_ring_get_seqno(ring), flags);
+	trace_i915_gem_ring_dispatch(ring, intel_ring_get_seqno(ring), flags, ctx);
 
 	i915_gem_execbuffer_move_to_active(&eb->vmas, ring);
 	i915_gem_execbuffer_retire_commands(dev, file, ring, batch_obj);
drivers/gpu/drm/i915/i915_trace.h +2 -2
index 2d206d8..756be7e 100644
@@ -352,8 +352,8 @@ TRACE_EVENT(i915_gem_ring_sync_to,
 );
 
 TRACE_EVENT(i915_gem_ring_dispatch,
-	    TP_PROTO(struct intel_engine_cs *ring, u32 seqno, u32 flags),
-	    TP_ARGS(ring, seqno, flags),
+	    TP_PROTO(struct intel_engine_cs *ring, u32 seqno, u32 flags, struct intel_context *ctx),
+	    TP_ARGS(ring, seqno, flags, ctx),
 
 	    TP_STRUCT__entry(
 			     __field(u32, dev)
Signature · 1 line
1.9.0
#2 lore raw

PATCH 3/3 drm/i915: Trace point callbacks for validation

In reply to [email protected]

From: Daniele Ceraolo Spurio <[email protected]>

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.

---
 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(+)
drivers/gpu/drm/i915/i915_gem_context.c +3 -0
index bdfe3f5..42b583d 100644
@@ -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.
drivers/gpu/drm/i915/i915_gem_execbuffer.c +3 -0
index b273257..14984585 100644
@@ -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)
drivers/gpu/drm/i915/i915_trace.h +21 -0
index 756be7e..2511618 100644
@@ -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)
Signature · 1 line
1.9.0
#3 lore raw
In reply to [email protected]
Quoted 49 lines · On Wed, Jun 18, 2014 at 05:16:39PM +0100, [email protected] wrote:

From: Daniele Ceraolo Spurio <[email protected]>

These tracepoints are useful for observing the creation and destruction of Full PPGTTs.

---
 drivers/gpu/drm/i915/i915_gem_context.c |  5 +++++
 drivers/gpu/drm/i915/i915_trace.h       | 38 +++++++++++++++++++++++++++++++++
 2 files changed, 43 insertions(+)
drivers/gpu/drm/i915/i915_gem_context.c +5 -0
index 5a62a19..bdfe3f5 100644
@@ -136,6 +136,8 @@ static void ppgtt_release(struct kref *kref)
 	struct i915_hw_ppgtt *ppgtt =
 		container_of(kref, struct i915_hw_ppgtt, ref);
 
+	trace_ppgtt_release(ppgtt);
+
 	do_ppgtt_cleanup(ppgtt);
 	kfree(ppgtt);
 }
@@ -215,6 +217,9 @@ create_vm_for_ctx(struct drm_device *dev, struct intel_context *ctx)
 	}
 
 	ppgtt->ctx = ctx;
+
+	trace_ppgtt_init(ppgtt);
+
 	return ppgtt;
 }
 
drivers/gpu/drm/i915/i915_trace.h +7 -0
index f5aa006..2d206d8 100644
@@ -587,6 +587,44 @@ TRACE_EVENT(intel_gpu_freq_change,
 	    TP_printk("new_freq=%u", __entry->freq)
 );
 
+TRACE_EVENT(ppgtt_init,
+
+	TP_PROTO(struct i915_hw_ppgtt *ppgtt),
+
+	TP_ARGS(ppgtt),
+
+	TP_STRUCT__entry(

drivers/gpu/drm/i915/i915_trace.h TRACE_EVENT(intel_gpu_freq_change, · line 606

Quoted 10 lines
drivers/gpu/drm/i915/i915_trace.h +10 -0
+		__field(struct i915_hw_ppgtt*, trace_ppgtt)
+		__field(unsigned int, ppgtt_op_code)
+	),
+
+	TP_fast_assign(
+		__entry->trace_ppgtt = ppgtt;
+		__entry->ppgtt_op_code = 0;
+	),
+
+	TP_printk("ppgtt op: %u", __entry->ppgtt_op_code)

op is redundant and unuseful since it is already encoded into the tracepoint itself. I'm not happy with the tracepoint name either, but it is close. Note, that we do like to pretend that our driver can coexist with itself. That means we have to pass along the dev->minor here so that listeners can distinguish events between imaginary devices. You need to say which client created the ppgtt and include some method for identifying the ppgtt.
-Chris

Signature · 1 line
Chris Wilson, Intel Open Source Technology Centre
#4 lore raw
Quoted 72 lines

-----Original Message-----
From: Chris Wilson [mailto:[email protected]]
Sent: Thursday, June 19, 2014 8:57 AM
To: Mateo Lozano, Oscar
Cc: [email protected]
Subject: Re: [Intel-gfx] [PATCH 1/3] drm/i915: Add ppgtt init/release trace points

Quoted 9 lines · On Wed, Jun 18, 2014 at 05:16:39PM +0100, [email protected] wrote:

From: Daniele Ceraolo Spurio <[email protected]>

These tracepoints are useful for observing the creation and destruction of Full PPGTTs.

---
 drivers/gpu/drm/i915/i915_gem_context.c |  5 +++++
 drivers/gpu/drm/i915/i915_trace.h       | 38

+++++++++++++++++++++++++++++++++

drivers/gpu/drm/i915/i915_gem_context.c create_vm_for_ctx(struct drm_device *dev, struct

Quoted 17 lines
 2 files changed, 43 insertions(+)
drivers/gpu/drm/i915/i915_gem_context.c +2 -0
index 5a62a19..bdfe3f5 100644
@@ -136,6 +136,8 @@ static void ppgtt_release(struct kref *kref)
 	struct i915_hw_ppgtt *ppgtt =
 		container_of(kref, struct i915_hw_ppgtt, ref);
 
+	trace_ppgtt_release(ppgtt);
+
 	do_ppgtt_cleanup(ppgtt);
 	kfree(ppgtt);
 }
@@ -215,6 +217,9 @@ create_vm_for_ctx(struct drm_device *dev, struct

intel_context *ctx)

Quoted 24 lines
drivers/gpu/drm/i915/i915_gem_context.c +3 -0
 	}
 
 	ppgtt->ctx = ctx;
+
+	trace_ppgtt_init(ppgtt);
+
 	return ppgtt;
 }
 
drivers/gpu/drm/i915/i915_trace.h +7 -0
index f5aa006..2d206d8 100644
@@ -587,6 +587,44 @@ TRACE_EVENT(intel_gpu_freq_change,
 	    TP_printk("new_freq=%u", __entry->freq)  );
 
+TRACE_EVENT(ppgtt_init,
+
+	TP_PROTO(struct i915_hw_ppgtt *ppgtt),
+
+	TP_ARGS(ppgtt),
+
+	TP_STRUCT__entry(

drivers/gpu/drm/i915/i915_trace.h TRACE_EVENT(intel_gpu_freq_change, · line 605

Quoted 10 lines
drivers/gpu/drm/i915/i915_trace.h +10 -0
+		__field(struct i915_hw_ppgtt*, trace_ppgtt)
+		__field(unsigned int, ppgtt_op_code)
+	),
+
+	TP_fast_assign(
+		__entry->trace_ppgtt = ppgtt;
+		__entry->ppgtt_op_code = 0;
+	),
+
+	TP_printk("ppgtt op: %u", __entry->ppgtt_op_code)
Quoted 7 lines

op is redundant and unuseful since it is already encoded into the tracepoint itself. I'm not happy with the tracepoint name either, but it is close. Note, that we do like to pretend that our driver can coexist with itself. That means we have to pass along the dev->minor here so that listeners can distinguish events between imaginary devices. You need to say which client created the ppgtt and include some method for identifying the ppgtt.
-Chris

Hmmm... I was submitting this on behalf of our validation team but in retrospect that was a bad idea: it´s much better if they participate in the discussion. Daniele, care to join?

-- Oscar

#5 lore raw
Quoted 67 lines · Oscar
Quoted 67 lines

-----Original Message-----
From: Chris Wilson [mailto:[email protected]]
Sent: Thursday, June 19, 2014 8:57 AM
To: Mateo Lozano, Oscar
Cc: [email protected]
Subject: Re: [Intel-gfx] [PATCH 1/3] drm/i915: Add ppgtt init/release trace points

Quoted 9 lines · On Wed, Jun 18, 2014 at 05:16:39PM +0100, [email protected] wrote:

From: Daniele Ceraolo Spurio <[email protected]>

These tracepoints are useful for observing the creation and destruction of Full PPGTTs.

---
 drivers/gpu/drm/i915/i915_gem_context.c |  5 +++++
 drivers/gpu/drm/i915/i915_trace.h       | 38

+++++++++++++++++++++++++++++++++

drivers/gpu/drm/i915/i915_gem_context.c create_vm_for_ctx(struct drm_device *dev, struct

Quoted 17 lines
 2 files changed, 43 insertions(+)
drivers/gpu/drm/i915/i915_gem_context.c +2 -0
index 5a62a19..bdfe3f5 100644
@@ -136,6 +136,8 @@ static void ppgtt_release(struct kref *kref)
    struct i915_hw_ppgtt *ppgtt =
            container_of(kref, struct i915_hw_ppgtt, ref);
 
+   trace_ppgtt_release(ppgtt);
+
    do_ppgtt_cleanup(ppgtt);
    kfree(ppgtt);
 }
@@ -215,6 +217,9 @@ create_vm_for_ctx(struct drm_device *dev, struct

intel_context *ctx)

Quoted 29 lines
drivers/gpu/drm/i915/i915_gem_context.c +3 -0
    }
 
    ppgtt->ctx = ctx;
+
+   trace_ppgtt_init(ppgtt);
+
    return ppgtt;
 }
 
drivers/gpu/drm/i915/i915_trace.h +12 -0
index f5aa006..2d206d8 100644
@@ -587,6 +587,44 @@ TRACE_EVENT(intel_gpu_freq_change,
        TP_printk("new_freq=%u", __entry->freq)  );
 
+TRACE_EVENT(ppgtt_init,
+
+   TP_PROTO(struct i915_hw_ppgtt *ppgtt),
+
+   TP_ARGS(ppgtt),
+
+   TP_STRUCT__entry(
+           __field(struct i915_hw_ppgtt*, trace_ppgtt)
+           __field(unsigned int, ppgtt_op_code)
+   ),
+
+   TP_fast_assign(
Quoted 8 lines
Quoted 8 lines

drivers/gpu/drm/i915/i915_trace.h TRACE_EVENT(intel_gpu_freq_change, · line 606

Quoted 5 lines
drivers/gpu/drm/i915/i915_trace.h +5 -0
+           __entry->trace_ppgtt = ppgtt;
+           __entry->ppgtt_op_code = 0;
+   ),
+
+   TP_printk("ppgtt op: %u", __entry->ppgtt_op_code)

op is redundant and unuseful since it is already encoded into the tracepoint itself. I'm not happy with the tracepoint name either, but it is close. Note,

Would something like "i915_create_ppgtt" be ok?

Quoted 4 lines
Quoted 4 lines

that we do like to pretend that our driver can coexist with itself. That means we have to pass along the dev->minor here so that listeners can distinguish events between imaginary devices. You need to say which client created the ppgtt and include some method for identifying the ppgtt.

There are several things that we could use to identify the ppgtt. My choice would be the VM pointer, which is unique for each ppgtt and is also printed by the i915_vma_bind and i915_vma_unbind traces, but we could also use the context id. The problem with using the context id is that we won't be able to print it in the ppgtt_release trace. Regarding the client, my idea is to print the task pid and/or the process name; would that look good for you?

Quoted 5 lines
Quoted 1 line

-Chris

Hmmm... I was submitting this on behalf of our validation team but in retrospect that was a bad idea: it´s much better if they participate in the discussion. Daniele, care to join?

-- Oscar

Thanks,
-- Daniele
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

#6 lore raw
Quoted 2 lines · Daniele Ceraolo Spurio

Regarding the client, my idea is to print the task pid and/or the process name; would that look good for you?

Going off an tangent. We have a problem with file->pid. In the dri3, or rendernodes, future all pids belong to the master. :(

Suggestions? Complete solutions?
-Chris

Signature · 1 line
Chris Wilson, Intel Open Source Technology Centre