All of lore.kernel.org
 help / color / mirror / Atom feed
From: daniele.ceraolospurio@intel.com
To: intel-gfx@lists.freedesktop.org
Subject: [PATCH v5] drm/i915: Add ppgtt create/release trace points
Date: Fri, 24 Oct 2014 16:30:52 +0100	[thread overview]
Message-ID: <1414164652-24281-1-git-send-email-daniele.ceraolospurio@intel.com> (raw)
In-Reply-To: <1413984525-8963-1-git-send-email-daniele.ceraolospurio@intel.com>

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

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

v4: add DOC information
v5: pull the DOC in drm.tmpl

Signed-off-by: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
---
 Documentation/DocBook/drm.tmpl      | 13 ++++++++++
 drivers/gpu/drm/i915/i915_gem_gtt.c |  4 +++
 drivers/gpu/drm/i915/i915_trace.h   | 50 +++++++++++++++++++++++++++++++++++++
 3 files changed, 67 insertions(+)

diff --git a/Documentation/DocBook/drm.tmpl b/Documentation/DocBook/drm.tmpl
index f6a9d7b..a372f52 100644
--- a/Documentation/DocBook/drm.tmpl
+++ b/Documentation/DocBook/drm.tmpl
@@ -3963,6 +3963,19 @@ int num_ioctls;</synopsis>
 !Idrivers/gpu/drm/i915/intel_lrc.c
       </sect2>
     </sect1>
+
+    <sect1>
+      <title> Tracing </title>
+      <para>
+    This sections covers all things related to the tracepoints implemented in
+    the i915 driver.
+      </para>
+      <sect2>
+        <title> i915_ppgtt_create and i915_ppgtt_release </title>
+!Pdrivers/gpu/drm/i915/i915_trace.h i915_ppgtt_create and i915_ppgtt_release tracepoints
+      </sect2>
+    </sect1>
+
   </chapter>
 !Cdrivers/gpu/drm/i915/i915_irq.c
 </part>
diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.c b/drivers/gpu/drm/i915/i915_gem_gtt.c
index e0bcba0..ed9ec67 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->base);
+
 	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->base);
+
 	/* 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..525be1b 100644
--- a/drivers/gpu/drm/i915/i915_trace.h
+++ b/drivers/gpu/drm/i915/i915_trace.h
@@ -587,6 +587,56 @@ TRACE_EVENT(intel_gpu_freq_change,
 	    TP_printk("new_freq=%u", __entry->freq)
 );
 
+/**
+ * DOC: i915_ppgtt_create and i915_ppgtt_release tracepoints
+ *
+ * With full ppgtt enabled each process using drm will allocate at least one
+ * translation table. With these traces it is possible to keep track of the
+ * allocation and of the lifetime of the tables; this can be used during
+ * testing/debug to verify that we are not leaking ppgtts.
+ * These traces identify the ppgtt through the vm pointer, which is also printed
+ * by the i915_vma_bind and i915_vma_unbind tracepoints.
+ */
+TRACE_EVENT(i915_ppgtt_create,
+	TP_PROTO(struct i915_address_space *vm),
+
+	TP_ARGS(vm),
+
+	TP_STRUCT__entry(
+			__field(struct i915_address_space *, vm)
+			__field(u32, dev)
+			__field(int, pid)
+	),
+
+	TP_fast_assign(
+			__entry->vm = vm;
+			__entry->dev = vm->dev->primary->index;
+			__entry->pid = (int)task_pid_nr(current);
+	),
+
+	TP_printk("dev=%u, task_pid=%d, vm=%p",
+		  __entry->dev, __entry->pid, __entry->vm)
+);
+
+TRACE_EVENT(i915_ppgtt_release,
+
+	TP_PROTO(struct i915_address_space *vm),
+
+	TP_ARGS(vm),
+
+	TP_STRUCT__entry(
+			__field(struct i915_address_space *, vm)
+			__field(u32, dev)
+	),
+
+	TP_fast_assign(
+		__entry->vm = vm;
+		__entry->dev = vm->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

  parent reply	other threads:[~2014-10-24 15:31 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-25 16:10 [PATCH v3] drm/i915: Add ppgtt create/release trace points daniele.ceraolospurio
2014-09-29 13:06 ` Daniel Vetter
2014-10-22 13:28 ` [PATCH v4] " daniele.ceraolospurio
2014-10-22 15:29   ` Daniel Vetter
2014-10-24 15:30   ` daniele.ceraolospurio [this message]
2014-10-27  8:49     ` [PATCH v5] " Chris Wilson
2014-10-27 11:03       ` Ceraolo Spurio, Daniele
2014-10-28  8:47         ` Chris Wilson
2014-11-07 17:45     ` [PATCH v6] drm/i915: Add tracepoints to track a vm during its lifetime daniele.ceraolospurio
2014-11-08  8:44       ` Chris Wilson
     [not found]         ` <5460A438.5080804@intel.com>
2014-11-10 11:43           ` Ceraolo Spurio, Daniele
     [not found]           ` <20141110115431.GC22109@nuc-i3427.alporthouse.com>
2014-11-10 12:28             ` Ceraolo Spurio, Daniele
2014-11-10 12:34               ` Chris Wilson
2014-11-10 13:44       ` [PATCH v7] " daniele.ceraolospurio
2014-11-11  3:00         ` [PATCH v7] drm/i915: Add tracepoints to track a vm shuang.he
2014-11-11  9:21         ` [PATCH v7] drm/i915: Add tracepoints to track a vm during its lifetime Daniel Vetter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1414164652-24281-1-git-send-email-daniele.ceraolospurio@intel.com \
    --to=daniele.ceraolospurio@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.