diff mbox

[v3] drm/i915: Add ppgtt create/release trace points

Message ID 1411661457-4819-1-git-send-email-daniele.ceraolospurio@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Daniele Ceraolo Spurio Sept. 25, 2014, 4:10 p.m. UTC
From: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>

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

Signed-off-by: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
---
 drivers/gpu/drm/i915/i915_gem_gtt.c |  4 ++++
 drivers/gpu/drm/i915/i915_trace.h   | 40 +++++++++++++++++++++++++++++++++++++
 2 files changed, 44 insertions(+)

Comments

Daniel Vetter Sept. 29, 2014, 1:06 p.m. UTC | #1
On Thu, Sep 25, 2014 at 05:10:57PM +0100, daniele.ceraolospurio@intel.com wrote:
> From: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
> 
> These tracepoints are useful for observing the creation and
> destruction of Full PPGTTs.
> 
> Signed-off-by: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>

Ok, I think this is an excellent opportunity to properly document the
tracepoints we already have. Since kerneldocs sucks I guess we need to do
it all with DOC: comments that get manually pulled in, with an overview
comment at the top of i915_trace.h.

That then also leaves you with a nice place to explain a bit what this
should be used for.
-Daniel

> ---
>  drivers/gpu/drm/i915/i915_gem_gtt.c |  4 ++++
>  drivers/gpu/drm/i915/i915_trace.h   | 40 +++++++++++++++++++++++++++++++++++++
>  2 files changed, 44 insertions(+)
> 
> diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.c b/drivers/gpu/drm/i915/i915_gem_gtt.c
> index be0aa29..5577e86 100644
> --- a/drivers/gpu/drm/i915/i915_gem_gtt.c
> +++ b/drivers/gpu/drm/i915/i915_gem_gtt.c
> @@ -1174,6 +1174,8 @@ i915_ppgtt_create(struct drm_device *dev, struct drm_i915_file_private *fpriv)
>  
>  	ppgtt->file_priv = fpriv;
>  
> +	trace_i915_ppgtt_create(ppgtt);
> +
>  	return ppgtt;
>  }
>  
> @@ -1182,6 +1184,8 @@ void  i915_ppgtt_release(struct kref *kref)
>  	struct i915_hw_ppgtt *ppgtt =
>  		container_of(kref, struct i915_hw_ppgtt, ref);
>  
> +	trace_i915_ppgtt_release(ppgtt);
> +
>  	/* vmas should already be unbound */
>  	WARN_ON(!list_empty(&ppgtt->base.active_list));
>  	WARN_ON(!list_empty(&ppgtt->base.inactive_list));
> diff --git a/drivers/gpu/drm/i915/i915_trace.h b/drivers/gpu/drm/i915/i915_trace.h
> index f5aa006..ca84c49 100644
> --- a/drivers/gpu/drm/i915/i915_trace.h
> +++ b/drivers/gpu/drm/i915/i915_trace.h
> @@ -587,6 +587,46 @@ TRACE_EVENT(intel_gpu_freq_change,
>  	    TP_printk("new_freq=%u", __entry->freq)
>  );
>  
> +TRACE_EVENT(i915_ppgtt_create,
> +	TP_PROTO(struct i915_hw_ppgtt *ppgtt),
> +
> +	TP_ARGS(ppgtt),
> +
> +	TP_STRUCT__entry(
> +			__field(struct i915_address_space *, vm)
> +			__field(u32, dev)
> +			__field(u32, pid)
> +	),
> +
> +	TP_fast_assign(
> +			__entry->vm = &ppgtt->base;
> +			__entry->dev = ppgtt->base.dev->primary->index;
> +			__entry->pid = (unsigned int)task_pid_nr(current);
> +	),
> +
> +	TP_printk("dev=%u, task_pid=%u, vm=%p",
> +		  __entry->dev, __entry->pid, __entry->vm)
> +);
> +
> +TRACE_EVENT(i915_ppgtt_release,
> +
> +	TP_PROTO(struct i915_hw_ppgtt *ppgtt),
> +
> +	TP_ARGS(ppgtt),
> +
> +	TP_STRUCT__entry(
> +			__field(struct i915_address_space *, vm)
> +			__field(u32, dev)
> +	),
> +
> +	TP_fast_assign(
> +		__entry->vm = &ppgtt->base;
> +		__entry->dev = ppgtt->base.dev->primary->index;
> +	),
> +
> +	TP_printk("dev=%u, vm=%p", __entry->dev, __entry->vm)
> +);
> +
>  #endif /* _I915_TRACE_H_ */
>  
>  /* This part must be outside protection */
> -- 
> 1.8.5.2
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx
diff mbox

Patch

diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.c b/drivers/gpu/drm/i915/i915_gem_gtt.c
index be0aa29..5577e86 100644
--- a/drivers/gpu/drm/i915/i915_gem_gtt.c
+++ b/drivers/gpu/drm/i915/i915_gem_gtt.c
@@ -1174,6 +1174,8 @@  i915_ppgtt_create(struct drm_device *dev, struct drm_i915_file_private *fpriv)
 
 	ppgtt->file_priv = fpriv;
 
+	trace_i915_ppgtt_create(ppgtt);
+
 	return ppgtt;
 }
 
@@ -1182,6 +1184,8 @@  void  i915_ppgtt_release(struct kref *kref)
 	struct i915_hw_ppgtt *ppgtt =
 		container_of(kref, struct i915_hw_ppgtt, ref);
 
+	trace_i915_ppgtt_release(ppgtt);
+
 	/* vmas should already be unbound */
 	WARN_ON(!list_empty(&ppgtt->base.active_list));
 	WARN_ON(!list_empty(&ppgtt->base.inactive_list));
diff --git a/drivers/gpu/drm/i915/i915_trace.h b/drivers/gpu/drm/i915/i915_trace.h
index f5aa006..ca84c49 100644
--- a/drivers/gpu/drm/i915/i915_trace.h
+++ b/drivers/gpu/drm/i915/i915_trace.h
@@ -587,6 +587,46 @@  TRACE_EVENT(intel_gpu_freq_change,
 	    TP_printk("new_freq=%u", __entry->freq)
 );
 
+TRACE_EVENT(i915_ppgtt_create,
+	TP_PROTO(struct i915_hw_ppgtt *ppgtt),
+
+	TP_ARGS(ppgtt),
+
+	TP_STRUCT__entry(
+			__field(struct i915_address_space *, vm)
+			__field(u32, dev)
+			__field(u32, pid)
+	),
+
+	TP_fast_assign(
+			__entry->vm = &ppgtt->base;
+			__entry->dev = ppgtt->base.dev->primary->index;
+			__entry->pid = (unsigned int)task_pid_nr(current);
+	),
+
+	TP_printk("dev=%u, task_pid=%u, vm=%p",
+		  __entry->dev, __entry->pid, __entry->vm)
+);
+
+TRACE_EVENT(i915_ppgtt_release,
+
+	TP_PROTO(struct i915_hw_ppgtt *ppgtt),
+
+	TP_ARGS(ppgtt),
+
+	TP_STRUCT__entry(
+			__field(struct i915_address_space *, vm)
+			__field(u32, dev)
+	),
+
+	TP_fast_assign(
+		__entry->vm = &ppgtt->base;
+		__entry->dev = ppgtt->base.dev->primary->index;
+	),
+
+	TP_printk("dev=%u, vm=%p", __entry->dev, __entry->vm)
+);
+
 #endif /* _I915_TRACE_H_ */
 
 /* This part must be outside protection */