drm/i915/gen8: Add dynamic page trace events
authorMichel Thierry <michel.thierry@intel.com>
Wed, 29 Jul 2015 16:23:49 +0000 (17:23 +0100)
committerDaniel Vetter <daniel.vetter@ffwll.ch>
Fri, 14 Aug 2015 16:16:19 +0000 (18:16 +0200)
The dynamic page allocation patch series added it for GEN6, this patch
adds them for GEN8.

v2: Consolidate pagetable/page_directory events
v3: Multiple rebases.
v4: Rebase after s/page_tables/page_table/.
v5: Rebase after Mika's ppgtt cleanup / scratch merge patch series.
v6: Rebase after gen8_map_pagetable_range removal.
v7: Use generic page name (px) in DECLARE_EVENT_CLASS (Akash)
v8: Defer define of i915_page_directory_pointer_entry_alloc (Akash)

Cc: Akash Goel <akash.goel@intel.com>
Signed-off-by: Ben Widawsky <ben@bwidawsk.net>
Signed-off-by: Michel Thierry <michel.thierry@intel.com> (v3+)
Reviewed-by: Akash Goel <akash.goel@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
drivers/gpu/drm/i915/i915_gem_gtt.c
drivers/gpu/drm/i915/i915_trace.h

index fc58f541d546e1fb774688d0bad4d3daa288a0b0..72f4777f06feb7d58032650d29b621813d0ac947 100644 (file)
@@ -847,6 +847,7 @@ static int gen8_ppgtt_alloc_pagetabs(struct i915_address_space *vm,
                gen8_initialize_pt(vm, pt);
                pd->page_table[pde] = pt;
                __set_bit(pde, new_pts);
+               trace_i915_page_table_entry_alloc(vm, pde, start, GEN8_PDE_SHIFT);
        }
 
        return 0;
@@ -907,6 +908,7 @@ gen8_ppgtt_alloc_page_directories(struct i915_address_space *vm,
                gen8_initialize_pd(vm, pd);
                pdp->page_directory[pdpe] = pd;
                __set_bit(pdpe, new_pds);
+               trace_i915_page_directory_entry_alloc(vm, pdpe, start, GEN8_PDPE_SHIFT);
        }
 
        return 0;
@@ -1056,6 +1058,10 @@ static int gen8_alloc_va_range(struct i915_address_space *vm,
                        /* Map the PDE to the page table */
                        page_directory[pde] = gen8_pde_encode(px_dma(pt),
                                                              I915_CACHE_LLC);
+                       trace_i915_page_table_entry_map(&ppgtt->base, pde, pt,
+                                                       gen8_pte_index(start),
+                                                       gen8_pte_count(start, length),
+                                                       GEN8_PTES);
 
                        /* NB: We haven't yet mapped ptes to pages. At this
                         * point we're still relying on insert_entries() */
index 2f34c47bd4bfb7a566453475cd5be6f16b4b7872..f230d7639000f6915e9bc00fc5db85f0b809865d 100644 (file)
@@ -186,33 +186,41 @@ DEFINE_EVENT(i915_va, i915_va_alloc,
             TP_ARGS(vm, start, length, name)
 );
 
-DECLARE_EVENT_CLASS(i915_page_table_entry,
-       TP_PROTO(struct i915_address_space *vm, u32 pde, u64 start, u64 pde_shift),
-       TP_ARGS(vm, pde, start, pde_shift),
+DECLARE_EVENT_CLASS(i915_px_entry,
+       TP_PROTO(struct i915_address_space *vm, u32 px, u64 start, u64 px_shift),
+       TP_ARGS(vm, px, start, px_shift),
 
        TP_STRUCT__entry(
                __field(struct i915_address_space *, vm)
-               __field(u32, pde)
+               __field(u32, px)
                __field(u64, start)
                __field(u64, end)
        ),
 
        TP_fast_assign(
                __entry->vm = vm;
-               __entry->pde = pde;
+               __entry->px = px;
                __entry->start = start;
-               __entry->end = ((start + (1ULL << pde_shift)) & ~((1ULL << pde_shift)-1)) - 1;
+               __entry->end = ((start + (1ULL << px_shift)) & ~((1ULL << px_shift)-1)) - 1;
        ),
 
        TP_printk("vm=%p, pde=%d (0x%llx-0x%llx)",
-                 __entry->vm, __entry->pde, __entry->start, __entry->end)
+                 __entry->vm, __entry->px, __entry->start, __entry->end)
 );
 
-DEFINE_EVENT(i915_page_table_entry, i915_page_table_entry_alloc,
+DEFINE_EVENT(i915_px_entry, i915_page_table_entry_alloc,
             TP_PROTO(struct i915_address_space *vm, u32 pde, u64 start, u64 pde_shift),
             TP_ARGS(vm, pde, start, pde_shift)
 );
 
+DEFINE_EVENT_PRINT(i915_px_entry, i915_page_directory_entry_alloc,
+                  TP_PROTO(struct i915_address_space *vm, u32 pdpe, u64 start, u64 pdpe_shift),
+                  TP_ARGS(vm, pdpe, start, pdpe_shift),
+
+                  TP_printk("vm=%p, pdpe=%d (0x%llx-0x%llx)",
+                            __entry->vm, __entry->px, __entry->start, __entry->end)
+);
+
 /* Avoid extra math because we only support two sizes. The format is defined by
  * bitmap_scnprintf. Each 32 bits is 8 HEX digits followed by comma */
 #define TRACE_PT_SIZE(bits) \