Re: [Intel-gfx] [PATCH v7] drm/i915: Add tracepoints to track a vm during its lifetime

2014-11-11 Thread Daniel Vetter
On Mon, Nov 10, 2014 at 01:44:31PM +, daniele.ceraolospu...@intel.com wrote:
> From: Daniele Ceraolo Spurio 
> 
> - ppgtt init/release: these tracepoints are useful for observing the
>   creation and destruction of Full PPGTTs.
> 
> - ctx create/free: we can use the ctx_free trace in combination with the
>   ppgtt_release one to be sure that the ppgtt doesn't stay alive for too
>   long after the ctx is destroyed. ctx_create is there for simmetry
> 
> - switch_mm: important point in the lifetime of the vm
> 
> v4: add DOC information
> v5: pull the DOC in drm.tmpl
> v6: clean ppgtt init/release traces + add ctx create/free and switch_mm
> tracepoints (Chris)
> v7: drop execlist_submit_context tracepoint
> 
> Cc: Chris Wilson 
> 
> Signed-off-by: Daniele Ceraolo Spurio 
> Reviewed-by: Chris Wilson 

Queued for -next, thanks for the patch.
-Daniel
-- 
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PATCH v7] drm/i915: Add tracepoints to track a vm

2014-11-10 Thread shuang . he
Tested-By: PRC QA PRTS (Patch Regression Test System Contact: 
shuang...@intel.com)
-Summary-
Platform: baseline_drm_intel_nightly_pass_rate->patch_applied_pass_rate
BYT: pass/total=277/348->276/348
PNV: pass/total=323/328->325/328
ILK: pass/total=328/330->329/330
IVB: pass/total=545/546->544/546
SNB: pass/total=558/563->559/563
HSW: pass/total=577/581->574/581
BDW: pass/total=435/435->434/435
-Detailed-
test_platform: test_suite, test_case, result_with_drm_intel_nightly(count, 
machine_id...)...->result_with_patch_applied(count, machine_id)...
BYT: Intel_gpu_tools, igt_gem_bad_reloc_negative-reloc-lut, NSPT(1, M29)PASS(9, 
M36M29) -> NSPT(1, M29)PASS(3, M29)
PNV: Intel_gpu_tools, igt_gem_mmap_offset_exhaustion, DMESG_WARN(2, 
M23M24)PASS(14, M24M23M7) -> PASS(4, M7)
PNV: Intel_gpu_tools, igt_gem_unref_active_buffers, DMESG_WARN(2, M23)PASS(14, 
M24M23M7) -> PASS(4, M7)
ILK: Intel_gpu_tools, igt_kms_render_gpu-blit, DMESG_WARN(1, M26)PASS(15, 
M6M26M37) -> PASS(4, M26)
ILK: Intel_gpu_tools, igt_kms_flip_flip-vs-rmfb, PASS(4, M26) -> DMESG_WARN(2, 
M26)PASS(2, M26)
ILK: Intel_gpu_tools, igt_kms_flip_wf_vblank-vs-dpms-interruptible, 
DMESG_WARN(1, M26)PASS(15, M6M26M37) -> PASS(4, M26)
IVB: Intel_gpu_tools, igt_gem_bad_reloc_negative-reloc, NSPT(4, M4M34)PASS(9, 
M34M4) -> NSPT(2, M34)PASS(2, M34)
SNB: Intel_gpu_tools, igt_kms_cursor_crc_cursor-256x256-sliding, DMESG_WARN(3, 
M35M22)PASS(7, M22M35) -> PASS(4, M22)
HSW: Intel_gpu_tools, igt_gem_bad_reloc_negative-reloc, NSPT(4, 
M39M20M40)PASS(9, M40M39M20) -> NSPT(2, M39)PASS(2, M39)
HSW: Intel_gpu_tools, igt_kms_cursor_crc_cursor-64x64-random, FAIL(1, 
M39)PASS(3, M40M39) -> FAIL(1, M39)DMESG_WARN(2, M39)PASS(1, M39)
HSW: Intel_gpu_tools, igt_kms_rotation_crc_primary-rotation, PASS(4, M40M39) -> 
DMESG_WARN(1, M39)PASS(3, M39)
BDW: Intel_gpu_tools, igt_gem_reset_stats_ban-bsd, PASS(16, M30M28M42) -> 
DMESG_WARN(1, M42)PASS(3, M42)
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx


[Intel-gfx] [PATCH v7] drm/i915: Add tracepoints to track a vm during its lifetime

2014-11-10 Thread daniele . ceraolospurio
From: Daniele Ceraolo Spurio 

- ppgtt init/release: these tracepoints are useful for observing the
  creation and destruction of Full PPGTTs.

- ctx create/free: we can use the ctx_free trace in combination with the
  ppgtt_release one to be sure that the ppgtt doesn't stay alive for too
  long after the ctx is destroyed. ctx_create is there for simmetry

- switch_mm: important point in the lifetime of the vm

v4: add DOC information
v5: pull the DOC in drm.tmpl
v6: clean ppgtt init/release traces + add ctx create/free and switch_mm
tracepoints (Chris)
v7: drop execlist_submit_context tracepoint

Cc: Chris Wilson 

Signed-off-by: Daniele Ceraolo Spurio 
Reviewed-by: Chris Wilson 
---
 Documentation/DocBook/drm.tmpl  |  21 +++
 drivers/gpu/drm/i915/i915_gem_context.c |   6 ++
 drivers/gpu/drm/i915/i915_gem_gtt.c |   4 ++
 drivers/gpu/drm/i915/i915_trace.h   | 104 
 4 files changed, 135 insertions(+)

diff --git a/Documentation/DocBook/drm.tmpl b/Documentation/DocBook/drm.tmpl
index 7277a7f..0f485a0 100644
--- a/Documentation/DocBook/drm.tmpl
+++ b/Documentation/DocBook/drm.tmpl
@@ -3994,6 +3994,27 @@ int num_ioctls;
 !Idrivers/gpu/drm/i915/intel_lrc.c
   
 
+
+
+   Tracing 
+  
+This sections covers all things related to the tracepoints implemented in
+the i915 driver.
+  
+  
+ i915_ppgtt_create and i915_ppgtt_release 
+!Pdrivers/gpu/drm/i915/i915_trace.h i915_ppgtt_create and i915_ppgtt_release 
tracepoints
+  
+  
+ i915_context_create and i915_context_free 
+!Pdrivers/gpu/drm/i915/i915_trace.h i915_context_create and i915_context_free 
tracepoints
+  
+  
+ switch_mm 
+!Pdrivers/gpu/drm/i915/i915_trace.h switch_mm tracepoint
+  
+
+
   
 !Cdrivers/gpu/drm/i915/i915_irq.c
 
diff --git a/drivers/gpu/drm/i915/i915_gem_context.c 
b/drivers/gpu/drm/i915/i915_gem_context.c
index 7d32571..1fb 100644
--- a/drivers/gpu/drm/i915/i915_gem_context.c
+++ b/drivers/gpu/drm/i915/i915_gem_context.c
@@ -88,6 +88,7 @@
 #include 
 #include 
 #include "i915_drv.h"
+#include "i915_trace.h"
 
 /* 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
@@ -137,6 +138,8 @@ void i915_gem_context_free(struct kref *ctx_ref)
struct intel_context *ctx = container_of(ctx_ref,
 typeof(*ctx), ref);
 
+   trace_i915_context_free(ctx);
+
if (i915.enable_execlists)
intel_lr_context_free(ctx);
 
@@ -274,6 +277,8 @@ i915_gem_create_context(struct drm_device *dev,
ctx->ppgtt = ppgtt;
}
 
+   trace_i915_context_create(ctx);
+
return ctx;
 
 err_unpin:
@@ -549,6 +554,7 @@ static int do_switch(struct intel_engine_cs *ring,
from = ring->last_context;
 
if (to->ppgtt) {
+   trace_switch_mm(ring, to);
ret = to->ppgtt->switch_mm(to->ppgtt, ring);
if (ret)
goto unpin_out;
diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.c 
b/drivers/gpu/drm/i915/i915_gem_gtt.c
index c1cf332..7737e55 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..751d4ad 100644
--- a/drivers/gpu/drm/i915/i915_trace.h
+++ b/drivers/gpu/drm/i915/i915_trace.h
@@ -587,6 +587,110 @@ 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.
+ */
+DECLARE_EVENT_CLASS(i915_ppgtt,
+   TP_PROTO(struct i915_address_space *vm),
+   TP_ARGS(vm),
+
+   TP_STRUCT__entry(
+   __field(struct i915_address_space *, vm)
+   __field(u32, dev)
+   ),
+
+   TP_fas