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/
This commit is contained in:
Rob Clark 2025-06-29 13:13:21 -07:00 committed by Rob Clark
parent 0b4339c55e
commit 05a2496834
2 changed files with 18 additions and 0 deletions

View File

@ -205,6 +205,20 @@ TRACE_EVENT(msm_gpu_preemption_irq,
TP_printk("preempted to %u", __entry->ring_id)
);
TRACE_EVENT(msm_mmu_prealloc_cleanup,
TP_PROTO(u32 count, u32 remaining),
TP_ARGS(count, remaining),
TP_STRUCT__entry(
__field(u32, count)
__field(u32, remaining)
),
TP_fast_assign(
__entry->count = count;
__entry->remaining = remaining;
),
TP_printk("count=%u, remaining=%u", __entry->count, __entry->remaining)
);
#endif
#undef TRACE_INCLUDE_PATH

View File

@ -8,6 +8,7 @@
#include <linux/io-pgtable.h>
#include <linux/kmemleak.h>
#include "msm_drv.h"
#include "msm_gpu_trace.h"
#include "msm_mmu.h"
struct msm_iommu {
@ -346,6 +347,9 @@ msm_iommu_pagetable_prealloc_cleanup(struct msm_mmu *mmu, struct msm_mmu_preallo
struct kmem_cache *pt_cache = get_pt_cache(mmu);
uint32_t remaining_pt_count = p->count - p->ptr;
if (p->count > 0)
trace_msm_mmu_prealloc_cleanup(p->count, remaining_pt_count);
kmem_cache_free_bulk(pt_cache, remaining_pt_count, &p->pages[p->ptr]);
kvfree(p->pages);
}