Skip to content

Commit 05a2496

Browse files
robclarkRob Clark
authored andcommitted
drm/msm: Add mmu prealloc tracepoint
So we can monitor how many pages are getting preallocated vs how many get used. Signed-off-by: Rob Clark <robdclark@chromium.org> Signed-off-by: Rob Clark <robin.clark@oss.qualcomm.com> Tested-by: Antonino Maniscalco <antomani103@gmail.com> Reviewed-by: Antonino Maniscalco <antomani103@gmail.com> Patchwork: https://patchwork.freedesktop.org/patch/661521/
1 parent 0b4339c commit 05a2496

2 files changed

Lines changed: 18 additions & 0 deletions

File tree

drivers/gpu/drm/msm/msm_gpu_trace.h

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,20 @@ TRACE_EVENT(msm_gpu_preemption_irq,
205205
TP_printk("preempted to %u", __entry->ring_id)
206206
);
207207

208+
TRACE_EVENT(msm_mmu_prealloc_cleanup,
209+
TP_PROTO(u32 count, u32 remaining),
210+
TP_ARGS(count, remaining),
211+
TP_STRUCT__entry(
212+
__field(u32, count)
213+
__field(u32, remaining)
214+
),
215+
TP_fast_assign(
216+
__entry->count = count;
217+
__entry->remaining = remaining;
218+
),
219+
TP_printk("count=%u, remaining=%u", __entry->count, __entry->remaining)
220+
);
221+
208222
#endif
209223

210224
#undef TRACE_INCLUDE_PATH

drivers/gpu/drm/msm/msm_iommu.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
#include <linux/io-pgtable.h>
99
#include <linux/kmemleak.h>
1010
#include "msm_drv.h"
11+
#include "msm_gpu_trace.h"
1112
#include "msm_mmu.h"
1213

1314
struct msm_iommu {
@@ -346,6 +347,9 @@ msm_iommu_pagetable_prealloc_cleanup(struct msm_mmu *mmu, struct msm_mmu_preallo
346347
struct kmem_cache *pt_cache = get_pt_cache(mmu);
347348
uint32_t remaining_pt_count = p->count - p->ptr;
348349

350+
if (p->count > 0)
351+
trace_msm_mmu_prealloc_cleanup(p->count, remaining_pt_count);
352+
349353
kmem_cache_free_bulk(pt_cache, remaining_pt_count, &p->pages[p->ptr]);
350354
kvfree(p->pages);
351355
}

0 commit comments

Comments
 (0)